Last active
November 22, 2024 20:33
Revisions
-
anamorph renamed this gist
Sep 14, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
anamorph created this gist
May 7, 2015 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,146 @@ # 0. First install the pre-reqs ## 0.1 Installing yum install mysql-server mysql php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli php-snmp php-pear-Net-SMTP php-mysql httpd -y ## 0.2 Configuring services chkconfig mysqld on chkconfig httpd on service mysqld start service httpd start ## 0.3 Configuring MYSQLD mysqladmin -u root password %your_password% mysql -uroot -p mysql mysql> create database cacti; mysql> grant all on cacti.* to cacti identified by 'cacti'; mysql> flush privileges; mysql> quit # 1. Installing and configuring SNMPD ## 1.1 Installing yum install net-snmp-utils php-snmp net-snmp-libs -y ## 1.2 Configuring vi /etc/snmp/snmpd.conf (modify to match as follows): #### # First, map the community name "public" into a "security name" # sec.name source community com2sec local localhost public #### # Second, map the security name into a group name: # groupName securityModel securityName group MyRWGroup v1 local group MyRWGroup v2c local group MyRWGroup usm local #### # Third, create a view for us to let the group have rights to: # Make at least snmpwalk -v 1 localhost -c public system fast again. # name incl/excl subtree mask(optional) view all included .1 80 #### # Finally, grant the group read-only access to the systemview view. # group context sec.model sec.level prefix read write notif access MyRWGroup "" any noauth exact all all none ############################################################################### # System contact information # # It is also possible to set the sysContact and sysLocation system # variables through the snmpd.conf file: syslocation "Running from above, in the Cloud" syscontact "me@nuage.ninja" Then close the config file and save modifications. Now onto running SNMPD as a service. /etc/init.d/snmpd start chkconfig snmpd on Let's check everything is working fine snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex You should get an output as such IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1 IP-MIB::ipAdEntIfIndex.192.168.3.116 = INTEGER: 2 # 2. Installing and configuring CACTI ## 2.1 Installing yum install cacti -y Now, let's create the cacti tables from the provided SQL. As I usually don't remember where litterally EVERYTHING is stored in a package, I'll search for it find / -name cacti.sql Which will get you something like this /usr/share/doc/cacti-0.8.8b/cacti.sql Let's run this now mysql -uroot -p cacti < /usr/share/doc/cacti-0.8.8b/cacti.sql ## 2.2 Configuring ### 2.2.1 CACTI vi /usr/share/cacti/include/config.php Make sure the information here matches what we edited in 0.3, close the config file and save modifications. ### 2.2.2 HTTPD vi /etc/httpd/conf.d/cacti.conf I modified that file to be able to log on from anywhere, but you could limit that either by using security groups or CIDR notation in the IfModule section <Directory /usr/share/cacti/> <IfModule mod_authz_core.c> # httpd 2.4 # Require host localhost Require host any </IfModule> <IfModule !mod_authz_core.c> # httpd 2.2 Order deny,allow Deny from all # Allow from localhost Allow from all </IfModule> </Directory> Then close the config file and save modifications. Now onto running CACTI's poller in crontab. vi /etc/cron.d/cacti Let's check the config is ok, then remove the leading # as follows: #### before #*/5 * * * * cacti /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1 #### after */5 * * * * cacti /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1 Then close the config file and save modifications. Restart cron to start polling into Cacti, and restart httpd to take all our modifications into account. service crond restart service httpd restart ### 2.2.3 WEB INTERFACE Now that everything is configured, you can access the web interface at http://%your_host%/cacti/ The default login/password is admin/admin; you will be asked to change it upon the first login. Enjoy !