Home Directory Plugins Operating Systems Linux Check Processes and Ports

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 Processes and Ports

Rating
1 vote
Favoured:
0
Hits
170851
Files:
FileDescription
check_system_ppCheck Processes and Ports. Version 1.01
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
A script that checks if processes and TCP ports are up. Tested on Redhat Enterprise Linux 3,4, Fedora 4,5,6, Solaris 6,7,8,9 and HP-UX 11.11,11.23
Heavily based on check_linux_procs.

A script that checks if processes and TCP ports are up. Tested on Redhat Enterprise Linux 3/4, Fedora 4, Solaris 6,7,8,9 and HP-UX 11.11, 11.23

Process checks are divided into two different levels, warning and critical. This way you may monitor less important processes and critical processes at the same time. The part that checks if ports are up uses netstat. It will mostly detect if an server application does not start up correctly, and thereby does not open up it's port.

If you want to be sure ports are up and that the application is listening on it, use more specialized socket check scripts or check_tcp.

Usage:
Edit the check_system_pp script and add whatever processes and ports that you want to monitor. For example:

---snipp----
PROCLIST_RED="sshd crond klogd"
PROCLIST_YELLOW="less_critical_process other_stuffd"
PORTLIST="22 25"
---snipp----

Command line example for nrpe.cfg:
commandcheck_system=/path/to/nrpe/libexec/check_system_pp

FAQ:
Q: I do not have Bash installed. What to do?
A: Just use regular bourne shell (sh). Edit the first line in the script to the path of sh. For example:
#!/usr/bin/sh
Reviews (1)
byguckyh, August 7, 2012
let's simple check for ssh-port 22

this is the part of code used - then it looks if there is at least ONE line

netstat -an | grep LISTEN | grep 22

result:
*.22 *.* 0 0 49152 0 LISTEN
*.22 *.* 0 0 49152 0 LISTEN
*.11221 *.* 0 0 49152 0 LISTEN
*.11222 *.* 0 0 49152 0 LISTEN
*.22 *.* 0 0 49152 0 LISTEN

(you get any line containing "22" not only where the PORT is 22!!