Netstat-statistics plugin ?

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
junqian1992
Posts: 41
Joined: Wed Nov 15, 2017 4:57 am

Netstat-statistics plugin ?

Post 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
Regards,
JQ
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Netstat-statistics plugin ?

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
junqian1992
Posts: 41
Joined: Wed Nov 15, 2017 4:57 am

Re: Netstat-statistics plugin ?

Post by junqian1992 »

Hi,
Thanks for your reply.
I will test it.
Regards,
JQ
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Netstat-statistics plugin ?

Post by scottwilkerson »

junqian1992 wrote:Hi,
Thanks for your reply.
I will test it.
Let us know how it comes out
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
junqian1992
Posts: 41
Joined: Wed Nov 15, 2017 4:57 am

Re: Netstat-statistics plugin ?

Post by junqian1992 »

Hi all,
Done, thank you.
Regards,
JQ
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Netstat-statistics plugin ?

Post by scottwilkerson »

junqian1992 wrote:Hi all,
Done, thank you.
Great!

Locking thread
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked