Cacti monitoring tool Cacti is a web-based monitoring tool designed for easy-to-use front-end for the data logging software using RRDTool. It allows users to monitor services at regular interval of time in graphical format. 1. Install Pre-requisite Cacti monitoring tool depends on Apache2/NGINX, MySQL, net-snmp, php, php-mysql, phpsnmp. So we will install these requirements first. Update the system # sudo apt-get update # sudo apt-get upgrade First, we will install Apache, PHP, PHP extension, SNMP. # sudo apt-get install apache2 php5 php5-mysql php5-snmp snmp php5-gd Now Install RRD-Tool # sudo apt-get install rrdtool
Finally install mysql server # sudo apt-get install mysql-server-5.6 While installing MySQL, the installer will ask for root password- provide it. Now run the script mysql_secure_installation to make it secure. # mysql_secure_installation 2. Add User Now create a user for cacti, we will use this user later for installation. # sudo useradd cactiuser 3. Create MySQL user/database Create a database and a user for Cacti. Grant all privileges to MySQL database user called cacdbuser to database cacdb. Login to mysql server using root password which you have set while installing mysql server. # mysql -u root -p # create database cacdb; # CREATE USER 'cacdbuser'@'localhost' IDENTIFIED BY 'somepassword'; # GRANT ALL ON cacdb.* TO 'cacdbuser'@'localhost'; # flush privileges; # exit
4. Download/Configure Download and extract the tar ball in /var/www/html directory and rename the directory. # wget http://www.cacti.net/downloads/cacti-0.8.8h.tar.gz Extract it # tar -xvzf cacti-0.8.8h.tar.gz # sudo cp -prvf cacti-0.8.8h /var/www/html/cac Import database # mysql -u root -p cacdb < /var/www/html/cac/cacti.sql Now edit the config.php file. # sudo nano /var/www/html/cac/include/config.php
Edit the following settings in config.php $database_type = "mysql"; $database_default = "cacdb"; $database_hostname = "localhost"; $database_username = "cacdbuser"; $database_password = "somepassword"; $database_port = "3306"; $database_ssl = false; $url_path = "/cac/"; $cacti_session_name = "Cacti"; Change the Ownership and group of web directory to apache user that is www-data. # chown -R www-data:www-data /var/www/html/cac/ Change ownership of rra and log directory of web directory with cactiuser that we have created in step 2 # chown -R cactiuser /var/www/html/cac/rra/ /var/www/html/cac/log/ Edit /etc/crontab file # nano /etc/crontab We want the script /var/www/html/cac/poller.php to run daily in every 5 minutes. To do that add the following given line at end of crontab. */5 * * * * cactiuser php /var/www/html/cac/poller.php > /dev/null 2>&1 Restart Apache # sudo service apache2 restart 5. Install Cacti Monitoring Tool Open the web browser and type the IP address/domain name of server suffixed by /cac. You will be asked to accept the license and click Next
Select the type of installation as new and click Next In this screen you will find path of all dependencies. These includes RRDtool, php, snmpwalk, snmpget, snmpbulkwalk, snmpgetnext, log path, RRD tool version and SNMP version. If any of these dependencies are not found then installation will not continue. Click Finish button
In next section, you will get login screen. Type username as admin and password as admin in the login form.
You will be asked to change the admin password. Provide a password and confirm it and then click Save. You will be redirected to dashboard. Wait for few minutes, you will see few graphs in the graph view.
That s all, the cati monitoring tool installation is complete and now you can browse all features.