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
chkconfig mysqld on
chkconfig httpd on
service mysqld start
service httpd start
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
yum install net-snmp-utils php-snmp net-snmp-libs -y
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 "[email protected]"
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
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
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.
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:
#*/5 * * * * cacti /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
*/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
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 !
Thanks a lot!