How to Install Cacti (Network Monitoring) Tool on RHEL Systems

The Cacti tool is an open-source, web-based solution for network monitoring and system graphing in IT businesses. Cacti allows users to poll services regularly to create graphs using RRDtool.

It’s typically used to graph time-series data for metrics like network bandwidth utilization, CPU load, running processes, disk space, and more.

In this how-to, we will demonstrate how to install and set up a comprehensive network monitoring application called Cacti using the Net-SNMP tool on RHEL-based distributions such as CentOS Stream, Fedora, Rocky, and Alma Linux, using the YUM and DNF package manager tools.

Cacti Required Packages

The Cacti required the following packages to be installed on your Linux operating system.

  • Apache : A Web server to display network graphs created by PHP and RRDTool.
  • MySQL : A Database server to store cacti information.
  • PHP : A script module to create graphs using RRDTool.
  • PHP-SNMP : A PHP extension for SNMP to access data.
  • NET-SNMP : An SNMP (Simple Network Management Protocol) is used to manage the network.
  • RRDTool : A database tool to manage and retrieve time series data like CPU load, Network Bandwidth, etc.

For demonstration purposes, we used Rocky Linux 9 to install the Cacti tool, but the same instructions work for all RHEL-based distributions.

Step 1: Install Required Packages in Linux

First, begin by updating your system’s package repository to ensure you have the latest versions of software packages available.

sudo dnf update

Next, install the necessary packages for Cacti and its dependencies using the following command.

sudo dnf install net-snmp-utils net-snmp-libs rrdtool php-mysqlnd php-snmp php-xml php-gd mariadb-server httpd
Install Cacti Required Packages
Install Cacti Required Packages

Step 2: Install Cacti Tool in Linux

To install Cacti, make sure that the EPEL repository is enabled on your system.

sudo yum install epel-release

Once the EPEL repository is enabled, you can install Cacti by running the following command.

sudo yum install cacti
Install Cacti in Linux
Install Cacti in Linux

Step 3: Secure MariaDB Database

To configure MySQL for Cacti, we must first secure the newly installed MySQL server and then create the Cacti database with the user “Cacti“. If your MySQL is already installed and secured, you don’t need to do this again.

sudo mysql_secure_installation

Follow the prompts to set up a root password, remove anonymous users, disallow remote root login, and remove the test database.

Secure MySQL Installation
Secure MySQL Installation

Step 4: Create Cacti Database

Log in to the MySQL server using the newly created password, and then create the Cacti database with the user “Cacti” setting a password for it.

sudo mysql -u root -p
CREATE DATABASE cacti;
CREATE USER 'cacti'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON cacti.* TO 'cacti'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Create Cacti Database
Create Cacti Database

Next, you need to import the default Cacti database schema into the newly created database, but before that, you need to find out the database file path using the rpm command and import it as shown.

sudo rpm -ql cacti | grep cacti.sql
sudo mysql -u cactiuser -p cacti < /usr/share/doc/cacti/cacti.sql
Import Cacti Database
Import Cacti Database

Step 5: Configure Cacti Database Connection

To configure the Cacti database connection, you need to open the configuration file as shown.

sudo vi /etc/cacti/db.php

Update the following lines with your database information.

$database_type     = 'mysql';
$database_default  = 'cacti';
$database_hostname = 'localhost';
$database_username = 'cacti';
$database_password = 'your_password';
Configure Cacti Database Settings
Configure Cacti Database Settings

Step 6: Configure Apache for Cacti

Open a file called /etc/httpd/conf.d/cacti.conf with your choice of editor.

sudo vi /etc/httpd/conf.d/cacti.conf

Add the following lines to the file:

Alias /cacti /usr/share/cacti
<Directory /usr/share/cacti/>
    Options +FollowSymLinks
    AllowOverride None
    <IfModule mod_authz_core.c>
        # Apache 2.4
        Require all granted
    </IfModule>
    <IfModule !mod_authz_core.c>
        # Apache 2.2
        Order Deny,Allow
        Deny from all
        Allow from all
    </IfModule>
</Directory>

Save and close the file.

Finally, restart the Apache and MariaDB services to apply the changes.

sudo systemctl restart httpd
sudo systemctl restart mariadb

Step 7: Configure Cacti Cron Job

Now open the crontab file to schedule polling intervals for Cacti.

sudo vi /etc/cron.d/cacti

Remove the comment from the following line. The poller.php script runs every 5 minutes to gather data from known hosts, which Cacti uses to create graphs.

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

Step 8: Access Cacti Web Interface

To access the Cacti web interface, you need to open port 80 on the firewall to allow inbound traffic on that port.

sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
sudo firewall-cmd --reload

You can now access Cacti via a web browser using the server’s IP address or domain name as shown.

http://your_server_ip/cacti
OR
http://domain.com/cacti

Now, follow the on-screen instructions to complete the installation process

User: admin
Password: admin
Cacti User Login
Cacti User Login

Next, change the default Cacti password.

Change Cacti Admin Password
Change Cacti Admin Password

Accept Cacti License Agreement.

Accept Cacti License Agreement
Accept Cacti License Agreement

Next, the screen shows Pre-installation Checks for Cacti installation, please correct the suggested settings in your /etc/php.ini file as shown and restart Apache after making changes.

memory_limit = 800M
max_execution_time = 60
date.timezone = Asia/Kolkata
Cacti Pre-installation Checks
Cacti Pre-installation Checks

Similarly, you also need to grant access to the MySQL TimeZone database for user Cacti, so that the database is populated with global TimeZone information.

mysql> use mysql;
mysql> GRANT SELECT ON mysql.time_zone_name TO cacti@localhost;
mysql> flush privileges;
Cacti MySQL Pre-Installation Checks
Cacti MySQL Pre-Installation Checks

Please choose the installation Type as “New Install“.

Select Cacti Installation Type
Select Cacti Installation Type

Make sure all the following directory permissions are correct before continuing.

Cacti Directory Permission Checks
Cacti Directory Permission Checks

Make sure all of these Critical Binary Locations and Versions values are correct before continuing.

Critical Binary Locations and Versions
Critical Binary Locations and Versions

Please choose the default Data Source Profile to be used for polling sources.

Select Data Source Profile
Select Data Source Profile

Please, choose the Device Templates that you wish to use after the Cacti Install.

Select Cacti Device Templates
Select Cacti Device Templates

Set the Server Collation in your MySQL configuration file /etc/my.cnf under the [mysqld] section as shown.

[mysqld]
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
Set Server Collation
Set Server Collation

Your Cacti Server is almost ready. Please confirm that you are happy to proceed.

Cacti Installation Process
Cacti Installation Process
Installing Cacti Server
Installing Cacti Server
Cacti Dashboard
Cacti Dashboard

Congratulations! You have successfully installed Cacti on RHEL-based systems. You can now start monitoring your network infrastructure by adding devices, creating graphs, and setting up alerts within the Cacti web interface.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

Ravi Saive
I am an experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

383 Comments

Leave a Reply
  1. Hi, on the step where you find the location of Cacti.sql and then need to use the cacti user password, when/where was the step to create the cacti user account and assign a password?

    Very newb to linux, and using this to help teach myself some setups.
    Thanks!

    Reply
    • @Bob,

      Run the following command to locate the location of Cacti.sql file.

      # rpm -ql cacti | grep cacti.sql
      

      Under “Create MySQL Cacti Database” section, you will find instructions to create Cacti database, user and password..

      Reply
  2. Would you please help me, i want monitor bind 9.8.2 statistic by cacti which has been installed according to your professional document, please investigate a way, i couldn’t find it

    Reply
  3. Hi

    after successful installation of cacti, i get server not found error as per following.
    Forbidden

    You don’t have permission to access /cacti/ on this server.

    Apache/2.2.15 (CentOS) Server at 172.15.220.14 Port 80

    Reply
  4. Hello,

    I have some problems after installing cacti. I am new in the linux and it is very difficult to resolve them.
    Fist when I go to Cacti console > settings I received a message error “http://192.168.5.5/cacti/settings.php. It may be down for maintenance or configured incorrectly ”
    The second problem is weathermap plugin wasn’t created tables in cacti databes, I created them manualy. Weathermap editor is successfully completed and it is work, but when I created something on new map It doesn’t appear as map in Network Weathermaps.
    Also I receive that message error when try to use realtime plugin “The Image Cache Directory directory does not exist. Please first create it and set permissions and then attempt to open another realtime graph. ”

    There are problems also with syslog and discover plugins but they are not important for me.

    Could you please help me as tell me what is needed to do. I really need to have this work.

    Reply
  5. Hi there, I followed your guide to the letter, but after the install/setting up cron (and even rebooting the server), only thing I get is a blank webpage.
    How can I find out why?

    Reply
      • Yes I did. With the exact command as stated above.
        Just for sake of argument, I’ve done it again (yum install php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli and yum install php-snmp), but it says this so it should be good.
        Package php-mysql-5.3.3-46.el6_6.x86_64 already installed and latest version
        Package 1:php-pear-1.9.4-4.el6.noarch already installed and latest version
        Package php-common-5.3.3-46.el6_6.x86_64 already installed and latest version
        Package php-gd-5.3.3-46.el6_6.x86_64 already installed and latest version
        Package php-devel-5.3.3-46.el6_6.x86_64 already installed and latest version
        Package php-5.3.3-46.el6_6.x86_64 already installed and latest version
        Package php-mbstring-5.3.3-46.el6_6.x86_64 already installed and latest version
        Package php-cli-5.3.3-46.el6_6.x86_64 already installed and latest version
        Nothing to do

        Package php-snmp-5.3.3-46.el6_6.x86_64 already installed and latest version
        Nothing to do

        Reply
        • @Thomas,
          I suggest you to check following things:

          1. Please cross check that all the required packages are installed for cacti
          2. Please check cacti database is created and imported cacti tables into cacti database
          3. In db.php file add the correct MySQL settings
          4. Check Apache configuration and make sure to allow cacti from your IP address

          After checking all the above things, try to browse again. If you still not able to see the cacti page, just send me your server details I will setup for you…

          Reply
          • Hi Ravi,
            Here you go:
            [root@metamon01s ~]# mysql -u root -p
            Enter password:
            Welcome to the MySQL monitor. Commands end with ; or \g.
            Your MySQL connection id is 2
            Server version: 5.1.73 Source distribution

            Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

            Oracle is a registered trademark of Oracle Corporation and/or its
            affiliates. Other names may be trademarks of their respective
            owners.

            Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

            mysql> show databases;
            +——————–+
            | Database |
            +——————–+
            | information_schema |
            | cacti |
            | mysql |
            | test |
            +——————–+
            4 rows in set (0.11 sec)

            mysql> quit
            Bye
            [root@metamon01s ~]# rpm -ql cacti | grep cacti.sql
            /usr/share/doc/cacti-0.8.8b/cacti.sql
            [root@metamon01s ~]# mysql -u cacti -p cacti show tables from cacti;
            +—————————+
            | Tables_in_cacti |
            +—————————+
            | cdef |
            | cdef_items |
            | colors |
            | data_input |
            | data_input_data |
            | data_input_fields |
            | data_local |
            | data_template |
            | data_template_data |
            | data_template_data_rra |
            | data_template_rrd |
            | graph_local |
            | graph_template_input |
            | graph_template_input_defs |
            | graph_templates |
            | graph_templates_gprint |
            | graph_templates_graph |
            | graph_templates_item |
            | graph_tree |
            | graph_tree_items |
            | host |
            | host_graph |
            | host_snmp_cache |
            | host_snmp_query |
            | host_template |
            | host_template_graph |
            | host_template_snmp_query |
            | plugin_config |
            | plugin_db_changes |
            | plugin_hooks |
            | plugin_realms |
            | poller |
            | poller_command |
            | poller_item |
            | poller_output |
            | poller_reindex |
            | poller_time |
            | rra |
            | rra_cf |
            | settings |
            | settings_graphs |
            | settings_tree |
            | snmp_query |
            | snmp_query_graph |
            | snmp_query_graph_rrd |
            | snmp_query_graph_rrd_sv |
            | snmp_query_graph_sv |
            | user_auth |
            | user_auth_perms |
            | user_auth_realm |
            | user_log |
            | version |
            +—————————+
            52 rows in set (0.02 sec)

            mysql> quit
            Bye
            [root@metamon01s ~]# vi /etc/cacti/db.php
            /* make sure these values refect your actual database/host/user/password */
            $database_type = “mysql”;
            $database_default = “cacti”;
            $database_hostname = “metamon01s.mydomainname.com”;
            $database_username = “cacti”;
            $database_password = “%my db cacti user password%”;
            $database_port = “3306”;
            $database_ssl = false;

            [root@metamon01s ~]# vi /etc/httpd/conf.d/cacti.conf
            # On httpd 2.4, change “Require host localhost” to “Require all granted”.
            # On httpd 2.2, change “Allow from localhost” to “Allow from all”.

            Alias /cacti /usr/share/cacti

            # httpd 2.4
            Require all granted

            # httpd 2.2
            Order deny,allow
            Deny from none
            Allow from all

            # mod_security overrides.

            [root@metamon01s ~]#

            Thanks for the help so far.

    • I fixed this issue:
      TL;DR firewall rule config error.

      The firewall commands to add -A INPUT -p udp -m state –state NEW -m udp –dport 80 -j ACCEPT and -A INPUT -p tcp -m state –state NEW -m tcp –dport 80 -j ACCEPT are added behind the -A INPUT -j REJECT –reject-with icmp-host-prohibited rule, so it blocks traffic on port 80 before allowing it, regardless of apache…

      Figured this out by spinning up a second vm -with a gui- and checking if the localhost could access it (which it could), and troubleshooting from there.

      Reply
  6. Is it possible to get data related to mysql database in cacti.

    Like number of queries executed for second.

    Number of reads, no of writes etc.

    Reply
  7. Hope you must be fine by grace of God. I am facing a problem in my thesis which is about to change the link data rate depending upon the buffer occupancy i-e if the buffer space is filled above threshold then increase the link data rate and if the buffer is occupied below threshold then reduce the link data rate. Now the problem exists in determining the buffer space occupied. For this I am using” ifconfig” and “netstat”.
    For ifconfig the output for switch AS-1 eth1 is as follows (by using netstat I was getting the same output):
    AS-1-eth1 Link encap:Ethernet HWaddr 7a:81:df:f1:29:74
    inet6 addr: fe80::7881:dfff:fef1:2974/64 Scope: Link
    UP BROADCAST RUNNING MULTICAST MTU: 1500 Metric: 1
    RX packets: 88 errors: 0 dropped: 0 overruns: 0 frame: 0
    TX packets: 57 errors: 0 dropped: 0 overruns: 0 carrier: 0
    Collisions: 0 txqueuelen: 1000
    RX bytes: 12266 (12.2 KB) TX bytes: 9052 (9.0 KB)
    Now I am thinking, packets in queue= RX packets-TX packets=88-57=31packets (31 packets are in the buffer). Am I thinking in the right direction?
    For “ifconfig” kindly check the following link
    http://www.computerhope.com/unix/uifconfi.htm, Kindly just go through the overview, I know your time is really precious and sorry to bother you, kindly reply me as soon as possible. Thanks in advance.

    Reply
  8. I’m having the problem that the graphs are showing empty.
    I’ve wait several minutes/hours and still is showing no data at all.
    this is true for one host I added and also the localhost.

    Reply
    • @Ditmar,
      If there isn’t any network traffic on the localhost, then it difficult to generate graphs….there must be some data to generate graphs…

      Reply
  9. it all installed correctly but my graphs are not showing, all I see is a little black box with and white X in the middle, anything missing ?

    Reply
  10. Hello and thank you for the tutorial.

    The installation went good but the graphs on localhost are empty (Data values are NaN) do you know why ?

    Thanks

    Reply
  11. Hi,
    Now I’m facing error here, please review the below error and kindly do the needful.

    [root@testserver ~]# mysql -u cacti -p cacti < /usr/share/doc/cacti-0.8.8b/cacti.sql
    Enter password:
    ERROR 1045 (28000): Access denied for user 'cacti'@'localhost' (using password: YES)
    [root@testserver ~]# cat /etc/cacti/db.php
    <?php
    /*
    +————————————————————————-+
    | 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 |
    | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
    | 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. |
    +————————————————————————-+
    | http://www.cacti.net/ |
    +————————————————————————-+
    */

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

    Reply
    • Please first create cacti user in mysql and then restore cacti database. Please follow the instructions carefully…

      Reply
  12. My graphs does not shows… a got this message:

    RRDTool Says:

    ERROR: opening ‘/usr/share/cacti/rra/localhost_load_1min_5.rrd’: No such file or directory

    Reply
    • @Marcelo,
      It seems “localhost_load_1min_5.rrd” file is missing, better use find command to find the file and move to the given location.

      # find -name localhost_load_1min_5.rrd
      # cp path-to/localhost_load_1min_5.rrd /usr/share/cacti/rra/
      

      After that try to Rebuild Poller Cache from the console under System Utilities..

      Reply
  13. Hi,
    I apologies as I’m still facing the issue, even uninstalled the mysql packages and tried, it didnt work. Please look at the following, looks same issue. I heard from my colleague that root is unaware of the mysql password but I’m not that clear in that concept.

    [root@testserver ~]# mysql -u root -ptest123
    ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)
    ========================================================================================
    [root@testserver ~]# cat /etc/my.cnf
    [mysqld]
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    user=mysql
    # Disabling symbolic-links is recommended to prevent assorted security risks
    symbolic-links=0

    [mysqld_safe]
    log-error=/var/log/mysqld.log
    pid-file=/var/run/mysqld/mysqld.pid
    ========================================================================================

    Thanks

    Reply
  14. Hi,
    I tried the following, then also I’m getting error, please have a look at the error and kindly suggest to fix.

    [root@testserver ~]# mysql -u root -p test123
    Enter password:
    ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)

    thanks
    R.Pugazhendhi

    Reply
    • @Pugazhendhi,
      Please don’t put space betweek -p and password, try this.

      [root@testserver ~]# mysql -u root -ptest123
      
      Reply
      • Hi,
        Thanks. Issue resolved. I have been using wrong password. Once I change it error cleared. thanks and apologies

        Thanks

        Reply
  15. Hi,
    When I access the mysql i’m getting the following error. Please help me to fix the error.

    [root@testserver ~]# mysqladmin -u root password test123
    mysqladmin: connect to server at ‘localhost’ failed
    error: ‘Access denied for user ‘root’@’localhost’ (using password: NO)’

    Thanks
    R.Pugazhendhi

    Reply
    • @pugazhendhi,
      No, you can’t use mysqladmin to connect to mysql shell, use the following command.

      # mysql -u root -p test123
      
      Reply
      • Hi,
        Firstly thanks for your immediate reply, I tried the following, then also I’m getting error, please have a look at the error and kindly suggest to fix.

        [root@testserver ~]# mysql -u root -p test123
        Enter password:
        ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)

        thanks
        R.Pugazhendhi

        Reply
  16. hi there…

    i installed cacti fans v0.8.7g on a virtual environment now cant seem to login to the default cacti-server login, but everything seem to b working though…

    Reply
  17. upon creating database. It creates it but doesn’t write the second line and so does with the next flush privileges line, AND do not create a database. it creates a line but says 0-Rows affected.
    “mysql> GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY ‘IDENTIFIED’;
    Query OK , 0 rows affected (0.09 sec)”
    It creates the database cacti.sql file though as i can locate the cacti.sql file’s location. but when I go installing the table it says ” ERROR 1049 (42000): Unknown database ‘cacti'”.
    Send help please.

    Reply
  18. Hiii
    When I install cacti in centos 6.4
    I faced lits of problem I m not able to install cacti in my server
    Still I get error
    Cannot retrieve repository expel and path incorrect plz give me any suggestion and resolve my problem as soon as possible

    Reply
  19. HI…After I navigate ipaddress/cacti/
    I see this error
    What should I do
    Thanks for helping
    FATAL: Cannot connect to MySQL server on ‘localhost’. Please make sure you have specified a valid MySQL database name in ‘include/config.php’

    Reply
  20. I have a query regarding cacti. Cacti is network monitoring tool. So I have installed it on centos-5-64bit server. Its working fine with localhost.

    Now I have added another server in it. But graphs are not getting generated for it.

    Is there any configuration required for the newly added server end? Like nagios, we have to setup client end.

    Reply
    • I somehow got my graphs to show, I’m not sure what made it show. I have updated the graphs.php as per the link afterwards but am not seeing any difference.

      However, I still cannot get the timezone correct, it is still using UTC even though php.ini is set to a different timezone. My General information in Cacti is showing UTC time while date section shows default timezone as UTC and local/master value of date.timezone Asia/Hong_Kong

      Data are not being recorded to the graph until the next day. The graph appears with NaN values until the next day. This is a test machine that is turned off daily. I’ve tried restarting and turning the machine off after adding a new device and graph and it always needs a night before values show. I’m not sure where to change the time or why it is taking so long for data to be valid on the graph.

      Reply
  21. Hi, thanks for the how-to on getting cacti installed. I currently have it on Fedora 20 with cacti 0.8.8b. Having set the file to “Allow from all”, I’m still not able to access it from another computer using the IP/cacti. It is still giving me the “You don’t have permission to access /cacti on this server.”

    I’m also having different time for my logs and graphs that is different from the system time. I have 11:30am on the system and the log would show 3:30am. Graph shows correct time on the axis but log time for “From date time to date time”.

    Lastly, I’m having all my data show as nan. The “Log File” under utilities is green and doesn’t appear to be any error. The devices I’m testing with is a cisco swtich and a Windows 7 computer both using snmp. The device recognizes the information but yet I’m still getting nan.

    Any idea on how to resolve this? Thank you!

    Reply
    • @Cheung,
      Are you able to access cacti interface from localhost? like http://localhost/cacti? If yes, then you must add your IP address from where you accessing it to the cacti.conf file and restart the apache service..

      About logs timing, you need to check logs and cacti configuration files and specify time if there needed…

      Reply
      • @Ravi,
        Thanks for the reply, I am able to access the interface through localhost/cacti. I’ve tried using both allow from all and allow from the specific ip address, both will still not allow me to access through another computer. I’ve even tried turning the firewall off for testing.

        My graphs are also still getting NaN instead of actual values.

        Reply
  22. Hi, sorry for my bad english.

    Just want to ask how can i deal with this error

    [root@cacti ~]# mysqladmin -u root password cacti
    mysqladmin: connect to server at ‘localhost’ failed
    error: ‘Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)’
    Check that mysqld is running and that the socket: ‘/var/lib/mysql/mysql.sock’ exists!
    [root@cacti ~]# mysqldadmin -u root password cacti
    bash: mysqldadmin: command not found

    I’m just newbie in linux platform and I saw your website tutorial very useful. Hope you anyone can help me with this one.

    Thanks in advance.

    Reply
    • The error indicates that your mysqld service is not yet strated, you need to start or restart it using below command.

      # service mysqld start
      OR
      # service mysqld restart
      

      After restarting, run the following command to connect to mysql shell.

      # mysqladmin -u root password cacti
      
      Reply
  23. Hi, just want to ask if you know how to solve “Valiadation Error” whenever I tried to add device to a tree graph.

    Thanks! :)

    Reply
  24. Dear Sir,

    Please tell me that it will show system by system usages or a complete internet usages by network. and I want to some server status like apache, mysql, etc.

    Thanks
    Sandeep Rawat

    Reply
  25. Hi done installation logged in ok. But when I want to add device I get “SNMP error” on the GUI and I have this error in the Cacti log
    10/12/2014 12:19:51 PM – CMDPHP: Poller[0] WARNING: SNMP Get Timeout for Host:’41.87.1.11′, and OID:’.1.3.6.1.2.1.1.1.0′
    will appreciate your help.

    Reply
  26. Hi, first of all i want to thank you for putting up this helpful tutorial and I really want you to know that your website really helped me a lot.

    BTW, I just want to ask some questions about cacti. Whenever I tried to add a device to a custom Graph Tree it always throws an error “Validation Error”

    Please help me :)

    PS: If you can also put some tutorials how to add/configure device/monitor it and also the network basic and advance :) It will be an early birthday gift for me.

    Thank you so much!

    Reply
  27. Hi Ravi,

    I have installed cacti successfully, while creating new graph getting below error from rrd. Please help

    “rrd ERROR: opening ‘/usr/local/cacti/rra/test_pc_proc_33.rrd’: No such file or directory “

    Reply
  28. Hi Ravi,

    excellent article, but after installation. I have no problem with the localhost graphs , but when i import hosttemplates liek apache. They are not showing data. connectivity is fine between cacti server and client. Even the selinux is disabled. The main problem is graphs showing no data, i suppose this is due to cacti unable to pull the data..any suggestions on this helps a lot. Thanks in advance

    Reply
  29. Hi, Tnx for tutorial,
    How we can access cacti with domain name instead of IP address, like this:
    domainname.com/cacti instead of IP-add/cacti?

    Tnx!

    Reply
  30. Hi All,

    My cacti become a sometimes does not draw a traffic data on graphs.
    And when I do restart the Server then it’s runs well and draws traffic data for a period of about 12 hours has been suspended from the drawing again and so.

    Please advise

    Reply
  31. Hi All,

    When i try to install this got this error. i am using CentOS 4 version.

    yum install php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli php-mysql

    Error Downloading Packages:
    php-mbstring-5.3.3-22.el6.x86_64: failure: Packages/php-mbstring-5.3.3-22.el6.x86_64.rpm from centos: [Errno 256] No more mirrors to try.

    Could you please suggest on this.

    Reply
    • The error related to repo server or your network connection, try to run the following serious of command.

      # yum clean all 
      # yum clean metadata 
      # yum clean dbcache 
      # yum makecache 
      # yum update -y
      
      Reply
  32. Hello Ravi,

    Thanks a lot for the steps on Cacti installation.

    I followed the same steps and successfully installed cacti, but i am unable to view the graphs. All my graphs shows me 0 load.

    Reply
  33. hi Ravi

    I running on fedora 20, everything is fine, but i only can access the cacti using http://localhost/cacti. but when i use http://myIP/cacti, its forbidden with error ‘You don’t have permission to access /cacti on this server.’ i already add my IP in allow list as per below;

    # httpd 2.2
    Order Deny,Allow,
    Deny from all
    Allow from 192.168.0.0/24

    i need to allow my LAN user to access the cacti.

    Reply
  34. installed cacti successfully but have one prob, inbound line is overshadowed by outbound, any idea on how they can be shown concurrently?

    Reply
  35. hiiii ravi sir ,

    i install cacti ..for my mpls network router …i have to create monthly device availability report from cacti … how to create availability report …can u help me for that…

    Reply
  36. Pls. help, i follow everything but i’m not able to successfully work it out. if I type the address/cacti/install its only returning a blank page. I know that apache is working.. Thank you.

    Reply
  37. I am able to generate the graphs for localhost but we i try to create device for remote machine, i am getting the SMTP error.

    Below are the cacti logs

    CMDPHP: Poller[0] WARNING: SNMP Get Timeout for Host:’x.x.x.x’, and OID:’.1.3.6.1.2.1.1.3.0′

    Please revert back asap

    Reply
  38. Dear Ravi,

    I have trouble with ICMP protocol, from the server can ping this device but from Cati, it show that can not ping ( ICMP ping Timed out ) when I choose ICMP at Ping method.

    Ping Method
    The type of ping packet to sent.
    NOTE: ICMP on Linux/UNIX requires root privileges.

    I dont know how to fix it, I set 777 permission at ( chmod 777 /usr/bin/php ) , ( chmod 777 /usr/share/cacti/ ) and stop IP tables.

    Many thanks,

    Reply
  39. Hi,
    You should edit this example of cron job
    #*/5 * * * * cacti /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1

    remove # sign in front
    some people like me can just copy this as is and then will have troubles with device status unknown in cacti

    Cheers.

    Reply
  40. while doing tcpdum host MYIP(x.x.x.x).. i get only following message :

    tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
    listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
    15:39:13.660448 IP 10.70.3.20.44770 > 10.3.0.253.snmp: GetRequest(28) system.sysDescr.0
    15:39:13.663583 IP 10.3.0.253.snmp > 10.70.3.20.44770: GetResponse(185) system.sysDescr.0=[|snmp]
    15:39:13.664026 IP 10.70.3.20.51972 > 10.3.0.253.snmp: GetRequest(28) system.sysUpTime.0
    15:39:13.666679 IP 10.3.0.253.snmp > 10.70.3.20.51972: GetResponse(32) system.sysUpTime.0=813142904
    15:39:13.666881 IP 10.70.3.20.41630 > 10.3.0.253.snmp: GetRequest(28) system.sysName.0
    15:39:13.669512 IP 10.3.0.253.snmp > 10.70.3.20.41630: GetResponse(35) system.sysName.0=”KAT122B”
    15:39:13.669662 IP 10.70.3.20.51272 > 10.3.0.253.snmp: GetRequest(28) system.sysLocation.0
    15:39:13.672405 IP 10.3.0.253.snmp > 10.70.3.20.51272: GetResponse(81) system.sysLocation.0=[|snmp]
    15:39:13.672607 IP 10.70.3.20.47664 > 10.3.0.253.snmp: GetRequest(28) system.sysContact.0
    15:39:13.675827 IP 10.3.0.253.snmp > 10.70.3.20.47664: GetResponse(43) system.sysContact.0=[|snmp]

    :::::::::::::::::::::::::

    Only name , location , and other general information is being pulled..

    what can i do..??

    Reply
  41. I checked all the possible things related prob.. still couldn’t find any solution… I have configured all the steps and also able to browse cacti login page.. but no graph generated even for local host…

    I tried to see the tcpdump of my host… was seen tht there is SNMP processing… but still unable to find graph..

    Please help.

    Reply
  42. Hi Ravi,

    Thanks for providing great article. I am trying to configure cacti on my localsystem , which have centos 6.4. After follow complet instruction, when i browse this, it’s showing blank page. I have added ip in conf file and also restart httpd service. But did not get sucess.

    Can you please help me regarding this ?

    Thanks,

    Manoj

    Reply
    • Hi..

      I was able to install the cacti…but i cant get any graph now.. but the graph was bale to extract when i manually poll the data …

      So please help me how to get graph for traffic and all in cacti..

      Bikash.

      Reply
  43. HI i am new to rhel and was configuring Cacti.. but when i try to install the packages.. i get the follwing error;

    [root@localhost ~]# yum install cacti
    Setting up Install Process
    No package cacti available.
    Nothing to do
    ::::::::::::::::::::::::::::::::::::::;
    [root@localhost ~]# yum install rrdtool
    Setting up Install Process
    No package rrdtool available.
    Nothing to do
    ……………………………………

    Please help

    Reply
  44. Hi everyone,

    I’m struggling with the following error with my server…

    can any one get me out of this issue.

    PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 523800 bytes) in /usr/share/cacti/lib/adodb/adodb.inc.php on line 833

    thank you… in advance…
    Raghavendra Gujjar…
    [email protected]

    Reply
      • This error is displayed if you forget to load the initial database. I increased the memory up to 1G and still got the error. Once I loaded the /usr/share/doc/cacti/cacti.sql file into MySQL the error went away and the install page displayed.

        Reply
  45. Hi Ravi,

    the error is gone but still not working i am get The website cannot display the page error 500

    Thanks for help

    :)

    Reply
  46. Hi Ravi,

    Thanks for you post !!! i did all the stepes one by one and i got the next error

    Starting httpd: httpd: apr_sockaddr_info_get() failed for Cacti
    httpd: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName

    Can you help with this error in addition I didn’t get the login screen.

    Thanks

    Reply
    • To fix this error, just open your /etc/hosts file and add correct machine hostname. To get machine hostname use command.

      # hostname
      

      So, add correct hostname along with your IP address to your /etc/hosts file. Like

      192.168.1.2 yourhostname
      

      Restart Apache again. that’s it all set go.

      Reply
  47. Hi, is Cacti capable of monitoring storage? monitor your hard disk and it will send a email that if it is near full?

    Reply
  48. [root@test ~]# yum install cacti
    Loaded plugins: fastestmirror, security
    Loading mirror speeds from cached hostfile
    * base: less.cogeco.net
    * extras: less.cogeco.net
    * updates: centos.bhs.mirrors.ovh.net
    Excluding Packages in global exclude list
    Finished
    Setting up Install Process
    No package cacti available.
    Nothing to do
    [root@test ~]#

    Reply
  49. Hi Ravi,

    Great instructions/notes.

    I’ve gotten up to the point of running cacti in my browser – getting the ole 403 Forbidden message.

    I’m running Fedora 18 in a VM. My host OS is Windows 7; and I’m running VirtualBox (in case this makes a difference)

    Anyway, I’ve specified my guest/Fedora IP in …/cacti.conf; restarted httpd.service. I’ve changed it back to 127.0.0.1 and restarted httpd.service… I’m also running Firewall and selected http and https as trusted for the current zone and added 3306 to “ports”.
    Still no luck. Iptables.service is not running.

    Any suggestions?
    -Rich

    Reply
  50. Sir,

    I have follow all steps but i am getting error

    Forbidden

    You don’t have permission to access /cacti on this server.

    please help me

    please reply in my email id

    Reply
  51. Hi,

    Do you know where to configure about email notifications? for example the system is up or down, you’ll be notified something like that.

    thanks in advanced.

    Reply
  52. Great instructions. Finally was able to install and run Cacti on a CentOS linux box.

    I ran into a problem when installing Cacti tables to MySQL.
    I had to change the permissions on the cacti.sql file inorder to install the tables.

    Other than that, this recipe works great.
    Thanks for sharing.

    Reply
  53. Thanks Ravi for your excellent instructions …
    I am still getting “FATAL: Cannot connect to MySQL server on ‘localhost’. Please make sure you have specified a valid MySQL database name in ‘include/config.php’ ”

    I am sure i have configured db.php properly as per the right credentials…
    —–
    $database_type = “mysql”;
    $database_default = “cacti”;
    $database_hostname = “localhost”;
    $database_username = “cacti”;
    $database_password = “titan#12”;
    $database_port = “3306”;
    $database_ssl = false;

    Ravi, Please help me in this case…

    Reply
    • Is MySQL service is started? and port is open on firewall? can you post the output of the following command.

      telnet localhost 3306
      
      Reply
      • Thank you Ravi for the prompt response.

        Below is the output of the given command.
        o/p: -bash: telnet: command not found

        in my box , the db.php is residing in “/var/www/cacti”

        Thanks in advance…
        Gopi.

        Reply
          • Ravi, installed telnet and below is the output…
            ——————————————————————
            [root@XXXXXXXXX~]# telnet localhost 3306
            Trying 127.0.0.1…
            Connected to localhost.
            Escape character is ‘^]’.
            4
            5.0.95?.7i+:~/l,S=rLc/^m)!jrConnection closed by foreign host.
            [root@sbcloudlymem02 ~]#

          • Below is the output after install
            …….

            [root@machineName ~]# yum install telnet
            Loaded plugins: fastestmirror
            Loading mirror speeds from cached hostfile
            * addons: centos.mirror.nac.net
            * base: centos.mirror.nac.net
            * extras: centos.vipernetworksystems.com
            * rpmforge: mirror.hmc.edu
            * updates: mirror.wiredtree.com
            Setting up Install Process
            Resolving Dependencies
            –> Running transaction check
            —> Package telnet.i386 1:0.17-41.el5 set to be updated
            –> Finished Dependency Resolution

            Dependencies Resolved

            ================================================================================
            Package Arch Version Repository Size
            ================================================================================
            Installing:
            telnet i386 1:0.17-41.el5 base 57 k

            Transaction Summary
            ================================================================================
            Install 1 Package(s)
            Update 0 Package(s)
            Remove 0 Package(s)

            Total download size: 57 k
            Is this ok [y/N]: y
            Downloading Packages:
            telnet-0.17-41.el5.i386.rpm | 57 kB 00:00
            Running rpm_check_debug
            Running Transaction Test
            Finished Transaction Test
            Transaction Test Succeeded
            Running Transaction
            Installing : telnet 1/1

            Installed:
            telnet.i386 1:0.17-41.el5

            Complete!
            [root@machineName ~]# telnet localhost 3306
            Trying 127.0.0.1…
            Connected to localhost.
            Escape character is ‘^]’.
            4
            5.0.95?.7i+:~/l,S=rLc/^m)!jrConnection closed by foreign host.
            [root@machineName ~]#

          • Everything seems to be fine, I don’t know why you getting such error. If you don’t mind can I have your server IP address to check from the browser. Or create a testdb.php file under your website root directory and add the following lines and replace MySQL settings as per your needs and browse the file and post the output.

            <?php
            ob_start();
            define('server_name','172.16.25.126');
            //define('server_name','localhost');
            define('user_name','root');
            define('user_password','tecmint');
            define('dbname','dbname');
            $conn = mysql_pconnect(server_name,user_name,user_password);
            if($conn)
            echo "Connection establish<br>";
            else
            echo "Connection Failed<br>".mysql_error();
            $db = mysql_select_db(dbname,$conn);
            if($db)
            echo "DB establish<br>";
            else
            echo "DB Failed<br>".mysql_error();
            ?>
            
  54. Why this tutorial not including configure snmp for cacti. I think cacti is 100% useful if it configure using snmp for trap any statistic interface both from the host and remote host :)

    Reply
  55. Hi,

    All installed as per these excellent instructions however I do not get any graph images showing – just a broken link where the image should be showing.

    It looks like a possible permissions issue but can not see where it could be. The yum install cacti placed the website directory structure /usr/share/cacti as with root permissions and everything else appears to work fine.

    Cent OS 6.3 clean and minimal install then installed as per your instructions.

    Any ideas?

    Thanks

    Andy

    Reply
  56. Hi Ravi,
    Sorry about the first post, i have made corrections:

    My cacti.conf looks like this:
    Alias /cacti /var/www/html/cacti/
    Order Deny,Allow
    Deny from all
    Allow from 172.227.244.21

    but still:

    Forbidden
    You don’t have permission to access /cacti/ on this server.
    Apache/2.2.3 (CentOS) Server at 172.227.244.21 Port 80

    both mysqld and httpd services are running.

    Reply
    • After making corrections, have you restarted Apache? If yes, then you must define proper IP address in Allow section. Have you tried from the localhost?

      Reply
      • Yes i did the needful, both localhost and my IP are tripping. if i type my IP or localhost in the browser the apache test web page opens nicely.

        Reply
      • Hi,
        me too having same problem. tried using the ip and localhost both with no luck.restarted the HTTPD service too

        Reply
  57. Hi,
    am getting an error on the web browser:
    Forbidden

    You don’t have permission to access /cacti/ on this server.
    Apache/2.2.3 (CentOS) Server at 197.231.244.21 Port 80

    My cacti.conf looks like this:

    Alias /cacti /var/www/html/cacti/

    Order Deny,Allow
    Deny from all
    Allow from 172.227.244.0/22

    Reply
  58. Asking questions are in fact nice thing if you are
    not understanding anything fully, but this piece of writing presents nice understanding even.

    Reply
  59. Hey i’ve tried this 3 times, and each time Cacti works but no graphs show, like no image at all, not even a broken image link just no graph image, Any ideas?

    Reply
    • Poller shows this when i run it:SYSTEM STATS: Time:0.5038 Method:cmd.php Processes:1 Threads:N/A Hosts:3 HostsPerProcess:3 DataSources:1 RRDsProcessed:0

      Is there some permissions or something that needs to be set for this to work?

      Reply
  60. Did nobody got this error message:

    Error: Package: php-devel-5.3.3-14.el6_3.i686 (updates)
    Requires: php = 5.3.3-14.el6_3
    Installed: php-5.4.10-1.el6.remi.i686 (@remi)
    php = 5.4.10-1.el6.remi
    Available: php-5.3.3-3.el6_2.8.i686 (base)
    php = 5.3.3-3.el6_2.8
    Available: php-5.3.3-14.el6_3.i686 (updates)
    php = 5.3.3-14.el6_3
    You could try using –skip-broken to work around the problem
    You could try running: rpm -Va –nofiles –nodigest

    So I did, someone knows how to resolve this ?

    Thanks

    Reply
    • You have older version php which is conflicting with php 5.4, first remove the older php with the following commands.

      # yum -y erase php php-devel php-common
      

      and then try again…

      Reply
      • Thanks Ravi for your quick response,

        That is going well so far, but when I try to startup the cacti install webinterface I got the following error message:

        FATAL: Cannot connect to MYsql server on myhostname, Please make sure you have specified a valid mysql databasename in ‘/include/config.php’

        Reply
          • I am receiving the same error,

            Fatal: Cannot connect to MySql Server on my hostname, Please make sure you have specified a valid mysql database name in ‘/include/config.php’

            I understand I need to vi to config.php and apply the correct parameters; however can someone tell me where to find this file.

            I assume it was under /var/www/html/cacti but the path mention is not a valid path

  61. Hi!
    Please help me!

    Alias /cacti /usr/share/cacti

    # httpd 2.4
    Require host localhost

    # httpd 2.2
    Order deny,allow
    Deny from all
    Allow from 172.16.16.0/20
    in this section , when I restart apache it didn’t start and give me a error that Reqire or Order or Deny or Allow not allowed here

    Reply
    • at the console, under management section, click devices. then click localhost. change host template from local linux machine to ucd/net snmp host. click save at the bottom of screen. only after that snmp – interface statistics option available.

      Reply
  62. Ravi,its done,
    I was using localhost/cacti so I changed to use my-local-IP/cacti and edited my proxy settings

    1 more question for now
    which username and password I must use

    Reply
  63. Hey , Really great instruction installing cacti.However I am facing a little problem.
    When I reach to the point of Running cacti installer set up I get the following error:

    Forbidden

    You don’t have permission to access /cacti on this server.
    Apache/2.2.15 (CentOS) Server at localhost Port 80

    P.S : I am new at unix

    Reply
    • @Abbas,

      Did you added Allow from 127.0.0.1 in /etc/httpd/conf.d/cacti.conf file to allow access to localhost?

      Alias /cacti /usr/share/cacti
      
      <Directory /usr/share/cacti/>
      
      Order Deny,Allow
      Deny from all
      Allow from PC_IP_Address
      </Directory>

      After that, restart httpd service. It will fix the problem.

      service httpd start 
      
      Reply
  64. Can anyone help me in setting up a cacti for monitor only my network devices. Please if any one could be me with the commands and the interface also. Console screen

    Reply
  65. Hi,

    I have installed cacti in CentOS. Currently, the installation was successful, but it is not allowing me to go to the next screen after login. After I give admin/admin, the page is getting refreshed and its not moving to the next screen, where we can see the “force password change” page. Please help in giving some solution to it.

    Reply
      • Hi Ravi excellent tutorial very good I came all excellent
        ravi I have only one question?

        What I have to use user and password for logging
        please help I want to implement that service
        in my work.

        Thanks.

        Att;

        0mar.

        [email protected]

        Reply
      • my friend thanks I’ll try it and I confirm.

        my friend nothing more I would like to do a how-to
        openvpn with linux and windows clients interested me much
        know how to configure it.

        Thanks agains ….

        Reply
      • My thanks everything ok the problem was me that not read good the document.

        all ok.

        thanks, my friend very very good good how to.

        Reply
  66. Before step “Running Cacti Installer Setup” you need to open for HTTP in IPTABLES firewall….

    nano /etc/sysconfig/iptables

    Add the following:

    -A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT

    and restart IPTABLES:

    service iptables restart

    Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.