Presentation of Cacti
Cacti is a monitoring application based on the rrdtool.
With Cacti, you can monitor one machine (CPU, memory, IO) or a group of machines.
Each machine under supervision requires the installation of the SNMP service.
To monitor one or a group of machines, you need to install several dependencies:
- the SNMP service which provides the monitoring data,
- the MariaDB/MySQL service that stores the data,
- and the HTTP/Apache service that displays the data.
Install the PHP packages:
# yum install -y php php-mysql php-snmp
Then, install the EPEL7 remote repository.
Finally, install the Cacti package:
# yum install -y cacti
Create the Cacti database:
# mysql -u root -p Enter password:
passwordWelcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 12 Server version: 5.5.35-MariaDB MariaDB Server Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> create database cacti; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> grant all on cacti.* to cacti@localhost identified by 'password'; Query OK, 0 rows affected (0.01 sec) MariaDB [(none)]> flush privileges; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> quit Bye
Create the Cacti tables:
# rpm -ql cacti | grep cacti.sql /usr/share/doc/cacti-0.8.8b/cacti.sql # mysql -u cacti -p cacti < /usr/share/doc/cacti-0.8.8b/cacti.sql
Edit the file called /etc/cacti/db.php and set the database name, user name and password:
# vi /etc/cacti/db.php $database_type = "mysql"; $database_default = "cacti"; $database_hostname = "localhost"; $database_username = "cacti"; $database_password = "password"; $database_port = "3306"; $database_ssl = false;
Edit the /etc/php.ini file and assign the proper timezone to the date.timezone variable like for example:
date.timezone = "Europe/Berlin"
Edit the file called /etc/httpd/conf.d/cacti.conf and replace Require host localhost with Require all granted in the file.
This configuration allows every host to connect to the Cacti service: restrict this permission as necessary.
Restart the HTTP service:
# apachectl restart
Edit the file /etc/cron.d/cacti and uncomment the line.
Start a browser at http://your-ip/cacti. Select “Next >>“, then “New Install“/”Next >>” and “Finish“.
Finally, enter admin/admin as login/password and press “Login“.
You will have to type a new password.
At this point, you’ve got an operational Cacti service.
Source: Inspired by www.tecmint.com.