ITRS Opsview Cloud Documentation

Downtime - Creating

To set downtimes, you need to set downtime specific parameters and then choose the objects that the downtime will apply to.

Downtime specific parameters Copied

Parameters for creating downtimes:

These parameters can either be specified in the URL or via input to the REST API. For instance, in JSON format, please ensure no spaces are left between the below fields or you may receive an error regarding the syntax.

opsview@opsview-orchestrator:~$ cat /tmp/weekendowntime-api-downtime.json
        "starttime":"2020-01-17 17:00:00",
        "endtime":"2020-01-20 08:00:00",

You may apply this via a file (–content-file) as per the below example:

root@opsview-orchestrator:~#sudo su - opsview
opsview@opsview-orchestrator:~$ /opt/opsview/coreutils/bin/opsview_rest --username=admin --password=initial --data-format=json --pretty --content-file=/tmp/weekendowntime-api-downtime.json POST "downtime?hst.hostname=opsview

If the same parameters are found as input data and in the URL, the input data has priority.

The author of the downtime is taken from the user authentication information.

Downtime is created asynchronously, so the REST API will return as soon as the downtime has been submitted. There may be a small delay before the downtime is processed and stored in the database.

Downtime is set against objects and applies downwards, so if you:

The downtime for the object is set at submission time. This means that if you set downtime to a host group and then add a new host to that host group, the new host will not have downtime set. This is also true for downtime on hosts with new services added.

Object selection Copied

When setting downtime in the REST API, we can set downtime against a host group, a host or a service. You can specify these objects through URL parameters. Note that although you can specify downtime for a host group, it is stored in Opsview as downtime for each host and its services.

You can choose hosts or services using the same URL parameters as the Status REST API, with the following differences:

Alternatively, you can search for objects using the following parameters, based on the object type you are searching for. This is called “object type specific parameters”.


The host and services will only be found if you have the appropriate access to the object

The basic rule is that if you are searching for multiple fields of the same type of object, then the search fields are AND’d together, but multiple values of the same field are OR’d together. Duplicated host or services are ignored. Duplicate host groups are also ignored, but as downtime is set against leaf host groups, it is possible to set the downtime twice on the same host groups.

If you request a specific object (using hg.hostgroupid, hg.hostgroupname, hst.hostname, hst.hostid, svc.hs, svc.serviceid) and that object does not exist, an error is raised:

    "message": "Error when searching for objects",
    "detail": "Cannot find host with name nosuchhost; Cannot find host with id 3"

In no objects are found, an error is returned:

    "message": "No objects chosen for downtime creation"

For example, URL parameters of:


This would select the service hostA::service1, the service with id=45, and all services called HTTP or Disk:% on hostB or hostC.

Response Copied

On successful submission of downtime, the response will be of the form:

    "summary": {
        "num_hostgroups": ....,
        "num_hosts": ....,
        "num_services": ....,
    "list": {
            "id": ..., "name": ...
            "id": ..., "hostname": ....
            "id": ..., "hostname": ..., "servicename": ...

This reflects the number of host groups, hosts and services that this downtime applied to.

In the event of a failure, the response will be:

    "message": ...,
    "detail": ....,

Where message could be one of:

Example: A typical command line example below

/opt/opsview/coreutils/bin/opsview_rest –pretty –username=XXXX –password=XXXXXXXXXX \
  POST 'downtime?hg.hostgroupid=HOSTGROUPID&starttime=yyyy-mm-dd hh:mm:ss&endtime=yyyy-mm-dd hh:mm:ss&comment="<any comments here>"'
["Opsview On-premises"] ["API", "Technical Reference"]

Was this topic helpful?