Cacti — CAMM — SNMPTT — SNMP Trap Howto
Cacti Install
Install Apacheyum install httpd
Updates runlevel information for system services, allows Apache to be started at boot time.chkconfig --levels 345 httpd on
chkconfig --add httpd
Install MySQL, SNMP and SNMP toolsyum install cacti mysql-server mysql php-mysql net-snmp net-snmp-utils php-snmp liberation-fonts
Updates runlevel information for system services
(Allows MySQL to be started at boot time.)chkconfig --levels 345 mysqld on
chkconfig --add mysql
Start MySQLservice mysqld start
Set root password in MySQL/usr/bin/mysqladmin -u root password 'PASSWORD-GOES-HERE'
Creates Cacti Database in MySQL/usr/bin/mysqladmin -u root -p create cacti
Creates cactiuser user and gives the cacti user access to the cacti database/usr/bin/mysql -u root –p
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 46
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> GRANT ALL ON cacti.* TO 'cactiuser'@'localhost' IDENTIFIED BY 'CACTIUSER-PASSWORD-GOES-HERE';
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
Imports Cacti database in MySQL/usr/bin/mysql cacti -u cactiuser -p < /var/www/cacti/cacti.sql
Edit /var/www/cacti/include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "CACTIUSER-PASSWORD-GOES-HERE";
$database_port = "3306";
Set the poller to run every 5 minutescrontab –e
# Used to update Cacti
*/5 * * * * /usr/bin/php /var/www/cacti/poller.php >> /var/log/cacti 2>&1
Edit /etc/httpd/conf.d/cacti.conf
Sets php flags.Alias /cacti /var/www/cacti/
< Directory /var/www/cacti/>
DirectoryIndex index.php
Options -Indexes
AllowOverride all
AddType application/x-httpd-php .php
php_flag magic_quotes_gpc on
php_flag track_vars on
< /Directory >
Start Apacheservice httpd start
Browse to http://serverip/cacti/ and follow the “Install Guide”
SNMPTT Install
Download snmptt_1.3 (http://sourceforge.net/projects/snmptt/)
tar -zxvf snmptt_1.3.tgz
cd snmptt_1.3
cp snmptthandler /usr/sbin
cp snmptt /usr/sbin
cp snmpttconvert /usr/sbin
cp snmpttconvertmib /usr/sbin
mkdir /var/spool/snmptt/
cp snmptt.init.d /etc/init.d/snmptt
Updates runlevel information for system services
(Allows SNMPTT to be started at boot time.)chkconfig --add snmptt
chkconfig --level 2345 snmptt on
service snmptt start
SNMPTT Requirementsperl -MCPAN -e shell
At the Perl CLI
(you will need GCC installed to build some of these modules)
install Text::ParseWords
install YAML
install Getopt::Long
install Config::IniFiles
install Time::HiRes
install Sys::Hostname
install Text::Balanced
install Sys::Syslog
install DBI
install DBD::mysql
install Crypt::DES
install Digest::MD5
install Digest::SHA1
install Digest::HMAC
install Net::SNMP
Install Cacti Plugin Architecture
Download Cacti Plugin Architecture from here
http://mirror.cactiusers.org/downloads/plugins/cacti-plugin-0.8.7g-PA-v2.8.tar.gz
tar xvzf cacti-plugin-0.8.7g-PA-v2.8.tar.gz
cd cacti-plugin-arch
copy cacti-plugin-0.8.7g-PA-v2.8.diff to cacti directory
cp cacti-plugin-0.8.7g-PA-v2.8.diff /var/www/cacti
Backup Cacti directorycp –R /var/www/cacti /var/www/cacti-backup
cd /var/www/cacti
Patching Cacti
Run a dry run patching Cacti for plugin architecture. This allows you to see if there are any errors patching. Most likely config.php
will failpatch -p1 -N --dry-run < cacti-plugin-0.8.7g-PA-v2.8.diff
Run the patching of Cactipatch -p1 –N < cacti-plugin-0.8.7g-PA-v2.8.diff
Edit /var/www/cacti/include/config.php
*/
$url_path = "/cacti/";
Open up Cacti and check everything is working.
You will need to enable Plugin Management
Install CAMM plugin
cd /var/www/cacti/plugin
Download the CAMM plugin from here http://forums.cacti.net/about31374.html
Unzip cacti_plugin_camm_v1_6_62.zip
Open a web browser and login to CactiConsole->Plugin Management->Install Plugin
Console->Plugin Management->Enable Plugin
Enable your user to see CAMM Manage and View tabs.
SNMPTT Configure
Edit /etc/init.d/snmptrapd
else
OPTIONS="-On -p /var/run/snmptrapd.pid"
Fi
“The -On is recommended. This will make snmptrapd pass OIDs in numeric form and prevent SNMPTT from having to translate the symbolic name to numerical form. If the UCD-SNMP / Net-SNMP Perl module is not installed, then you MUST use the -On switch. Depending on the version of UCD-SNMP / Net-SNMP, some symbolic names may not translate correctly.”
Updates runlevel information for system serviceschkconfig --add snmptrapd
chkconfig --level 2345 snmptrapd on
service snmptrapd start
Edit /etc/snmp/snmptt.ini
for CAMM plugin. Your MySQLdb username and password can be found /var/www/cacti/include/config.php
Make the following changes to snmptt.ini
daemon_uid = cacti
mibs_environment = ALL
date_time_format = %Y-%m-%d %H:%M:%S
unknown_trap_log_enable = 1
statistics_interval = 300 # or 3000
db_translate_enterprise = 1
mysql_dbi_enable = 1
mysql_dbi_table = plugin_camm_snmptt
mysql_dbi_table_unknown = plugin_camm_snmptt_unk
mysql_dbi_table_statistics = plugin_camm_snmptt_stat
mysql_dbi_host = localhost
mysql_dbi_port = 3306
mysql_dbi_database = cacti
mysql_dbi_username = cactiuser # << CHANGE !
mysql_dbi_password = cactipassword # << CHANGE !
mysql_ping_on_insert = 1
mysql_ping_interval = 300
date_time_format_sql = %Y-%m-%d %H:%M:%S
stat_time_format_sql = %Y-%m-%d %H:%M:%S
I also added logging to a log file for testing. This can be disabled after everything is working.
log_enable = 1
log_system_enable = 1
log_system_file = /var/log/snmptt/snmpttsystem.log
unknown_trap_log_enable = 1
unknown_trap_log_file = /var/log/snmptt/snmpttunknown.log
Make directory for log files and create log files.mkdir /var/log/snmptt
touch /var/log/snmptt/snmptt.log
touch /var/log/snmptt/snmpttunknown.log
Convert Cisco MIBS files to snmptt.conf
Download Cisco MIBs
ftp://ftp-sj.cisco.com/pub/mibs/v2/v2.tar.gz
tar xvzf v2.tar.gz
Set path for standard MIBS and Cisco Mibsexport MIBDIRS=/usr/local/snmp/mibs:$PWD/v2
Batch conversion
$ for i in v2/*my
> do
> /usr/local/sbin/snmpttconvertmib --format_desc=6 --net_snmp_perl --in=$i --out=snmptt.conf.cisco 2>>errors
> done
You can check the errors log for MIBS that failed. You might need to download some MIBS that Cisco does not supply in their tar file.
Create directory for converted MIBS filemkdir /etc/snmp/snmptt
Copy MIBS filecopy snmptt.conf.cisco /etc/snmp/snmptt
Edit /etc/snmp/snmptt.ini
Added the followingsnmptt_conf_files = < /etc/snmp/snmptt/snmptt.conf.cisco
Check to see all the services are runningservice httpd status
service mysqld status
service snmptrapd status
service snmptt status
Configure Cisco Device
Configure you Cisco Device. This example is for a Cisco Switch
config -t
snmp-server enable traps snmp authentication warmstart coldstart
snmp-server enable traps config
snmp-server enable traps copy-config
snmp-server enable traps flash insertion removal
snmp-server enable traps bridge
snmp-server enable traps stpx
snmp-server enable traps vtp
snmp-server enable traps vlancreate
snmp-server enable traps vlandelete
snmp-server enable traps port-security
snmp-server enable traps envmon fan shutdown supply temperature status
snmp-server enable traps hsrp
snmp-server enable traps vlan-membership
snmp-server host “CACTI-SERVER” version 2c public
Display the current SNMP sessions#show snmp
Do a copy run start and this should generate a snmp trap and should be logged by the Cacti server.
Watch snmptt.log
file to see if the server logged the trap.“tail /var/log/snmptt/snmptt.log”
Cacti should display the trap also.
References
Cisco SNMP Info
http://www.cisco.com/en/US/docs/ios/12_1/configfun/command/reference/frd3001.html
SNMPTT Info
http://www.snmptt.org/docs/snmptt.shtml
SNMPTT Perl Requirments Install
http://intuitinnovations.com/blog/archives/154
Centos/Cacti Install Info
http://docs.cslabs.clarkson.edu/wiki/Install_Cacti_on_CentOS_5
CAMM Plugin Install Info
http://forums.cacti.net/about31374-0-asc-0.html
|
Bulk Cisco MIBS Convert
http://cerebro.victoriacollege.edu/hobbit-trap.html
180