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

Check Processes and Ports

Rating
1 vote
Favoured:
0
Hits
159425
Files:
FileDescription
check_system_ppCheck Processes and Ports. Version 1.01

Help Support Ethan Galstad's New Project:

Help Support Ethan

A Message From The Founder...

As the founder of Nagios, I'm asking for your help in a cause that's dear to my heart.

I'm launching a new project to help better the world by providing the information, ideas, and inspiration that I believe can improve the lives of people everywhere.

I know you're busy managing networks, but I would appreciate it if you would consider liking my Facebook page and showing your support for the content and messages I produce by sharing them with your friends and family.

You can learn more about my project by visiting ethangalstad.me/nagios. Thank you for your time. I wish you all the best in your endeavors, whatever they may be.

- Ethan

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!!