Documentation forPingdom

Monitoring APIs or specific resources of a site

The use case

Your websites visitors are most likely not just browsing the HTML that your website is sending out, there are more resources that make websites usable, such as images and stylesheets. You can use our services to monitor them as well as the status of your main server, to make sure that everything is presented as expected to the rest of the world, or at least your users.

An API example

Many websites that has scripts also might need some extra data to make up the whole experience. There might be dynamic content on the site which could be changed after the browser has already received the HTML and rendered the website. A common solution to this is to serve this data from an HTTP API which Javascript can make requests to. The uptime check can monitor HTTP, as exemplified above, this also means that you can monitor arbitrary HTTP servers, for example APIs as well. Let's say that we have a status page which shows check statuses from our own services, and the page is dynamic so that visitors can change the amount of checks viewed and search for check names or tags for example. It is then a good idea to have at least one uptime check set up to make sure that the Pingdom API is up and running:

  1. Read the documentation for the API, https://www.pingdom.com/api/2.1/
  2. Construct a URL for a single check, api.pingdom.com/api/2.1/checks/<CHECK ID>
  3. Log in to My Pingdom
  4. Navigate to Integration > The Pingdom API
  5. Register Application > Copy the Application Key
  6. Navigate to Experience monitoring > Uptime
  7. Click Add new in the upper right corner
  8. Fill in a name for the check
  9. Paste the address in the URL field
  10. Click the optional tab, just above the URL field
  11. Fill in your accounts username and password in the corresponding fields, as the API uses HTTP Basic Access Authentication
  12. Enter a string to look for in the response from the API, to make sure that the response contains check data, for example the following string: "name": "My check 1"
  13. Click Add header in the Requests headers further down
  14. Enter app-key in the first field and the app key, created on step 5, in the second field
  15. Check the alerting setup further down in this window
  16. The default settings, one minute test frequency and 5 minute alert delay are good for most cases
  17. Click Test check and wait a bit for a good result
  18. Click Create check once all is good

A Javascript example

Many websites have extra functionality provided by scripts, these are often loaded as external resources and not delivered with the main HTML from the server originally being monitored. It is a good idea to set an uptime check for the URL of this file as well so that you can get an early warning if there are issues with the whole experience on your website. Here is how we are monitoring pingdom.com:

  1. Visit pingdom.com
  2. Look in the developer tools for linked Javascript files
  3. Copy the URL without the scheme part (https://), we for example like to know what our visitors are up to, so we need a tracking script: www.pingdom.com/wp-content/themes/pingdom-2018/assets/js/tracking.js
  4. Log in to My Pingdom
  5. Navigate to Experience monitoring > Uptime
  6. Click Add new in the upper right corner
  7. Fill in a name for the check
  8. Paste the URL in the URL field
  9. Check the alerting setup further down in this window
  10. The default settings, one minute test frequency and 5 minute alert delay are good for most cases
  11. Click Test check and wait a bit for a good result
  12. Click Create check once all is good

A stylesheet example

As with the first example most websites look quite dull without a stylesheet. This can be included inline with your HTML, but that is cumbersome and it is most often easier to maintain one or more separate files and simply link them. Here is an example to monitor a crucial stylesheet for My Pingdom:

  1. Visit pingdom.com
  2. Look in the developer tools for linked CSS files
  3. Copy the address without the scheme part (https://), for example: www.pingdom.com/wp-content/themes/pingdom-2018/public/assets/css/styles.min.css
  4. Log in to My Pingdom
  5. Navigate to Experience monitoring > Uptime
  6. Click Add new in the upper right corner
  7. Fill in a name for the check
  8. Paste the address in the URL field
  9. Check the alerting setup further down in this window
  10. The default settings, one minute test frequency and 5 minute alert delay are good for most cases
  11. Click Test check and wait a bit for a good result
  12. Click Create check once all is good
  1.  

Navigation Notice: When the APM Integrated Experience is enabled, Pingdom shares a common navigation and enhanced feature set with other integrated experience products. How you navigate Pingdom and access its features may vary from these instructions.