On Sep 4, 2006, at 5:39 AM, Ranjeet Kumar wrote:
I did the following, after setting up both nagios and MRTG separately. First, for each host that MRTG is monitoring, define one or more services in nagios (for example, if MRTG is monitoring the traffic on three ports of a router, you will need three services in Nagios). These services are then set up to use the check_mrtgtraf plugin. This plugin gives a result based on the traffic that MRTG is seeing. My check command for this is defined as follows: define command{ command_name check_mrtgtraf command_line $USER1$/check_mrtgtraf -F /usr/local/mrtg-2/share/mrtg2/$ARG1$.log -w $ARG2$ -c $ARG3$ } where the arguments are the name of the log file MRTG creates for the device being monitored, the traffic level at which to give a warning status, and the traffic level at which to give a critical status (see check_mrtgtraf --help for more info). Depending on how you have this set up, you should be able to simplify the command somewhat by using the $HOSTADDRESS$ macro. The path to the log files will, of course, depend on your MRTG setup. To link the MRTG graphs in to the services, I simply used a serviceextinfo declaration for each service, and defined the notes_url property as the webpage that MRTG creates with the graph for the device. In my case, I put in a separate definition for each port pointing to the detail webpage for that port, you could, of course, choose to simply make one definition pointing to the summary webpage. This may not be the most "integrated" approach possible, but it does give me the ability to have nagios send me notifications (or whatever) based on the traffic information gathered by MRTG, as well as giving me easy access to the MRTG graphs from within nagios. You could take a similar approach using the check_mrtg plugin instead, if you wanted nagios to pay attention to information other than what the check_mrtgtraf plugin returns, but I haven't looked into this. A couple of caveats: 1) the version of the check_mrtgtraf plugin I had, for some reason, wasn't coded to ever set the output status to 'OK'. I don't know if that was a bug in the source code in general, or just the version I got, but I had to add code to set the output to OK and recompile before it would work for me. Simple enough (at least if you know basic C programing). 2) The plug in, as written, reports and sets warning states based on the incoming and outgoing traffic separately, with independent warning/critical thresholds for each. This may well be what you want. In our case, however, I was more interested in the TOTAL traffic- if the traffic in is 128 kb/s and the traffic out is also 128 kb/s, then our 256 kb/s link is saturated, and I wanted nagios to return critical, even though neither the inbound or the outbound traffic is by itself enough to warrant a critical state. Again, I was easily able to modify the plugin source to do this, but this may not be desirable in other situations. ------------------------------------- Israel Brewster Computer Support Technician Frontier Flying Service, Inc. 5245 Airport industrial Rd. Fairbanks, AK 99709 -------------------------------------- |
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null