Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Check Processes and Ports
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!
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
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!!
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!!