Community
Zenoss Newsletter

Monitored by Zenoss
SourceForge.net Logo
Views

Hey everyone - here's a quick howto to get basic mysql slave replication monitoring up and working. Before I begin I want to credit Michal Ludvig as the original author of this script in PERL. I've converted his script to Python because I was having issues and am much better with python. In addition I've some simple features, some of which need to be developed. If you have questions, comments, patches - send them my way - Carl Van Arsdall <cvanarsdall@pixar.com>

Here's the script:

http://www.zenoss.com/community/wiki/tips-and-tricks/mysql-replication-slave-monitoring/check-mysql-slave.py

Monitoring:

  • Do all this as the zenoss user
  • Download check_mysql_slave.py and place in $ZENHOME/libexec
  • Verify running this script by hand: 'check_mysql_slave.py -u myUser -p myPass -s myHost' -- Should return nothing on success or an error otherwise.
  • If any tracebacks occur its likely your configuration. Make sure that MySQL? has the right permissions for 'myUser' and 'myHost'
  • Navigate your way to your replication slave's templates.
  • Either create a brand new template or make a local copy of one that exists (I have the MySQL? zenpack installed which is what I used).
  • Add a new datasource, make sure its of type COMMAND
  • Set everything up the way you normally would, and in the command template make sure you add the '-q' option - this will supress the output zenoss doesn't care about.
  • Restart zencommand (you can find instructions on further testing via wiki/forum pages)
Ultimately that's all there is to it and you should have monitoring ready to go. A couple things to note:
  • If you use a pre-made event class (i.e. /Apps/MySQL?) then double check the properties to make sure that severities are not overridden by the event class you've chosen.
  • Make sure all the environment variables are good - ZENHOME, PYTHONPATH etc
  • Remember you can always use --help or read the code if you get stuck
  • There's also basic encryption/decryption if you don't want to put your password on the command line or buried in the script. This isn't foolproof, its more to deter the average person farting around.