You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

136 lines
2.8 KiB

  1. # Pinging API
  2. With the Pinging API, you can signal **success**, **fail**, and **start** events from
  3. your systems.
  4. ## General Notes
  5. All ping endpoints support:
  6. * HTTP and HTTPS
  7. * HTTP 1.0, HTTP 1.1 and HTTP 2
  8. * IPv4 and IPv6
  9. * HEAD, GET, and POST requests methods. The HTTP POST requests
  10. can optionally include diagnostic information in the request body.
  11. If the request body looks like a UTF-8 string, SITE_NAME stores the request body
  12. (limited to the first 10KB for each received ping).
  13. Successful responses will have the "200 OK" HTTP response status code and a short
  14. "OK" string in the response body.
  15. ## Send a "success" Signal
  16. ```text
  17. HEAD|GET|POST PING_ENDPOINT{uuid}
  18. ```
  19. Signals to SITE_NAME that the job has completed successfully (or,
  20. continuously running processes are still running and healthy). The `uuid` parameter
  21. is unique for each check.
  22. **Example**
  23. ```http
  24. GET /5bf66975-d4c7-4bf5-bcc8-b8d8a82ea278 HTTP/1.0
  25. Host: hc-ping.com
  26. ```
  27. ```http
  28. HTTP/1.1 200 OK
  29. Server: nginx
  30. Date: Wed, 29 Jan 2020 09:58:23 GMT
  31. Content-Type: text/plain; charset=utf-8
  32. Content-Length: 2
  33. Connection: close
  34. Access-Control-Allow-Origin: *
  35. OK
  36. ```
  37. ## Send a "fail" Signal
  38. ```text
  39. HEAD|GET|POST PING_ENDPOINT{uuid}/fail
  40. ```
  41. Signals to SITE_NAME that the job has failed. Actively signaling a failure
  42. minimizes the delay from your monitored service failing to you receiving an alert.
  43. **Example**
  44. ```http
  45. GET /5bf66975-d4c7-4bf5-bcc8-b8d8a82ea278/fail HTTP/1.0
  46. Host: hc-ping.com
  47. ```
  48. ```http
  49. HTTP/1.1 200 OK
  50. Server: nginx
  51. Date: Wed, 29 Jan 2020 09:58:23 GMT
  52. Content-Type: text/plain; charset=utf-8
  53. Content-Length: 2
  54. Connection: close
  55. Access-Control-Allow-Origin: *
  56. OK
  57. ```
  58. ## Send a "start" Signal
  59. ```text
  60. HEAD|GET|POST PING_ENDPOINT{uuid}/start
  61. ```
  62. Sends a "job has started!" message to SITE_NAME. Sending a "start" signal is
  63. optional, but it enables a few extra features:
  64. * SITE_NAME will measure and display job execution times
  65. * SITE_NAME will detect if the job runs longer than its configured grace time
  66. **Example**
  67. ```http
  68. GET /5bf66975-d4c7-4bf5-bcc8-b8d8a82ea278/start HTTP/1.0
  69. Host: hc-ping.com
  70. ```
  71. ```http
  72. HTTP/1.1 200 OK
  73. Server: nginx
  74. Date: Wed, 29 Jan 2020 09:58:23 GMT
  75. Content-Type: text/plain; charset=utf-8
  76. Content-Length: 2
  77. Connection: close
  78. Access-Control-Allow-Origin: *
  79. OK
  80. ```
  81. ## Report Script's Exit Status
  82. ```text
  83. HEAD|GET|POST PING_ENDPOINT{uuid}/{exit-status}
  84. ```
  85. Sends a success or failure signal depending on the exit status
  86. included in the URL. The exit status is a 0-255 integer. SITE_NAME
  87. interprets 0 as success and all other values as failure.
  88. **Example**
  89. ```http
  90. GET /5bf66975-d4c7-4bf5-bcc8-b8d8a82ea278/1 HTTP/1.0
  91. Host: hc-ping.com
  92. ```
  93. ```http
  94. HTTP/1.1 200 OK
  95. Server: nginx
  96. Date: Wed, 29 Jan 2020 09:58:23 GMT
  97. Content-Type: text/plain; charset=utf-8
  98. Content-Length: 2
  99. Connection: close
  100. Access-Control-Allow-Origin: *
  101. OK
  102. ```