RMRTG - A way to remotely monitor services and metrics by remotely executing MRTG external commands INTRODUCTION MRTG can monitor pretty much anything, simply by using backticks in the Target[] configuration line to execute some program that returns those 4 familiar lines of data. But what if you want to monitor, for example, CPU load on a machine using MRTG? Until now you'd have had to run MRTG on that machine, but for various reasons you may want to centralize your monitoring. This is the scenario at my workplace. We have a single central monitoring box. REMOTE MRTG That's all the 'R' stands for - remote - it allows a central MRTG monitoring station to run MRTG plugins on remote machines and get the output - so that all your graphs and logs are in one place. Example: Imagine 2 machines - atlas is the MRTG monitoring box, pandora is a development server. We want atlas to monitor things on pandora like CPU usage, number of users... That's why there are two programs: rmrtg is the server, rmrtgc is the client program. INSTALLATION See the INSTALL file. SECURITY Of course, you don't want commands being run by anyone - so you may not want to run this service on an internet server without tcp wrappers, or a firewall, or whatever. I use this setup in an intranet so I can't say how safe it would be in the big wide world. Some kind of tcp wrappers/ipchains rule saying 'only let atlas connect to the rmrtg port' would be good, but I'm no expert. You also don't want the commands run too often. inetd allows you to rate limit connections, but rmrtg also implements rate limiting by writing lock files and refusing to run if the file exists and is younger than a certain time. There is one lockfile per plugin command. WHAT IF IT DOESN'T WORK Did you put the line in /etc/services? Did you HUP inetd? Is it _really_ listening on the right port? Try telnetting to port and typing a few lines of nonsense - do you get anything back at all? Does rmrtg run on the command line? It should read from STDIN Are all the file permissions, esp. execute bits, set properly? Are all the shebang lines OK? Have you set the right $commanddir? Typical setup: Remote: /home/mrtg/bin/loadavg.pl /home/mrtg/ext/rmrtg /home/mrtg/tmp/ Local: /home/mrtg/config/mrtg.cfg /home/mrtg/ext/rmrtgc It's only been tested on Linux, Solaris and Windows 2000 (rmrtgc only on Win2K). Bug reports and improvements gratefully received. PROTOCOL If you must know: Client: COMMAND loadavg.pl plus some arguments if you want Client: Host : 200 OK Host : Host : 454 Host : 232 Host : 15 days, 38 minutes Host : Pandora Load Average Connection Close Very easy but extensible, by adding 'header' lines. COPYRIGHT Copyright (c) P Kent 2001. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. A copy of the GPL is supplied in the file 'GPL' $Id: README,v 1.4 2002/01/30 04:54:53 piers Exp $