Changes (2)

{note}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.{note}

h5. Overview

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 to both a primary parent and any standby servers at the same time, thus keeping themfrom other tools, or other groups in sync.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.

{attachments:patterns=dt_script.sh}

...

h5. Submit downtime from the command line

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. {note}This can also be run from other Linux systems that have network access to the GroundWork server.{note} # Make executable by nagios: (for example) {noformat} chmod +x dt_script.sh {noformat} #* Run like this: {noformat}./dt_script.sh -S your-gw-server -u username -p password -h host-to-put-in-downtime||null -s service-to-pu-in-downtime||null -g hostgroup-to-put-in-downtime||null -r servicegroup-to-put-in-downtime||null -a author -c "Description text in quotes" -D <Start date, e.g. "2019-04-12 21:30:00"> -E <End date, e.g. "2019-04-12 23:30:00"> -d duration{noformat} #* 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.