Downtime - Deleting

Endpoint to delete downtimes from hosts and services

There are two ways of deleting downtimes, which is controlled by the only_objects_set parameter:

only_objects_set value

Permission to list objects

Permission to list all objects

Downtime method

Filtering parameters

Process

0

DOWNTIMESOME

ADMINACCESS

Delete by object

See downtime POST

Resolves the objects to services and hosts and deletes all downtimes on the objects. This is useful for deleting downtimes based on objects, for example when automatically spinning down a host. Mirrors the POST request

1

DOWNTIMESOME

DOWNTIMESOME

Delete by downtime information

See downtime GET

Does a downtime GET with the specified filtering parameters, iterates over each downtime and deletes each downtime individually for the objects returned. This is useful for deleting based on specific downtimes. Works like the downtime GET request

Note: It is possible for a user to delete downtimes that they did not create, as they can view downtimes at the object level.

Deleting a downtime will occur whether or not the downtime is currently in progress.

The response will be the same format as the creation of downtime.

Additional URL parameters are:

  • only_objects_set - see above. Default is 0
  • start_time - start time of downtime. This can be in any format that setting a downtime parses. This is based on the scheduled start time
  • comment - exact comment. Note, this is not the same as the comment entered when creating, as a prefix may be added

Note: You have to use URL parameters, as DELETE methods do not allow data to be POSTed.

Examples

Set downtime for Host Group “Monitoring Servers” (and all hosts and services within the host group):

/opt/opsview/coreutils/bin/opsview_rest --username=admin --password=initial \
  POST downtime"?hg.hostgroupname=Monitoring+Servers&comment=Decommissioning&starttime=tomorrow+2pm&endtime=tomorrow+4pm"

Delete downtime for Host Group “Monitoring Servers” (will delete all downtimes on all hosts and services):

/opt/opsview/coreutils/bin/opsview_rest --username=admin --password=initial \
  DELETE downtime"?hg.hostgroupname=Monitoring+Servers"

Set downtime for Host opsview:

/opt/opsview/coreutils/bin/opsview_rest --username=admin --password=initial \
  POST downtime"?hst.hostname=opsview&comment=Decommissioning&starttime=2030-12-01+09:00:00&endtime=2030-12-01+11:00:00"

Delete downtime for Host opsview:

/opt/opsview/coreutils/bin/opsview_rest --username=admin --password=initial \
  DELETE downtime"?hst.hostname=opsview"

Set two downtimes for Host opsview, and delete one of them:

/opt/opsview/coreutils/bin/opsview_rest --username=admin --password=initial \
  POST downtime"?hst.hostname=opsview&comment=Downtime1&starttime=2030-12-01+09:00:00&endtime=2030-12-01+11:00:00"
/opt/opsview/coreutils/bin/opsview_rest --username=admin --password=initial \
  POST downtime"?hst.hostname=opsview&comment=Downtime2&starttime=2030-12-02+09:00:00&endtime=2030-12-02+11:00:00"

# List the downtimes related to comment=Downtime1
/opt/opsview/coreutils/bin/opsview_rest --username=admin --password=initial --pretty \
  GET downtime"?hostname=opsview&comment=Downtime1"

# Delete these downtimes
/opt/opsview/coreutils/bin/opsview_rest --username=admin --password=initial \
  DELETE downtime"?only_objects_set=1&hostname=opsview&comment=Downtime1"

Set a downtime for a host, then delete for a service on that host (note that the downtime icon will still be shown in the UI as the host is still scheduled to be in a downtime state):

/opt/opsview/coreutils/bin/opsview_rest --username=admin --password=initial \
  POST downtime"?hst.hostname=opsview&comment=Downtime1&starttime=2030-12-01+09:00:00&endtime=2030-12-01+11:00:00"

/opt/opsview/coreutils/bin/opsview_rest --username=admin --password=initial --pretty \
  GET downtime"?hs=opsview::CPU+Statistics&comment=Downtime1"
  
/opt/opsview/coreutils/bin/opsview_rest --username=admin --password=initial --pretty \
  DELETE downtime"?only_objects_set=1&hs=opsview::CPU+Statistics&comment=Downtime1"