Sam Weather

Bookmark and Share

Current Version
1.0
Last Release Date
2012-08-10
Compatible With
  • Nagios 3.x
  • Nagios XI
E-mail
License
GPL
Hits
21460
Files:
FileDescription
samweathersamweather
Sam Weather
Weather plugin for Nagios that lets you check temperature, humidity, wind, rain fall, dewpoint, heat index, and windchill. This also reports performance data to Nagios for graphing. The plugin uses data from Weather Underground. If you have any questions, issues, or suggestions please do not hesitate to email me (dockesa@auburn.edu).
Sam Weather Ver. 1.0
Author: Sam Dockery
Email: dockesa@auburn.edu

To find your STATIONID, go to http://www.wunderground.com/wundermap/ and search for a station near your location.
Click on the station and you will see an alphanumeric Station ID.
Software requirements are LYNX, GREP, and CUT. These should be availble through your package manager (yum, apt-get, etc.)
Should work with Nagios, NagiosXI, and any Unix/Linux system as long as the software requirements are met.
Each weather parameter includes performance data (so long as the output isn't a string).

Troubleshooting Tips:
1. Make sure the plugin has the correct permissions on the file. chown nagios:nagios samweather or chown apache:apache samweather
2. Make sure you have the correct stationid, put it in all caps to be safe. Example: KALAUBUR4
3. Only use 1 weather parameter at a time. Might add the capability in the future for more parameters at a time.
4. If the plugin returns no data, either the weather underground site is unavailable or you have an incorrect stationid.
5. If you still have issues, verify you can open the stationid on the weather underground site. Replace your stationid with the one at the end of the example.
Example: http://api.wunderground.com/weatherstation/WXCurrentObXML.asp?ID=KALAUBUR4
6. Verify you have LYNX, GREP, and CUT installed.

Usage:
./samweather stationid weatherparameter

Example:
./samweather KALAUBUR4 temp

Output:
Temperature: 79.5 F (26.4 C) | 'Temp F'=79.5 'Temp C'=26.4

Weather Parameters are:
temp - Temperature in F & C
heatindex - Heat Index in F & C
humidity - Relative Humidity
wind - Wind direction, degrees, and MPH
precip - Precipitation today in Inches & Cent.
dewpoint - Dewpoint in F & C
windchill - Windchill in F & C
Reviews (1)
byweyoon, April 9, 2013
Add the following to the script to add pressure (press):

#Output for Pressure
if [ $2 = "press" ]
then
VAR1=$(lynx -dump -source http://api.wunderground.com/weatherstation/WXCurrentObXML.asp?ID=$1 | grep pressure_mb | cut -d">" -f2 | cut -d"" -f2 | cut -d"" -f2 | cut -d" printf "Pressure: $VAR3 | 'MB'=$VAR1 'IN'=$VAR2\n"
exit
fi