Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

check_tcp_stat.sh

Compatible With
  • Nagios 3.x
  • Nagios 4.x
License
GPL
Hits
25115
Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
TCP status monitoring.
pnp4nagios:
https://github.com/June-Wang/NagiosPlugins/blob/master/check_tcp_stat.php
Usage:
1.Add NRPE command to nrpe.cfg
echo 'command[check_tcp_stat]=/usr/local/nagios/libexec/check_tcp_stat.sh -w 300 -c 500 -l' >> /usr/local/nagios/etc/nrpe.cfg

DESCRIPTION
-H IP ADDRESS
-p LOCAL PORT
-S [TIME_WAIT|FIN_WAIT|ESTABLISHED|CLOSING|SYN_SEND|TIMED_WAIT|LISTEN]
-w warning
-c critical
-l logging turned on

For example:
Total connections:
check_tcp_stat.sh -w 100 -c 200
Port:
check_tcp_stat.sh -p 8819 -w 100 -c 200
Host and Port:
check_tcp_stat.sh -H 192.168.0.6 -p 8819 -w 100 -c 200

Note:
1.Such as opening the log function, to manually execute a command, the program will automatically create /var/log/tcp folder.

Log Preview:
2014-03-03 09:27:49 Total: 113 TIME_WAIT: 93 ESTABLISHE D: 20
2014-03-03 09:30:49 Total: 92 TIME_WAIT: 72 ESTABLISHE D: 20
2014-03-03 09:33:49 Total: 132 TIME_WAIT: 110 ESTABLISHE D: 22
2014-03-03 09:36:49 Total: 151 TIME_WAIT: 130 FIN_WAIT1: 1 ESTABLISHED: 20
2014-03-03 09:39:49 Total: 91 TIME_WAIT: 70 ESTABLISHE D: 21
2014-03-03 09:42:49 Total: 84 TIME_WAIT: 67 ESTABLISHE D: 17
2014-03-03 09:45:49 Total: 94 TIME_WAIT: 75 FIN_WAIT2: 1 ESTABLISHED: 18
2014-03-03 09:48:49 Total: 90 TIME_WAIT: 69 ESTABLISHE D: 21
2014-03-03 09:51:49 Total: 101 TIME_WAIT: 76 ESTABLISHE D: 25
2014-03-03 09:55:54 Total: 58 TIME_WAIT: 51 ESTABLISHE D: 7