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_temp_wget

Rating
0 votes
Favoured:
0
Current Version
1.0
Last Release Date
2017-03-05
Compatible With
  • Nagios 1.x
  • Nagios 2.x
  • Nagios 3.x
  • Nagios 4.x
Twitter Handle
K_double_A
Hits
1958
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
Basically, I couldn't find any plugins that would take characters (numbers) from a web page and then translate that into a plugin that would work within nagios. I decided to create this simple bash script to get the information (simple wget command) from the IP address to Nagios. Feel free to use and change however you would like.
#!/bin/bash

WARNING_LEVEL_TEMP=80
CRITICAL_LEVEL_TEMP=85

STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
STATE_DEPENDENT=4

# assumed usage:
# ./check_temp.sh http://somewhere.com
URL=$1
temp=$(wget $URL -q -O -)

echo "Temperature: $temp"

# Example:
# if [ $content -gt 80 ] && [ $content -lt 60 ]
# then
# echo "less then 80"
# fi


if [ $temp -ge $CRITICAL_LEVEL_TEMP ]
then
exit $STATE_CRITICAL;
elif [ $temp -ge $WARNING_LEVEL_TEMP ]
then
exit $STATE_WARNING;
else
exit $STATE_OK;
fi