Archive for the ‘Cacti’ tag
I’ve just released version 1.1.3 of the Cacti templates I wrote for MySQL. This is a bug-fix release only, and affects only ss_get_mysql_stats.php. To upgrade from the previous release, upgrade ss_get_mysql_stats.php. Don’t forget to save and restore your configuration options, if any. (Note that there is a feature to help with this: you can keep configuration options in ss_get_mysql_stats.php.cnf to avoid making them in ss_get_mysql_stats.php.)
Next up: actual template changes! More graphs!
The changelog follows.
2009-10-24: version 1.1.3 * This is a bug-fix release only, and contains no template changes. * To upgrade from the previous release, upgrade ss_get_mysql_stats.php. * MySQL 5.1 broke backwards compatibility with table_cache (issue 63). * Added a version number to the script (partial fix for issue 79). * Added a test suite (issue 76, issue 59). * Math operations were done in MySQL instead of PHP (issue 25). * SHOW STATUS values didn't override SHOW INNODB STATUS parsing (issue 24). * Long error messages were not appearing in the Cacti log. * SHOW INNODB STATUS parsing for unpurged_txns was broken. * SHOW INNODB STATUS parsing for innodb_lock_structs was broken. * SHOW INNODB STATUS parsing for pending_log_flushes was broken (issue 62). * SHOW INNODB STATUS parsing for pending_buf_pool_flushes was broken. * SHOW INNODB STATUS parsing for pending_ibuf_aio_reads was broken. * SHOW INNODB STATUS parsing for pending_aio_log_ios was broken. * SHOW INNODB STATUS parsing for pending_aio_sync_ios was broken. * Made SHOW INNODB STATUS parsing less sensitive to false positive matches.
I’ve packaged up and released version 1.1.2 of the Cacti templates I’ve written for MySQL, Apache, memcached, nginx etc.
Anyone who would like to help write documentation (or do anything else, for that matter) is welcomed to participate. I’ll give commit access at the drop of a hat.
2009-05-07: version 1.1.2 * The parsing code did not handle InnoDB plugin / XtraDB (issue 52). * The servername was hardcoded in ss_get_by_ssh.php (issue 57). * Added Handler_ graphs (issue 47). * Config files can be used instead of editing the .php file (issue 39). * binary log space is now calculated without a MySQL query (issue 48). * There was no easy way to force inputs to be filled (issue 45). * Some graphs were partially hidden without --lower-limit (issue 43). * Flipped some elements across the Y axis (issue 42). * Added Apache, Nginx, and GNU/Linux templates. * Unknown output is now -1 instead of 0 to prevent spikes in graphs. * If you want to use a script server, you must now explicitly configure it. * UNIX sockets weren't permitted for MySQL (issue 38).
Cacti is a great tool for collecting information about systems and graphing it. However, it likes to use SNMP, and SNMP is often not desirable. Instead, I often see the need for a method that is:
- Secure. Use trusted, well-known, encrypted communication. Do not open up new ports.
- Zero install on the monitored system.
- As little installation or modification on the monitoring system as possible.
Over the last several years, I’ve slowly created more and more software to create Cacti graphs via standard POSIX command-line utilities over SSH with key-pair authentication. (I’ve also created similar software for Nagios, but that’s another matter.) The major problem with the work I’ve done is that it’s totally un-publicized.
The system works by passing command-line arguments to a local PHP script like any other Cacti script. This script then executes a remote SSH command, such as
ssh somehost uptime and extracts statistics from the result.
The requirements are very simple. On the system to be monitored, a public key must be installed. On the monitoring system, the cacti user account must have a private SSH key that it can read and others can’t. This is standard for any SSH key. The cacti user account must also have the SSH key fingerprint of the monitored system in its known_hosts file.
The work I’ve done thus far is available from Subversion in the mysql-cacti-templates project. This project has the scaffolding for creating Cacti templates easily, so I’m using it.
At this point, the following are available:
- Operating system (CPU, memory, load average, etc)
Unfinished work includes network, disk, etc. The techniques to monitor something of which there is a variable number (e.g. there can be many disks, each of which needs its own graph) are a little more complex than simple things like monitoring overall CPU usage. So that’s a work in progress. Once it’s done, it’ll make it really easy to discover and monitor multiples of anything — for example, multiple MySQL servers or memcached servers on a single host — without creating a new host for each resource to monitor.
As with the MySQL templates I created, these templates are comprehensive and have lots of nice properties most templates lack. This is something you get free with my scaffolding. If you’ve ever created templates by hand through the web interface, you should give my work a try. You can turn a three-day project into a few minutes and avoid bugs and other hassles. There are instructions for creating Cacti templates on the project wiki.