Alerts - Notification Profiles


Overview

Notifications work separately from Alert Definitions. Each Alert Definition can be associated with zero or more Notification Profiles.

There two types of Notification Profiles, User Profiles, and Custom Profiles. All currently defined Notification Profiles are displayed on the Notification Profiles page. All User and Custom Notification Profiles may be enabled, disabled and edited from the Notification Profiles page (given the appropriate credentials). To navigate to the Notification Profiles page: in the Uptime Cloud Monitor UI, click on the Issues tab; then click on Notification Profiles in the Left Navigation panel.

User Notification Profiles

A default User Notification Profile is created by Uptime Cloud Monitor when a new User is created within the UI. It will contain an email notification destination. This User Profile will be assigned a unique NOTIFICATION_PROFILE_ID and is uniquely associated with a single Uptime Cloud Monitor User. The User Notification Profile is a component of the User’s Personal Settings, and cannot be deleted unless the User is deleted.

Each User may edit their own Notifications Profile on the Personal Settings page: in the Uptime Cloud Monitor UI, click on the Settings tab; then click on Personal Settings in the Left Navigation panel; finally click on Notification Settings. User Notification Profiles may also be edited using the API, but cannot be deleted. Push notifications are User-specific, and therefore when enabled, will only appear in User Notification Profiles.

Custom Notification Profiles

Custom Notification Profiles can be created, edited, enabled, disabled and deleted using the UI or by using the API. These profiles provide a great deal of flexibility in terms of managing a wide array of alerts, users, and notification priorities. Unlike User Notification Profiles, Custom Profiles are not user-specific.


The Notification Profile Hash

An example JSON-encoded Notification Profile Hash is shown below:

{
  "id":4028,                                 # unique NOTIFICATION_PROFILE_ID (generated by Uptime Cloud Monitor)
  "name":"Bobo",                             # name of this Notification Profile
  "state":"enabled",                         # state of notification profile (enabled/disabled)
  "user_id":9340,                            # Uptime Cloud Monitor-generated user_id, or null
  "destinations":[                           # array of notification destinations
    {
      "id":7671,                             # NOTIFICATION_DESTINATION_ID (generated by Uptime Cloud Monitor)
      "type":"Email",                        # notification type
      "label":"Email",                       # notification label
      "alert_ids":[                          # alert_ids specifying this notifcation type
        117439,
        117441,
        183024
      ],
      "options":{                            # options specific for this notification destination
        "email":"Bobo@TheClown.net"          # in this case, an email address
      }
    },
    {
      "id":7672,                             # NOTIFICATION_DESTINATION_ID (generated by Uptime Cloud Monitor)
      "type":"Sms",                          # notification type
      "label":"SMS",                         # notification label
      "alert_ids":[                          # alert_ids specifying this notifcation type
        117443,
        147854
      ],
      "options":{                            # options specific for this notification destination
        "phone": "512-555-1212"              # in this case, a phone number
      }
    },
    {
      "id":7673,                             # NOTIFICATION_DESTINATION_ID (generated by Uptime Cloud Monitor)
      "type":"Push",                         # notification type
      "label":"Push",                        # notification label
      "alert_ids":[                          # alert_ids specifying this notifcation type
        147854

     ],
      "options":{                            # options specific for this notification destination
        "apikey":"abcdef0123456789"          # in this case, Uptime Cloud Monitor User-specific ApiKey
      }
    }
  ]
}

The Notification Destination Hash

Each Notification Profile Hash will contain 0 or more Notification Destination Hashes, in an array named “destinations”. Currently, there are 8 Notification Destination types defined:

  • Email
  • SMS
  • Push
  • HipChat
  • PagerDuty
  • Twitter
  • Webhook

Specifying Notification Destinations

The following summarizes the format of each.

"destinations":[                          # array of all notification destination types
 {
   "id":7671,                             # NOTIFICATION_DESTINATION_ID (generated by Uptime Cloud Monitor)
   "type":"Email",                        # notification type
   "label":"Email",                       # notification label
   "alert_ids":[                          # alert_ids specifying this notification type
     117439,
     117441,
     183024
   ],
   "options":{                            # options specific for this type of notification destination;
     "email":"ops@mycompany.com"          # in this case, an email address
   }
 },
 {
   "id":7672,                             # NOTIFICATION_DESTINATION_ID (generated by Uptime Cloud Monitor)
   "type":"Sms",                          # notification type
   "label":"SMS",                         # notification label
   "alert_ids":[                          # alert_ids specifying this notification type
     117443,
     147854
   ],
   "options":{                            # options specific for this type of notification destination;
     "phone": "512-555-1212"              # in this case, a phone number
   }
 },
 {
   "id":7673,                             # NOTIFICATION_DESTINATION_ID (generated by Uptime Cloud Monitor)
   "type":"Push",                         # notification type
   "label":"Push",                        # notification label
   "alert_ids":[                          # alert_ids specifying this notification type
     147854

  ],
   "options":{                            # options specific for this type of notification destination;
     "apikey":"abcdef0123456789"          # in this case, Uptime Cloud Monitor User-specific ApiKey
   }
 },
 {
   "id":7674,                             # NOTIFICATION_DESTINATION_ID (generated by Uptime Cloud Monitor)
   "type":"HipChat",                      # notification type
   "label":"HipChat",
   "alert_ids":[
     183830
   ],
   "options":{                            # options specific for this type of notification destination;
     "auth_token":"aaabbbcccddd000111",   # in this case, HipChat auth token, Room_ID and color
     "room_id":"HipChat-OpsRoom",
     "color":"yellow"
   }
 },
 {
   "id":7676,                             # NOTIFICATION_DESTINATION_ID (generated by Uptime Cloud Monitor)
   "type":"PagerDuty",                    # notification type
   "label":"PagerDuty",
   "alert_ids":[
     147854
   ],
   "options":{                            # options specific for this type of notification destination;
     "api_key":"aaabbbcccddd"             # in this case, PagerDuty api_key
   }
 },
 {
   "id":7677,                             # NOTIFICATION_DESTINATION_ID (generated by Uptime Cloud Monitor)
   "type":"Twitter",                      # notification type
   "label":"Twitter",
   "alert_ids":[
     183830
   ],
   "options":{                            # options specific for this type of notification destination;
     "username":"@mytwitterhandle"        # in this case, Twitter user name
   }
 },
 {
   "id":7678,                             # NOTIFICATION_DESTINATION_ID (generated by Uptime Cloud Monitor)
   "type":"Webhook",                      # notification type
   "label":"Webhook",
   "alert_ids":[
     147854
   ],
   "options":{                            # options specific for this type of notification destination;
     "url":"http://myhandler.newco.com"   # in this case, the URL to which a webhook call will be made.
   }
 }
]

Index

List all Notification Profiles.

CURL Command, and variations:

curl -su <APIKEY>:U https://api.copperegg.com/v2/alerts/profiles.json

curl -s https://<APIKEY>:U@api.copperegg.com/v2/alerts/profiles.json

CURL Response:

Response is an array of JSON-encoded Notification Profile Hashes. The following exemplifies Twitter, SMS, HipChat and email notification destinations.

[
  {
    "id":6468,
    "name":"Operations Twitter DM",
    "state":"enabled",
    "user_id":null,
    "destinations":[
      {
        "id":7034,
        "type":"Twitter",
        "label":"Twitter",
        "alert_ids":[

        ],
        "options":{
          "username":"@myoperations"
        }
      }
    ]
  },
  {
    "id":6469,
    "name":"Operations SMS",
    "state":"enabled",
    "user_id":null,
    "destinations":[
      {
        "id":7035,
        "type":"Sms",
        "label":"SMS",
        "alert_ids":[

        ],
        "options":{
          "phone":"512-555-1212"
        }
      }
    ]
  },
  {
    "id":6470,
    "name":"Operations HipChat",
    "state":"enabled",
    "user_id":null,
    "destinations":[
      {
        "id":7036,
        "type":"HipChat",
        "label":"HipChat",
        "alert_ids":[

        ],
        "options":{
          "auth_token":"aaa",
          "room_id":"aaa",
          "color":"red"
        }
      }
    ]
  }
]

Show

Show in-depth information about a single notification profile.

Required parameters: NOTIFICATION_PROFILE_ID as part of the path.

CURL Command, and variations:

curl -su <APIKEY>:U https://api.copperegg.com/v2/alerts/profiles/<NOTIFICATION_PROFILE_ID>.json

curl -s https://<APIKEY>:U@api.copperegg.com/v2/alerts/profiles/<NOTIFICATION_PROFILE_ID>.json

CURL Response:

Response is a single JSON Notification Profile Hash. In this case, the profile is the same Twitter profile as above.

{
 "id":6468,
 "name":"Operations Twitter DM",
 "state":"enabled",
 "user_id":null,
 "destinations":
  [
   {
    "id":7034,
    "type":"Twitter",
    "label":"Twitter",
    "alert_ids":[],
    "options":{
      "username":"@myoperations"
    }
   }
  ]
}

Create

Create a new Notification Profile. NOTE: the Create call will overwrite an existing profile

Required parameters:

At a minimum, you must include a name:

name
Your short text description of the Notification Profile; e.g., “Operations Twitter DM”.

Optional parameters:

You may include any of the following:

state
A Notification Profile may be either “enabled” or “disabled”. If disabled, no notifications will be sent to any of the included destinations. Default if not specified: “enabled”
destinations
An array of notification destination hashes

Create Example 1: create a new Notification Profile, to demonstrate defaults.

CURL Command, and variations:

curl -su <APIKEY>:U -H "Content-Type: application/json" -XPOST -d '{"name":"HipChat Test"}' https://api.copperegg.com/v2/alerts/profiles.json

curl -s https://<APIKEY>:U@api.copperegg.com/v2/alerts/profiles.json  -H "Content-Type: application/json" -XPOST -d '{"name":"HipChat Test"}'

CURL Response:

Response is Status 200, and a newly-created Notification Profile Hash.

{
 "id":10764,                     # The new Notification Profile ID
  "name":"HipChat Test",
  "state":"enabled",
  "user_id":null,
  "destinations":[]              # No notification destinations were specified
}

Create Example 2: create a new alert definition, with one notification destination specified.

CURL Command, and variations:

curl -su <APIKEY>:U -H "Content-Type: application/json" -XPOST -d '{"name":"Ops-Twitter","destinations":[{"type":"Twitter","label":"Ops-Twitter","alert_ids":[],"options":{"username":"@myops"}}]}' https://api.copperegg.com/v2/alerts/profiles.json

curl -s https://<APIKEY>:U@api.copperegg.com/v2/alerts/profiles.json -H "Content-Type: application/json" -XPOST -d '{"name":"Ops-Twitter","destinations":[{"type":"Twitter","label":"Ops-Twitter","alert_ids":[],"options":{"username":"@myops"}}]}'

CURL Response:

Response is Status 200, and a newly-created Notification Profile Hash. Note that creating this profile creates both a new NOTIFICATION_PROFILE_ID as well as a new Notification Destination ID:

{
 "id":10766,                     # The new Notification Profile ID
 "name":"Twitter-Test",
 "state":"enabled",
 "user_id":null,
 "destinations":[                # One notification destination was specified
  {
   "id":16233,                   # The new Notification Destination ID
   "type":"Twitter",
   "label":"Twitter",
   "alert_ids":[],               # This is a Read-Only field for internal use.
   "options":
   {
    "username":"@myops"
   }
  }
 ]
}

Update

Update an existing Notification Profile.

Required parameters:

You must include all of the following:

NOTIFICATION_PROFILE_ID as part of the path.

Optional parameters:

Same as described for Create.

Update Example 1: Disable a Notification Profile, using the Profile created in Example 2, above:

CURL Command, and variations:

curl -s https://<APIKEY>:U@api.copperegg.com/v2/alerts/profiles/<NOTIFICATION_PROFILE_ID>.json -H "Content-Type: application/json" -XPUT -d '{"state":"disabled"}'

curl -su <APIKEY>:U https://api.copperegg.com/v2/alerts/profiles/<NOTIFICATION_PROFILE_ID>.json -H "Content-Type: application/json" -XPUT -d '{"state":"disabled"}'

CURL Response:

Response is Status 200, and the updated Notification Profile Hash:

{
 "name":"Twitter-Test",
 "state":"disabled",             # All notifications defined here are disabled
 "user_id":null,
 "destinations":[
  {
   "id":16233,
   "type":"Twitter",
   "label":"Twitter",
   "alert_ids":[],
   "options":
   {
    "username":"@myops"
   }
  }
 ]
}

Update Example 2: add an additional Notification Destination to a Notification Profile:

At the end of Update Example 1, we were left with the following Notification Profile:

{
 "id":10766,
 "name":"Twitter-Test",
 "state":"disabled",             # All notifications defined here are disabled
 "user_id":null,
 "destinations":[
  {
   "id":16233,
   "type":"Twitter",
   "label":"Twitter",
   "alert_ids":[],
   "options":
   {
    "username":"@myops"
   }
  }
 ]
}

Now, add a new destination, this time SMS:

curl -su <APIKEY>:U -H "Content-Type: application/json" -XPUT -d '{"name":"Twitter-Test", "state":"disabled", "destinations":[{"type":"Twitter","label":"Ops-Twitter","alert_ids":[],"options":{"username":"@myops"}},{"type":"Sms","label":"Ops-SMS","alert_ids":[],"options":{"phone": "512-555-1212"}}]}' https://api.copperegg.com/v2/alerts/profiles/<NOTIFICATION_PROFILE_ID>.json

curl -s https://<APIKEY>:U@api.copperegg.com/v2/alerts/profiles/<NOTIFICATION_PROFILE_ID>.json -H "Content-Type: application/json" -XPUT -d '{"name":"Twitter-Test", "state":"disabled","destinations":[{"type":"Twitter","label":"Ops-Twitter","alert_ids":[],"options":{"username":"@myops"}},{"type":"Sms","label":"Ops-SMS","alert_ids":[],"options":{"phone": "512-555-1212"}}]}'

CURL Response:

Response is Status 200, and a newly-updated Notification Profile Hash.

{
  "id":10766,
  "name":"Twitter-Test",
  "state":"disabled",
  "user_id":null,
  "destinations":[
    {                            # the new addition to the destinations array
      "id":16281,
      "type":"Sms",
      "label":"SMS",
      "alert_ids":[
      ],
      "options":{
        "phone":"512-555-1212"
      }
    },
    {
      "id":16282,
      "type":"Twitter",
      "label":"Twitter",
      "alert_ids":[
        183830
      ],
      "options":{
        "username":"@myops"
      }
    }
  ]
}

Delete

Delete the specified Notification Profile.

Required parameter:

NOTIFICATION_PROFILE_ID as part of the path.

CURL Command, and variations:

curl  -su <APIKEY>:U -XDELETE  https://api.copperegg.com/v2/alerts/profiles/<NOTIFICATION_PROFILE_ID>.json

curl -s -XDELETE https://<APIKEY>:U@api.copperegg.com/v2/alerts/profiles/<NOTIFICATION_PROFILE_ID>.json

CURL Response:

Response is Status 200, empty JSON hash:

{}