Tuesday, October 4, 2011

Nagios Plugin - check_rss

As IT moves towards the cloud there are certain things we can't monitor effectively with Nagios, so I made a plugin to check RSS feeds. Many cloud services offer an RSS feed with their status. check_rss allows you to parse these feeds either looking for certain keywords that exist (or don't) or the date of the last post.

check_rss requires the feedparser and argparse python libraries. For Ubuntu you can install with
sudo apt-get install python-feedparser python-argparse

usage: check_rss [-h] -H RSSFEED [-c CRITICALIF] [-C CRITICALNOT] [-w WARNINGIF] [-W WARNINGNOT] [-t] [-p] [-v VERBOSITY]

optional arguments:
-h, --help  -  show this help message and exit
-H RSSFEED  -  URL of RSS feed to monitor
-c CRITICALIF, --criticalif CRITICALIF  -  Comma separated, quoted list of strings that will result in critical condition if PRESENT
-C CRITICALNOT, --criticalnot CRITICALNOT  -  Comma separated, quoted list of strings that will result in critical condition if MISSING
-w WARNINGIF, --warningif WARNINGIF  -  Comma separated, quoted list of strings that will result in warning condition if PRESENT
-W WARNINGNOT, --warningnot WARNINGNOT  -  Comma separated, quoted list of strings that will result in warning condition if MISSING
-T HOURS, --hours HOURS - Hours since last post. Will return critical if less than designated amount.
-t, --titleonly  -  Search the titles only. The default is to search for strings matching in either the title or description
-p, --perfdata  -  If used will keep very basic performance data (0 if OK, 1 if WARNING, 2 if CRITICAL, 3 if UNKNOWN)
-v VERBOSITY, --verbosity VERBOSITY  -  Verbosity level. 0 = Only the title is returned. 1 = Title and link are returned. 2 = Title, link and description are returned (Default)

If you do not specify any warning or critical conditions, it will
always return OK. This will only check the newest feed entry.

Changelog:
2011-11-02 - v 0.3 - Added check by time, fixed verbosity bug and changed data separators to semi-colons to not mess up performance data.

0 comments:

Post a Comment