
Network Connections, Stats and Bandwidth
Check Number Of Connections
Description:
Perl script that checks the number of established network connections using lsof
Current Version
Last Release Date
June 3, 2009
Compatible With
Owner
Project Files
File | Description |
---|---|
check_connections.pl |
Project Notes
You can check the number of established network connections of a specific user or the number of network connections of a given command. Those two options can be combined.
Note: This script uses lsof with sudo.
Make sure your /etc/sudoers is properly configured.
For example put the following line into /etc/sudoers
nagios ALL=NOPASSWD: /usr/sbin/lsof
Please refer to the manpages for further options.
Examples of usage:
/usr/local/nagios/libexec/check_connections.pl -w 200 -c 250 -C httpd
Will check the number of network connections for any command containig httpd. If the number of established connections is equal to or exceeds 200 a warning is reported, if it's more or equal to 250 the an error.
/usr/local/nagios/libexec/check_connections.pl -w 200 -c 250 -u apache
Same as above except not commands containing httpd will be checked but any commands owned by user apache. You can also use uids instead of login names.
/usr/local/nagios/libexec/check_connections.pl -w 200 -c 250 -u apache -C httpd
This checks only commands containing httpd owned by user apache.
Released under the LGPL, visit http://www.gnu.org/licenses/lgpl.html for details.
Tested on:
- Redhat Linux 7.3 (x86)
- Fedora Core 4 (x86)
- Gentoo Linux 2006.1 (x86)
- Solaris 10 (sparc)
Reviews
(1)
Add a Review
It works perfectly fine but facing problem by using check_connection.pl script with NRPE. It returns zero connection count.
./check_nrpe -H host-name -c command-name
gives...
OK - Established connections: 0
help would be appreciated, THANKS
Page Sections
Project Stats
Rating
4 (1)
Favorites
0
Views
121,529