Home Directory Plugins Operating Systems Linux check ps cpu - simple bash script

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 ps cpu - simple bash script

Rating
0 votes
Favoured:
0
Owner
License
Other
Hits
146304
Files:
FileDescription
check_ps_cpucheck_ps_cpu
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!
Simple bash script, to check the output of ps for a defined service/program name and it's cpu usage.

Usage: check_ps_cpu -w <warning> -c <critical> -p <process name>

Returns a warning/critical message, when the cpu usage is above the threshold or when the monitored service is not running at all.

Can be easily adopted to monitor other values of ps, by adding your own ps parameters in the following line

--- snipp ---
CHECK_PROCESS="$(/bin/ps -eo pcpu,comm,user,pid,time | sort -rnk1 | grep $PROCESS)"
--- snipp ---

Be warned about my poor programming skillz. Just thought this script might be useful for someone, so i added it here...