Using Nagios to check log files on IPERF server side


Hi everyone,
I just started using nagios on my server and I use the server as an iperf server also, which means other computers can run an iperf check that gets logged on my server into a text file. I was wondering how to integrate a check into nagios, so that it would look into the log file and return an OK state if the result is above treshold bandwidth speed, and an critical state otherwise. Is there anyone that could perhaps point me in the right direction - like, is there a plugin already I could customize? The corresponding lines in the logfile would look like this:

Server listening on TCP port 6543
TCP window size: 85.3 KByte (default)

4] local port 6543 connected with port 2440
ID] Interval Transfer Bandwidth
4] 0.0-10.1 sec 106448 KBytes 10585 KBytes/sec
5] local port 6543 connected with port 2441
ID] Interval Transfer Bandwidth
5] 0.0-10.1 sec 108144 KBytes 10712 KBytes/sec

And I am interested about the 10585 KBytes/sec and 10712 KBytes/sec values.
Thank you for any help / directions.





the best way to do that is to write your own plug in.
Use a script language (shell, perl, python), open the log file, read it and parse it.

from the parsing, compare it to the threshold you have passed as arguments.

in the end, place your plugin in the libexec dir, set the rights, define the command in nagios and use it :slight_smile:

(seems easy said like that, but you may have a few difficulties along the way; don’t hesitate to post if you need help :))