Page 1 of 1

Netstat-statistics plugin ?

Posted: Fri Oct 12, 2018 4:35 am
by junqian1992
Hi all,
could recommend what plugin is suitable for me ?

Example :
I need to show out the result as below script on Nagios core. But i dunno what plugin can do like this.
since i need to real time to check how many connection on our web server by using Nagios core.

Code: Select all

echo -e "connections: "
netstat -n | awk '/^tcp/ {++state[$NF]} END {for(key in state) print key,"\t",state[key]}'
echo  -e "\n connected server & ip:"
netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n

Re: Netstat-statistics plugin ?

Posted: Fri Oct 12, 2018 7:55 am
by scottwilkerson
You could put those commands in a custom bash script anc create a nagios plugin, then call the plugin with an agent such as NRPE or NCPA

Here are the Nagios Plugins Development Guidelines
https://nagios-plugins.org/doc/guidelines.html

Re: Netstat-statistics plugin ?

Posted: Thu Oct 18, 2018 10:46 pm
by junqian1992
Hi,
Thanks for your reply.
I will test it.

Re: Netstat-statistics plugin ?

Posted: Fri Oct 19, 2018 8:13 am
by scottwilkerson
junqian1992 wrote:Hi,
Thanks for your reply.
I will test it.
Let us know how it comes out

Re: Netstat-statistics plugin ?

Posted: Tue Dec 04, 2018 1:35 am
by junqian1992
Hi all,
Done, thank you.

Re: Netstat-statistics plugin ?

Posted: Tue Dec 04, 2018 8:29 am
by scottwilkerson
junqian1992 wrote:Hi all,
Done, thank you.
Great!

Locking thread