Setup Cacti on RHEL 7.x and CentOS 7.x System
Cacti is an open-source, web-based network monitoring and graphing tool designed as a front-end application for the open-source, industry-standard data logging tool RRDtool. Cacti allows a user to poll services at predetermined intervals and graph the resulting data. It is generally used to graph time-series data of metrics such as CPU load and network bandwidth utilization. A common usage is to monitor network traffic by polling a network switch or router interface via Simple Network Management Protocol (SNMP).

The front end can handle multiple users, each with their own graph sets, so it is sometimes used by web hosting providers (especially dedicated server,virtual private server, and collocation providers) to display bandwidth statistics for their customers. It can be used to configure the data collection itself, allowing certain setups to be monitored without any manual configuration of RRDtool. Cacti can be extended to monitor any source via shell scripts and executables.

Cacti can use one of two back ends: "cmd.php", a PHP script suitable for smaller installations, or "Spine" (formerly Cactid), a C-based poller which can scale to thousands of hosts.
Install Apache, MariaDb php SNMP and RRDtool

Login in your Linux machine as root and run following command to install apache, php, MariaDB:
# yum install httpd httpd-devel mariadb-server php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli -y
Install php-snmp, net-snmp and rrdtool
# yum install php-snmp net-snmp-utils net-snmp-libs rrdtool -y
Start HTTPD, MySQL and SNMP service

To start HTTPD, MySQL and SNMP service enter following command in your console
# systemctl start httpd.service
# systemctl start mariadb.service
# systemctl start snmpd.service
Add HTTPD, MySQL and SNMP service to start on boot time:
# systemctl enable httpd.service
# systemctl enable mariadb.service
# systemctl enable snmpd.service
Setup MySQL database and User Accounts

First, set the MySQL root password:
# mysqladmin -u root password YOUR_PASSWORD
Now, create cacti database. Login into your MySQL server and create cacti database width user cacti and set the password for it:
# mysql -u root -p
MariaDB [(none)]> create database cacti;
MariaDB [(none)]> GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'cactipass';
MariaDB [(none)]> FLUSH privileges;
MariaDB [(none)]> quit;
Install Cacti on RHEL/CentOS 7.x

For installing cacti trough YUM command you must enable EPEL repository:
# yum install epel-release -y
After enabling EPEL repository, type following command to install cacti:
# yum install cacti -y
Install cacti tables to MySQL and configure MySQL settings for cacti

Now, import cacti database tables from the cacti.sql file. First locate cacti.sql file:
# rpm -ql cacti|grep cacti.sql
Import tables to cacti database:
# mysql -u cacti -p cacti < /usr/share/doc/cacti-0.8.8b/cacti.sql
Enter password:
Open /etc/cacti/db.php file using nano of VI editor and edit the below lines:
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cactipass";
Open http port in firewall

Open an http port in firewall:
# firewall-cmd --permanent --zone=public --add-service=http
# firewall-cmd --reload
Configure apache to Network Accessible

Open file called /etc/httpd/conf.d/cacti.conf
# etc/httpd/conf.d/cacti.conf
Now edit the "Allow From" line, Either set to ALL or enter your LAN subnet to allow access to cacti:
Alias /cacti    /usr/share/cacti

<Directory /usr/share/cacti/>
        <IfModule mod_authz_core.c>
                # httpd 2.4
                Require host
        <IfModule !mod_authz_core.c>
                # httpd 2.2
                Order deny,allow
                Deny from all
                Allow from
After editing cacti configuration file, restart the Apache service:
# systemctl restart httpd.service
Set cron for cacti

Open /etc/cron.d/cacti file and uncomment the line:
*/5 * * * * cacti /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
Run cacti installer

Go to http://YOUR-IP-ADDRESS/cacti/ and just follow the instructions on screen. The default username and password for cacti is admin/admin. Upon first login you will be forced to change the default password.

More information about cacti, see HERE.

About Author:

I am a Linux Administrator and Security Expert with this site i can help lot's of people about linux knowladge and as per security expert i also intersted about hacking related news.TwitterFacebook

Newer Post
Older Post


Post a Comment