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.

108 lines
6.5 KiB

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