Page 1 of 1

Nagios TCP Connection Monitor

Posted: Mon Apr 20, 2015 10:31 pm
by gr0mit
Is there a way to monitor established TCP connections to an NRPE client?
I have about 40 TCP connections to the same port from remote logging agents, and would like to get an alert if one of these connections drops.
Also the name of the remote host that disconnected would be good.

Re: Nagios TCP Connection Monitor

Posted: Tue Apr 21, 2015 10:18 am
by ssax
You would need to write your own custom script.

You could base it off of the following post:

http://serverfault.com/questions/402449 ... onnections

You could modify it to create a temp file after each run with the full netstat output.
The next time it runs, run a diff on the temp file and the new netstat output and use awk or some other method to grab the IP that is missing.
Run a DNS query on the IP to grab the hostname and return that with an error code.