Cacti with MySQL installation pitfalls

Software Involved:

  1. Operating System : Ubuntu 18.04.2 LTS Bionic
  2. Cacti: 1.1.38 (Installed apt-get )
  3. NET-SNMP: 5.7.3 ( Installed apt-get )
  4. MySQL Server: 1.1.38 ( Installed apt-get )
  5. Percona Cacti Templates: 1.1.8-1.artful_all (Download From Web)

What is Working and What is Not

After the installation of the aforementioned software, the graphs for local linux system looks normal.
ss_get_mysql_stats.php

But the graphs for MySQL are empty, no data being recorded.

The post is about the steps I took to get it working.

Step One

   ss_get_mysql_stats.php
    function parse_cmdline( $args ) {
             ....
             if ($nextparam !== false && strpos($nextparam, '--') !==0) {
             ....             
     }

The checking is wrong and it causes ss_get_mysql_stats.php to return nothing to Cacti. The checking should be modified as following

   ss_get_mysql_stats.php
    function parse_cmdline( $args ) {
             ....
             if ($nextparam != false && strpos($nextparam, '--') !==0) {
             ....             
     }

ss_get_mysql_stats.php starts working. This is Magic. However, the graphs are still emptied.

Notes

= ss_get_mysql_stats.php is considered as POLLER_ACTION_SCRIPT in cmd.php

= cmd.php is the entry point for polling as defined in the Cacti settings.

= Table poller_items records actions like ss_get_mysql_stats.php to be carried periodically.

= Table poller_output records output from ss_get_mysql_stats.php for later processing in poller.php

= Modified cron job cacti from

 */5 * * * * www-data php /usr/share/cacti/site/poller.php 2>&1 >/dev/null | if [ -f /usr/bin/ts ] ; then ts ; else tee ; fi >> /var/log/cacti/poller-error.log

to

*/5 * * * * www-data php /usr/share/cacti/site/poller.php 2>&1 >/var/log/cacti/poller.log | if [ -f /usr/bin/ts ] ; then ts ; else tee ; fi >> /var/log/cacti/poller-error.log

to debug poller.php to see what is going on in it.

猜你喜欢

转载自blog.csdn.net/hoymkot/article/details/90941477