Script for monitoring a pvoutput.org system using Nagios

A couple of years ago we got solar panels installed on the roof of the house. It looks like it is going to be a good investment.

For the last year I have had automatic upload of my production data set up to go to pvoutput.org. Here is a link to my data on the site - go take a look.
Sometimes the automatic uploading fails. And it can take me a while - weeks - to notice that there is an issue.

I have finally managed to get a reasonable setup with my Nagios installation that will detect if data is missing for my system on pvoutput.org.
The important piece that I have in place is a script for use with Nagios that will check if my system on pvoutput.org, identified by a System ID, has data available for today or not.
If there is no data, the script will return a CRITICAL status that Nagios know how to work with. if there is data avalable, the script returns an OK status.
The script uses the API that is available for working with pvoutput.org. pvoutput.org is great!
Here is what I now see in my Nagios services status page:

The way I have configured my Nagios installation, if three checks (with 10-minute intervals) fail, I will get:

  • A red LED light on my Blink(1) which is plugged into my Nagios server.
  • A message by Pushover service to my Android device(s).

Some information on that alert configuration is here: Nerd alert: Home server with Nagios, Pushover and Blink(1) warnings.

You can call the script without using Nagios, in order to check if it works.
The syntax goes like this:
./check_pvoutput.sh APIKEY SYSTEMID

For instance
./check_pvoutput.sh 87654 12345

This would check the system with ID 12345. The APIKEY (87654 in the example) is a key that is needed in order to be allowed to use the pvoutput.org API.
Both the APIKEY and SYSTEMID are values you get from your pvoutput.org account.

There is a third, optional, parameter that controls which day you want to check for data. If you leave it out, the check will be for today. If you put a number in the third parameter, the number will be the number of days to subtract from today.
So for instance if you use this command
./check_pvoutput.sh 87654 12345 1

you will bee checking if pvoutput.org has data for yesterday

I have put the Nagios check_pvoutput.org script up on Nagios Exchange.
This is my first shot at creating at Nagios script, so any constructive criticism is welcome.