Installing Cacti for network monitoring
Short form install instructions for Debian-based Linuxes:
apt-get install cacti
You may be prompted to install Apache and MySQL if you don’t have them installed.
You will prompted to select the webserver for which Cacti should be configured; select the appropriate one and then if MySQL is being installed, you’ll be prompted to set the MySQL ‘root’ user password.
The next prompt will be:
The cacti package must have a database installed and configured before it can be used.
This can be optionally handled with dbconfig-common.
Configure database for cacti with dbconfig-common?
Select yes and then enter the MySQL ‘root’ password when prompted. This will create the MySQL db and db user for cacti. You’ll be prompted for a password to set for that db user:
Please provide a password for cacti to register with the database server. If left blank, a random password will be generated.
MySQL application password for cacti:
Put a password in and then open your browser to http://$_the_server_you_installed_cacti_on/cacti ($_the_server_you_installed_cacti_on is either the FQDN or IP address of the server), select New Installation and click next: http://i.imgur.com/yI4sfm1.png
Configure the options and paths, if any paths are not filled in, do a “which” on the command line of the server you’re installing on, and it should give you the full path.
$ which php /usr/bin/php
If it’s not installed, install it with apt-get.
Log in with the username admin and password admin and you will be prompted to change the password.
Short form install for Redhat-based distributions:
Install the required packages: yum install httpd httpd-devel mysql mysql-server php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli php-snmp net-snmp-utils net-snmp-libs rrdtool
MariaDB can be used instead of MySQL if you’ve already transitioned to it from mysql.
Start the www, db and snmp services:
systemctl start httpd.service
systemctl start mariadb.service
systemctl start snmpd.service
and enable the services to autostart (chkconfig if you’re on older systems):
systemctl enable httpd.service
systemctl enable mariadb.service
systemctl enable snmpd.service
Create a cacti database in your mysql:
# mysql -u root -p -e 'create database cacti'
Create a cacti user with password ‘12345whatacoincidence’:
# mysql -u root -p
mysql> GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY '12345whatacoincidence';
mysql> FLUSH privileges;
mysql> \q
Installing cacti is made easier if you have the EPEL repo enabled, because then it’s just:
yum install cacti
More info on EPEL repo: http://www.tecmint.com/how-to-enable-epel-repository-for-rhel-centos-6-5/
The other (slightly more finicky) method is the tried and true compile-it-yourself method: http://www.cacti.net/download_cacti.php
In any case, when you have it installed, you’ll want to import the cacti tables from cacti.sql, so first, find ‘cacti.sql’:
# rpm -ql cacti | grep cacti.sql
and then (assuming it told you the file is in “/opt/cacti/cacti-0.8.7d/cacti.sql”,) import the file:
# mysql -u cacti -p cacti < /opt/cacti/cacti-0.8.7d/cacti.sql
Then you will need to edit your /etc/cacti/db.php file, using your actual values:
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "12345whatacoincidence";
$database_port = "3306";
Update your httpd config (probably /etc/httpd/conf.d/cacti.conf) to allow traffic to your cacti site and then restart httpd (or setup .htpasswd for that directory)
Edit the file /etc/cron.d/cacti to uncomment the cacti line.
Finally you’re able to open your browser to http://$_the_server_you_installed_cacti_on/cacti ($_the_server_you_installed_cacti_on is either the FQDN or IP address of the server), select New Installation and click next:
Configure the options and paths, if any paths are not filled in, do a “which” on the command line of the server you’re installing on, and it should give you the full path. If it’s not installed, install it with yum:
$ which php /usr/bin/php
Log in with the username admin and password admin and you will be prompted to change the password.
Installing Cacti in Windows
If you have a WAMP install (because no one will give you a nickel to get a real computer), then you can still install cacti: http://myconfigure.blogspot.com/2013/02/the-easiest-way-to-install-cacti-on.html
Followup
- login to cacti and set up your systems/switches/routers/firewalls to be monitored
- install and configure Network Weathermap and tell it to use your cacti (or mrtg etc) data so you can get a nice realtime(-ish) graph of your speeds and feeds.
- install and configure the thold plugin to alert you if the systems you’re monitoring are dropping below a particular threshold