Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Check CPU Usage (by Nestor@Toront)
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!
Reviews (1)
byPetaris, February 15, 2016
I have updated some syntax to use new methods but the functional change is located on line 11 (12 in the below as I have a comment on line 11).
#!/bin/sh
# Version 0.2
#
# ### History ###
# V0.1 Created script from CPU Idle script
# V0.2 Handle dicimal compare and output
if [ "$1" = "-w" ] && [ "$2" -gt "0" ] && [ "$3" = "-c" ] && [ "$4" -gt "0" ] ; then
warn=$2
crit=$4
#>Main Modification CPU Usage = $USAGE %|CPU Usage=$USAGE%;;;;"
exit 2
else
echo "WARNING - CPU Usage = $USAGE %|CPU Usage=$USAGE%;;;;"
exit 1
fi
else
echo "OK - CPU Usage = $USAGE %|CPU Usage=$USAGE%;;;;"
exit 0
fi
else
echo "$0 - Nagios Plugin for checking CPU Usage in percentage "
echo ""
echo "Usage: $0 -w -c "
echo " = warnlevel and critlevel is warning and critical value for alerts. "
echo ""
echo "EXAMPLE: /usr/lib64/nagios/plugins/$0 -w 80 -c 90 "
echo " = This will send warning alert when CPU Usage percentage is higher than 80%, and send critical when higher than 90%"
echo ""
exit 3
fi
#!/bin/sh
# Version 0.2
#
# ### History ###
# V0.1 Created script from CPU Idle script
# V0.2 Handle dicimal compare and output
if [ "$1" = "-w" ] && [ "$2" -gt "0" ] && [ "$3" = "-c" ] && [ "$4" -gt "0" ] ; then
warn=$2
crit=$4
#>Main Modification CPU Usage = $USAGE %|CPU Usage=$USAGE%;;;;"
exit 2
else
echo "WARNING - CPU Usage = $USAGE %|CPU Usage=$USAGE%;;;;"
exit 1
fi
else
echo "OK - CPU Usage = $USAGE %|CPU Usage=$USAGE%;;;;"
exit 0
fi
else
echo "$0 - Nagios Plugin for checking CPU Usage in percentage "
echo ""
echo "Usage: $0 -w -c "
echo " = warnlevel and critlevel is warning and critical value for alerts. "
echo ""
echo "EXAMPLE: /usr/lib64/nagios/plugins/$0 -w 80 -c 90 "
echo " = This will send warning alert when CPU Usage percentage is higher than 80%, and send critical when higher than 90%"
echo ""
exit 3
fi