Welcome, Guest Login

Support Center

Configuring Webhooks

Last Updated: Apr 22, 2015 10:34AM EDT
Please note:  Webhooks are available for Trial and Elite tier customers.

Webhooks in Stackdriver offer the ability to notify remote services about incidents that occur in your environment. There are eight parts to an incident notification. Below is an example of a message generated from an incident:
"msg":{
    "incident":{
      "incident_id":"f2e08c333dc64cb09f75eaab355393bz",
      "resource_name":"webserver-85",
      "ended_at":null,
      "resource_id":"i-4a266a2d",
      "url":"https://app.stackdriver.com/incidents/f2e08c333dc64cb09f75eaab355393bz",
      "summary":"CPU (agent) for webserver-85 is above the threshold of 1% with a value of 28.5%",
      "state":"open",
      "started_at":1385085727
    },
    "version":1
  }


Field output explanation:

  • incident_id - UUIDv4 according RFC 4122
  • resource_name: the name of the resource used through the application
  • ended_at : this will be null when it is an open message, and will have a timestamp for when the incident ended for resolved messages.
  • resource_id: AWS resource id
  • url: link to incident page
  • summary: condition name with the resource name and value
  • state: open, closed or acknowledged
  • started_at: timestamp for metric that triggered violation

Configuration

To configure a Webhook, go to https://app.stackdriver.com/settings/notifications/static-webhook or navigate through Account >> Account Settings >> Notifications >> Webhooks. 

Standard

To add a simple Webhook, specify the endpoint where you would like an incident message to be posted, give it a name, test Stackdriver’s connection to the endpoint and then add it.



After creating your Webhook, you will be able to use it when configuring alerting policies. When creating a policy, under the Notifications section, select Webhook from the Add drop-down, choose your desired Webhook and then click the green check mark to confirm the addition.

Authentication

In addition to basic message posting, Stackdriver Webhooks supports two methods of authentication. Basic Auth and Token Auth.

Basic Auth

Basic authentication leverages the HTTP specification for including username and password along with the webhook request Stackdriver sends. In accordance with the spec, Stackdriver expects your server to correctly return a 401 response with the correct “WWW-Authenticate” header.



Documentation and examples of HTTP Basic Auth can be found at:
- RFC Specification: http://www.ietf.org/rfc/rfc2617.txt
- Wikipedia: http://en.wikipedia.org/wiki/Basic_access_authentication

Token Auth

Token Authentication is utilized by providing a querystring parameter in the endpoint url with a key that the server expects to be secret between itself and Stackdriver. For example, you might enter an endpoint url that looks like: https://www.myserver.com/stackdriver-hook?auth_token=1234-abcd.

When Stackdriver posts an incident to that url, you can check to ensure that the attached parameter matches what you expect. This method of authentication is most effective when used in conjunction with SSL/TLS to encrypt the HTTP request preventing snoopers from learning the token.




For server examples in python, visit https://gist.github.com/tschieggm/7604940

 
 

https://cdn.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete