|This Tech Tip applies to GroundWork Monitor version 7.2.1 which has full API support, prior versions of GroundWork Monitor used a different method.|
In groundwork, downtime submitted only to the Nagios command pipe does not appear in the general Downtime user interface. This page reviews how to submit a host and service downtimes into GroundWork Monitor via the REST API, using the Linux command line, and have it appear in the Configuration > Downtimes screens to validate and audit. This solves the problem of adding all legacy downtimes from an older installation to a new one, and allows you to automate adding downtimes from other tools, or other groups in your organization who don't otherwise need access to GroundWork.
We decided to make this functionality available via a shell script, so it should be pretty clear what's going on - just look at the script. It assembles a downtime request and sends it to the API, properly formatted. Suggestions for improvements are of course welcome.
This script allows you to submit downtime to a GroundWork 7.2.x server from the command line.
- Download and copy the attached script to the nagios home dir on your GroundWork server.
This can also be run from other Linux systems that have network access to the GroundWork server.
- Make executable by nagios: (for example)
- Run like this:
- You will need to feed in good input for it to work.
- The -S, -u, -p, -h, -s, -g, -r, -a, -c args are all required. Use null for any parameters you don't need (e.g. -g null when specifying downtime for a host).
- Start, End, Duration
- If you don't give it start and end and duration, it will default to now for an hour.
- If you give it a start, it will run for an hour from start.
- And if you give it a start and duration, that will work too.
- Start times must be at least 1 full minute in the future.
This will work for host (and all services) if you specify the host and leave service at null, or for a single service if you specify the host and service.
This script will also work fine for hostgroup and servicegroup downtimes.
- For a hostgroup named "foo", for example, do something like this:
- And for servicegroup barr:
The "*" and the null values in the appropriate positions.