Inciden downtime based on Business Hours (REST)

Goal of this tutorial

To show how to create an incident downtime (also knows as alert suppression), based on Business Hours, via REST API.

Scenario

In this tutorial, you will create a business hours record, and then an incident downtime, which uses these business hours.

You can use any REST Client of your choice, or you can use built-in web service at https://<your_appmon_server>:8021/api-docs/current. This tutorial uses localhost as the AppMon server name. If you have the AppMon installed on a different host, replace it accordingly.

This tutorial uses the demo easyTravel System Profile. However, you can use any System Profile from your AppMon installation. In that case, replace easyTravel with the name of your System Profile.

Note

Business Hours for alert suppression must be defined in the dynaTrace Self-Monitoring System Profile regardless of the actual System Profiles affected by the suppression.

Requirements

As a prerequisite, you should be familiar with Incident Downtimes and Business Hours.

Detailed Steps

1. Create Business Hours definition

At first, we need to create a business hours record in the dynaTrace Self-Monitoring System Profile. It would be representation of working week, from Monday to Friday, starting at 8 am, and ending at 5 pm each day, so let's name it 8_to_17.

  1. Go to https://localhost:8021/api-docs/current.
  2. Expand the Business Hours > PUT /profiles/{profileid}/businesshours/{businesshoursname} section.
  3. In the profileid field, type dynaTrace Self-Monitoring.
  4. In the businesshoursname field, type 8_to_17.
  5. In the body field, put the following JSON:
    {
      "inclusions": [
        {
          "timespan": {
            "start": "08:00",
            "end": "17:00"
          },
          "weekdays": [
            "MON","TUE","WED","THU","FRI"
          ]
        }
      ]
    }
    
  6. Click Execute!.

2. Create alert suppression

Now we will create the easyTravel_8_to_17 incident downtime for the easyTravel System Profile, based on the 8_to_17 business hours we've just created. We're going to apply it for all incident rules. It means, the new incidents will only arise during the business hours we've created. On weekends, and also from Monday to Friday 0:00 to 8:00 and 17:00 to 24:00 no new incident will be created.

  1. Go to https://localhost:8021/api-docs/current.
  2. Expand the Alerts (Incidents) and Events > PUT /alertsuppression/{suppressionname} section.
  3. In the suppressionname field, type easyTravel_8_to_17.
  4. In the body field, put the following JSON:
    {
      "systemprofiles": [
        {
          "systemprofile": "easyTravel"
        }
      ],
      "businesshours": "8_to_17"
    }
    
  5. Click Execute!.