Web API tile with PagerDuty

This article covers how to use the Web API tile to display live API data from PagerDuty on a dashboard or perspective.

SquaredUp DS uses the PagerDuty account that you configure, and queries will be updated as the page updates, by default every minute.

If you need more information about using the Web API tile in general see How to use the Web API tile

This article covers several areas:

  1. Adding a PagerDuty provider in SquaredUp DS
  2. Walkthrough: Adding a Web API tile to a dashboard to show PagerDuty alerts
  3. Walkthrough: Adding a Web API Scalar tile to a dashboard to show PagerDuty incident counts
  4. Hints and Tips

Prerequisites

  • The SquaredUp server must have access to your PagerDuty instance, since it is the server that connects to PagerDuty, and not your users' browser.
  • If you use a proxy server you may need to configure the proxy to allow the SquaredUp server to communicate with PagerDuty (How to configure SquaredUp DS to use a proxy).
  • A PagerDuty account. You may need some help from a PagerDuty admin to get an account with the correct privileges.

Adding a PagerDuty provider in SquaredUp DS

Before you configure the Web AP tile for use with PagerDuty you need to create a PagerDuty provider in SquaredUp DS.

Adding a provider is a one-time configuration task, and once the provider has been configured it can be used each time you configure a tile.

For PagerDuty the provider must be created as a simple provider:

  1. In SquaredUp DS navigate to the right-hand menu ☰ > system > Integrations

  2. Under Integrations click Web API.
  3. Click the authentication type Simple
  4. In the service name box type in a suitable name, e.g. PagerDuty
  5. The base URL should be the current PagerDuty API URL, for example:
    https://api.PagerDuty.com/
  6. Under default headers click add
  7. Add the following information to the boxes as shown below:
    First box (name): authorization Second box (value): Token token=API token from PagerDuty

    You can create an API access key (token) by logging in to PagerDuty > Integrations > API Access Keys > Create New API Key, and ticking Read-only API Key. See Generating API Keys

    Copy the API access key from PagerDuty before closing the window:

    Paste into the authorization value box in SquaredUp DS, prepended by Token token= as shown above.
  8. Click Save.

Walkthrough: Adding a Web API tile to a dashboard to show PagerDuty alerts

It is important to use http GET mode and to set the key path in the response data section to alerts. This is described in the steps below.

  1. On the top navigation bar in SquaredUp DS click the + to create a new dashboard, and give your dashboard a title.
  2. Select any page template, for example the two tile layout, and then click Configure tile to begin.
  3. Click on Integrations > Web API.
  4. Select Web API (Grid).
  5. Leave the scope section blank for this walkthrough.
  6. In the provider section select the PagerDuty provider that you created earlier.
  7. In the http mode section leave the http method set to GET.
  8. Type alerts in the box after the URL. The URL shown here is the URL you specified when you created the PagerDuty Web API provider.
    At this point you should see a table, but it won't show data quite yet.
  9. Leave the headers & data section as it is for this walkthrough.
  10. In the response data section you should see some data in the response data box. If there isn't any data check the configuration of your provider.
  11. Type alerts into the key path box.
    At this point the table should change to show data:
  12. Click next to move to the grid columns section.
  13. Click hide next to some of the columns you might not wish to show, e.g. id, type, summary, self, html_url, resolved_at, alert_key, suppressed, service, incident, first_trigger_log_entry, body, integration, privilege.
  14. You may like to rename the columns to make them more readable, e.g. created_at to Created, status to Status and severity to Severity
  15. To make the created date and time more readable you can use mustache syntax with timeago (How to use Custom Labels) in the custom template. Click edit next to Created and paste the following in to the custom template box:
    {{timeago(value)}}
    This shows how long ago the alert occurred.

    You may like to add further columns for additional data. For help customizing the columns of data see How to use the Grid Designer.
  16. You can also add columns.
    Click Add, give the column a name, such as Message, and in the custom template box. Leave data key path empty. Click the mustache helper button
    and select the value you require. You can also type in the box to find the value you want. For example {{value.body.cef_details.message}} then click done:
  17. Other columns you might like to add include:
    name: Website with custom template: {{value.body.cef_details.details.hostname}}
    name: Related Incident with custom template: {{value.incident.summary}}
  18. You may wish to change the order the columns by dragging them into position.
  19. The Grid Options Row Link property allows you to automatically link each row to a parameterised hyperlink. Click on the mustache helper button and then select {{incident.html_url}} from the drop down list.
  20. Click done.

Walkthrough: Adding a Web API Scalar tile to a dashboard to show PagerDuty incident counts

It is important to use http GET mode and to set the key path in the response data section to incidents.

  1. Click on the Web API tile.
  2. Select Web API (Scalar).
  3. Leave the scope section blank for this walkthrough.
  4. In the provider section select the PagerDuty provider that you created earlier.
  5. In the http mode section leave the http method set to get.
  6. In the box following the URL you need to type incidents
    After clicking elsewhere on the dashboard the results pane should change from an API error to No scalar data found at keypath.
  7. The headers & data section is where you can pass key variables through to PagerDuty. Click the add button under data to add the following data name and value settings:
    name: statuses%5B%5D value: resolved
  8. Click apply changes.
  9. In the response data section you should see some sample data shown. Type incidents into the key path field.
    When you click outside the box the No scalar data found at keypath message will change to show a value.
  10. Click next to move to the scalar section where you can change the font size if you wish.
  11. Click done.
  12. Repeat the above steps to create two new tiles, one for Triggered and another for Acknowledged substituting the following data name and value settings in lower case in the headers & data section:
    name: statuses%5B%5D value: triggered
    name: statuses%5B%5D value: acknowledged

Hints and Tips

Was this article helpful?


Have more questions or facing an issue?