Thursday, June 06, 2013

How to Fix Problems in Cacti

no graph display in cacti

No graph display, SNMP agent is not installed
This has been discussed in previous posts, and see also how to install SNMP Agent in previous post,

Error    : Can't find file: 'poller_output'
Graph display does not appear, besides the lack of SNMP Agent, it could be due to a full hard drive. Check disk space by using the command
df –h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        15G  15G  0       100% /
none            4,0K     0  4,0K   0% /sys/fs/cgroup
udev            481M  4,0K  481M   1% /dev
tmpfs           100M  908K   99M   1% /run
none            5,0M     0  5,0M   0% /run/lock
none            498M     0  498M   0% /run/shm
none            100M  8,0K  100M   1% /run/user
If the disk space full, then delete the files that are not useful, for example log files. Or add disk space. Although the hard disk space has been added, but the database was already error. Still no display numbers and graphs. First checks the database.

# mysqlcheck --auto-repair --databases cacti -u cacti -p
Enter password:
cacti.cdef                                         OK
cacti.cdef_items                                   OK
cacti.colors                                       OK
cacti.data_input                                   OK
cacti.data_input_data                              OK
cacti.data_input_fields                            OK
cacti.data_local                                   OK
cacti.data_template                                OK
cacti.data_template_data                           OK
cacti.data_template_data_rra                       OK
cacti.data_template_rrd                            OK
cacti.graph_local                                  OK
cacti.graph_template_input                         OK
cacti.graph_template_input_defs                    OK
cacti.graph_templates                              OK
cacti.graph_templates_gprint                       OK
cacti.graph_templates_graph                        OK
cacti.graph_templates_item                         OK
cacti.graph_tree                                   OK
cacti.graph_tree_items                             OK                                         OK
cacti.host_graph                                   OK
cacti.host_snmp_cache                              OK
cacti.host_snmp_query                              OK
cacti.host_template                                OK
cacti.host_template_graph                          OK
cacti.host_template_snmp_query                     OK
cacti.poller                                       OK
cacti.poller_command                               OK
cacti.poller_item                                  OK
Error    : Can't find file: 'poller_output' (errno: 2)
error    : Corrupt
cacti.poller_reindex                               OK
cacti.poller_time                                  OK
cacti.rra                                          OK
cacti.rra_cf                                       OK
cacti.settings                                     OK
cacti.settings_graphs                              OK
cacti.settings_tree                                OK
cacti.snmp_query                                   OK
cacti.snmp_query_graph                             OK
cacti.snmp_query_graph_rrd                         OK
cacti.snmp_query_graph_rrd_sv                      OK
cacti.snmp_query_graph_sv                          OK
cacti.user_auth                                    OK
cacti.user_auth_perms                              OK
cacti.user_auth_realm                              OK
cacti.user_log                                     OK
cacti.version                                      OK

Repairing tables
Error    : Can't find file: 'poller_output' (errno: 2)
error    : Corrupt

Clearly, poller_outputnya file error. Try to repair the database with the command
# php /var/www/cacti/cli/repair_database.php

If you still can’t solve the problem. Manually copy the original file and replace the file that error. In this case, the file "poller_output". Place the first new database with a new name, for example cacti2.

# mkdir /var/lib/mysql/cacti2
# chown mysql:mysql /var/lib/mysql/cacti2
#mysql -u root -p cacti2 < /var/www/cacti/cacti.sql
Enter password:
Copyfile poller_output, from cacti2 database, to the cacti database.

# cp -Rf /var/lib/mysql/cacti2/poller_output.* /var/lib/mysql/cacti/
# chown -Rf mysql:mysql /var/lib/mysql/cacti/*
# mysqlcheck --auto-repair --databases cacti -u cacti -p
Enter password:
The resultresult, if there is no error anymore, meaning that it is successful, and the database back to normal. Now check to the graph. Graphics are not directly changed, must wait at least 5 minutes, as changes occur every 5 minutes, depending on the setting Cacti.
Graph cacti fixed

Forgot Cacti admin password
ThisThis problem is common in most people. To reset the Cacti admin password, follow mysql command below

#mysql –u root –p
Enter password:
mysql> UPDATE mysql.user SET Password=PASSWORD('newpass') WHERE User='user';
For example
mysql> UPDATE mysql.user SET Password=PASSWORD(12345) WHERE User='admin';

Forgot your mysql root password.
We want to reset the Cacti admin password, but the command to go into mysql, password root error. Apparently we forgot the root password, too.

Stop service mysqld and restart it with the --skip-grant-tables option. This enables anyone to connect without a password and with all privileges. Because this is insecure, you might want to use --skip-grant-tables in conjunction with --skip-networking to prevent remote clients from connecting. But in windows option - skip-networking can not be used. It can only be used on linux.

In Windows
I suppose already installed cacti 0.8.8. See how to install cacti for windows at, Then automatically mysql is installed. First, stop service.
Start - run. Type services.msc in the box, and hit enter.Then locate the mysql service. Click the stop. Open the command prompt. click start - run. Type cmd in the box, and hit enter. Go to folder mysql.

C:\Documents and Settings\Administrator>cd \
C:\>cd "Program Files\MySQL\MySQL Server 5.5\bin"
C:\Program Files\MySQL\MySQL Server 5.5\bin>mysqld.exe --skip-grant-tables

Mysqldwill be running, and the command prompt can not be used anymore. Open another command prompt.
C:\Documents and Settings\Administrator>cd \
C:\>cd "Program Files\MySQL\MySQL Server 5.5\bin"
C:\Program Files\MySQL\MySQL Server 5.5\bin>mysql
mysql> UPDATE mysql.user SET Password=PASSWORD('MyNewPass')WHERE User='root';
The FLUSH statement tells the server to reload the grant tables into memory so that it notices the password change. Reboot computer. Or, pres ctrl+alt+delete, then click Task Manager. In Processes tab, find mysld, then click end process. Service mysql will stop the forced. Then restart service mysql normally.

In Linux.
And for you who using Linux, and lost mysql root password, there are some steps to reset mysql root password.
# /etc/init.d/mysql stop
# service mysql  stop
# mysqld  --skip-grant-tables  --skip-network &
# mysql.
mysql> UPDATE mysql.user SET Password=PASSWORD('MyNewPass')WHERE User='root';

Then reboot computer or kill, then start service mysql.
# ps ax | grep mysql
1108 ?        Ssl    0:15 /usr/sbin/mysqld --skip-grant-tables  --skip-network
            4428 pts/2    S+     0:00 grep --colour=auto mysql
# kill -9 1108
# service mysql start

That was some error that I got in my experiments, If you have a problem with cacti, please be shared. Ok. Good luck...!!

and My eksperiment


  1. salam, terima kasih sudah berbagi tips nya boss, info ini sangat bagus bagi saya.

    1. terima kasih juga, sudah mau berkunjung... :)

  2. tanto tempo se passou e o post ainda ajuda, consegui resolver esse mesmo problema, porém com algumas alterações em diretorório, por exemplo meu cacti.sql estava em /usr/share/doc/cacti/cacti.sql.
    Tudo certo!!!!!!