How to Configure Cacti cacti-0.8.8g using CentOS 7 Linux

After completed all the required packages and configuration in the previous phase of How to install Cacti Network Monitoring you can follow the configuration now from here to finish it.

Step 1: Now we are ready to install the Cacti application using yum

[[email protected] ~]# yum install cacti


then it will confirm if you want to proceed installing the package using the repository that we just use


Step 2: Now import the SQL database tables “cacti.sql” using the command below it will search the path of the file

[[email protected]~]# rpm -ql cacti | grep cacti.sql

[[email protected]~]# rpm -ql cacti | grep cacti.sql
[[email protected] ~]#


And then issue the below command to import tables to cactidb and type the password that was set in the previous phase.

[[email protected] ~]# mysql -u root -p cactidb < /usr/share/doc/cacti-0.8.8b/cacti.sql


and verify if the table was imported properly by login in mariadb

[[email protected] ~]# mysql -u root -p


MariaDB [(none)]> show databases;
MariaDB [(none)]> use cactidb;
MariaDB [cactidb]> show tables;


Step 3:  Edit the file in /etc/cacti/db.php and append below lines .

[[email protected] ~]# vim /etc/cacti/db.php


and then type your db name, db user and database password

/* make sure these values refect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cactidb";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "abcde12345";
$database_port = "3306";
$database_ssl = false;


Step 4: Open /etc/httpd/conf.d/cacti.conf file put comment in all line that has the word “Deny from all” and there are only 3 of them inside and put a # as show in below. And change the “Order deny,allow” to “Order allow,deny” and also change “Require host localhost” to “Require all granted”




Alias /cacti    /usr/share/cacti

<Directory /usr/share/cacti/>
        <IfModule mod_authz_core.c>
                # httpd 2.4
#               Require host localhost
                Require all granted
        <IfModule !mod_authz_core.c>
                # httpd 2.2
                Order allow,deny
#               Order deny,allow
#               Deny from all
#               Allow from localhost
                Allow from all

<Directory /usr/share/cacti/install>
        # mod_security overrides.
        # Uncomment these if you use mod_security.
        # allow POST of application/x-www-form-urlencoded during install
        #SecRuleRemoveById 960010
        # permit the specification of the rrdtool paths during install
        #SecRuleRemoveById 900011

# These sections marked "Require all denied" (or "Deny from all")
# should not be modified.
# These are in place in order to harden Cacti.
<Directory /usr/share/cacti/log>
        <IfModule mod_authz_core.c>
                Require all denied
        <IfModule !mod_authz_core.c>
                Order allow,deny
                allow from all
#               Order deny,allow
#               Deny from all
<Directory /usr/share/cacti/rra>
        <IfModule mod_authz_core.c>
                Require all denied
        <IfModule !mod_authz_core.c>
                Order allow,deny
                allow from all
#               Order deny,allow
#               Deny from all

Step 5: Edit the file “/etc/cron.d/cacti” and uncomment the line / remove the #


*/5 * * * *     cacti   /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1


and then restart the httpd and crond service by issuing below commands

[[email protected] ~]# systemctl restart httpd.service
[[email protected] ~]# systemctl restart crond.service


And then make sure you disabled the firewall (iptables) to enable the port 80 to open so that the client can connect to Cacti

[[email protected]~]# systemctl disable iptables.service


[[email protected]~]# iptables –flush

and followed by netstat -natp command to check if the port 80 is open as shown in below image

[[email protected]~]# netstat -natp


Step 6: Now open http://serverip/cacti in your browser, and configure the Cacti installation in your browser page


Click Next


Click Next then Finish (Leave all by default)



Step 7: Login as default user using below credentials  to continue configuring the Cacti

user: admin
password: admin


then after you type the user admin and password as admin the Cacti will ask you one time change password as shown in below screenshot. This time type your own password


And that’s it it will show you the management view of the Cacti



Step 8: Then configure the cacti graph choose – > Devices – > click Localhost in the right side menu and look for


Then scroll down and look for “SNMP Options“. select SNMP Version -> “Version 2” and SNMP Community -> public and then click the “save” button at the end bottom.


Step 9: Now you can see the SNMP information at the top . Click “Create Graphs for this host” in the upper right


and choose  Graph Types > then ALL and select all the check boxes as show below and press “create“. Now choose the color option ( Leave as it is ) and then press “create“.



After few minutes , you can see the initial stage of graphs for localhost in the Graphs section tab on top . after few hours you can see the graphs like below.



Step 10: Adding the Linux, Windows and Network devices in Cacti Monitoring

Adding linux machines

a. Now in cacti , “Create devices” and Add description and hostname (or) IP .
b. Choose “Host Template” as “Local linux machine”.
c. Under SNMP Options select SNMP Version -> “Version 2” and SNMP Community -> public and click the “save” button at the bottom.
d. Add the device to the Graph tree.

Adding Windows machines

a. Enable SNMP service in your windows client
b. Make sure you added community name “public” and allowed your Cacti server IP.
c. Now in cacti , “Create devices” and Add description and hostname (or) IP .
d. Choose “Host Template” as “Windows 2000/XP host”.
e. Under SNMP Options select SNMP Version -> “Version 2” and SNMP Community -> public and click the “save” button at the bottom.
f. Add the device to the Graph tree.

Adding Network Switch/Router

a. Go to Management and click on Devices.
b. Click on the Add link in the top right corner.
c. Enter the hostname and description of your Cisco device.
d. Select Cisco Router as the Host Template.

e. Select Version 2 for the SNMP Version and enter the community name of your Cisco device.

f. Click on Save at the bottom.


Step 11: Edit the “/etc/php.ini” file and add the timezone “date.timezone = Asia/Singapore”

[[email protected]~]# vim /etc/php.ini

; Defines the default timezone used by the date functions
;date.timezone =
date.timezone = Asia/Singapore

;date.default_latitude = 31.7667

And after that restart the httpd by issuing “systemctl restart httpd.service” command

Step 12: Edit your index.php and append below line inside this will correct the error regarding the UTC Timezone error that will log in /var/log/httpd/*.logs


 | Copyright (C) 2004-2013 The Cacti Group                                 |
 |                                                                         |
 | This program is free software; you can redistribute it and/or           |
 | modify it under the terms of the GNU General Public License             |
 | as published by the Free Software Foundation; either version 2          |
 | of the License, or (at your option) any later version.                  |
 |                                                                         |
 | This program is distributed in the hope that it will be useful,         |
 | but WITHOUT ANY WARRANTY; without even the implied warranty of          |
 | GNU General Public License for more details.                            |
 | Cacti: The Complete RRDTool-based Graphing Solution                     |
 | This code is designed, written, and maintained by the Cacti Group. See  |
 | about.php and/or the AUTHORS file for specific developer information.   |
 |                                                   |





Step 13: It is very important that  you change this below line in host.php or else everytime you add device it will show error “Validation error problem. However in latest version 6.2 this was already fix

[[email protected] cacti]# vim /usr/share/cacti/host.php

a. Edit host.php and in line 179 vim /usr/share/cacti/host.php
b. Replace the line 179:
with below
input_validate_input_regex(get_request_var_post(‘drp_action’), “^([a-zA-Z0-9_]+)$”);
c. After that restart httpd.service

/* ------------------------
    The "actions" function
   ------------------------ */

function form_actions() {
        global $colors, $device_actions, $fields_host_edit;

        /* ================= input validation ================= */
        /* input_validate_input_number(get_request_var_post('drp_action')); */
        input_validate_input_regex(get_request_var_post('drp_action'), "^([a-zA-Z0-9_]+)$");
        /* ==================================================== */

        /* if we are to save this form, instead of display it */



1 Comment on "How to Configure Cacti cacti-0.8.8g using CentOS 7 Linux"

  1. Sweet

Leave a comment

Your email address will not be published.