Jump to content

Cacti

From MattWiki

Note: This Page was written with Fedora 8, 9, & 10 in mind, and may not work correctly with other versions or distributions.

Installing Cacti[edit | edit source]

Installing Cacti using Yum[edit | edit source]

yum install cacti gcc libtool httpd mysql mysql-server mysql-devel net-snmp net-snmp-utils net-snmp-devel openssl-devel

Now install the sql database

mysqladmin create cacti
echo "GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactiuser';" |mysql -t
mysql cacti < /usr/share/doc/cacti-0.8.7d/cacti.sql

Now edit the config file.

vim /usr/share/cacti/include/config.php

Installing Cacti from the tar ball[edit | edit source]

Installing Cacti's Prerequisite[edit | edit source]

yum install net-snmp net-snmp-utils rrdtool libdbi
ln /lib/libdb-4.7.so /lib/libdb-4.6.so

Installing Cacti[edit | edit source]

cd /var/www/html
wget http://www.cacti.net/downloads/cacti-0.8.7d.tar.gz
tar -xzf cacti-0.8.7d.tar.gz
mv cacti-0.8.7d.tar.gz cacti
cd cacti

Setting up a fresh install of Cacti[edit | edit source]

#If this is a fresh install run the following to update the database
mysqladmin create cacti
echo "GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactiuser';" |mysql -t
mysql -u cactiuser -pcactiuser cacti < cacti.sql

Next you will need to edit the config file to tell Cacti were the database is and how to get into it.

vim /var/www/html/cacti/include/config.php

You will need to change:

  • $database_username
  • $database_password

After you have saved the config file you should be able to access your new Cacti page. but there should be now data in the database yet. To add the data you will need to poller.php file to your cron tab.

*/5 * * * * php /var/www/html/cacti/poller.php > /dev/null 2>&1

Spine[edit | edit source]

Spine's Prerequisite[edit | edit source]

yum install autoconf net-snmp-devel mysql mysql-devel openssl-devel sysconftool libtool

Downloading and Compiling Spine[edit | edit source]

wget http://www.cacti.net/downloads/spine/cacti-spine-0.8.7c.tar.gz
tar -xzf cacti-spine-0.8.7c.tar.gz

cd cacti-spine-0.8.7c
autoreconf --force --install --symlink && chmod 755 configure && ./configure && make && echo $?

make install && ln -s /usr/local/spine/etc/spine.conf /etc/spine.conf && echo $?
  • Make sure you update your database info in the spine config file also.

Cacti Addons[edit | edit source]

Postfix Status Monitor[edit | edit source]

  • Required Packages
yum install perl-File-Tail libdb
ln -s /lib/libdb-4.7.so /lib/libdb-4.6.so

This is a rewrite for Cacti, of Joel Knight's MRTG Postfix Monitor setup found at his site. This setup was built for Cacti 0.8.7b.

You can download the templates here.

Add the following lines to /etc/snmp/snmpd.conf

exec postfix_received /var/net-snmp/postfix-stats-get received
exec postfix_delivered /var/net-snmp/postfix-stats-get delivered
exec postfix_sent /var/net-snmp/postfix-stats-get sent
exec postfix_bounced /var/net-snmp/postfix-stats-get bounced
exec postfix_rejected /var/net-snmp/postfix-stats-get rejected
exec postfix_unknown /var/net-snmp/postfix-stats-get unknown
exec postfix_spam /var/net-snmp/postfix-stats-get spam
exec postfix_virus /var/net-snmp/postfix-stats-get virus

Therefore the OID query's will be:

OID input command Description
.1.3.6.1.4.1.2021.8.1.101.1 received Number of messages received by Postfix
.1.3.6.1.4.1.2021.8.1.101.2 delivered Number of messages delivered to a mailbox
.1.3.6.1.4.1.2021.8.1.101.3 sent Number of messages sent from this posfix server
.1.3.6.1.4.1.2021.8.1.101.4 bounced Number of messages sent from this server and bounced
.1.3.6.1.4.1.2021.8.1.101.5 rejected Number of incoming messages rejected
.1.3.6.1.4.1.2021.8.1.101.6 unknown Number of unknown messages (catch all)
.1.3.6.1.4.1.2021.8.1.101.7 spam Number of spam messages
.1.3.6.1.4.1.2021.8.1.101.8 virus Number of virus ridden messages

ApacheStats 0.4[edit | edit source]

Links[edit | edit source]

http://www.debianhelp.co.uk/cactitemplates.htm Cacti Templates
http://www.wlug.org.nz/CactiLMSensors
http://forums.cacti.net/about1571.html