2

I'm writing a quick and dirty deployment script and would like to disable and reenable a Pingdom check as part of it. How do I do that using something like cURL?

Niraj Bhawnani
  • 158
  • 1
  • 3
  • 8

2 Answers2

5

To pause a check:

 curl -X PUT -u 'your@email:yourpassword' -H 'Content-Type: application/json' -H 'App-Key: yourapplicationkey' -d 'paused=true' https://api.pingdom.com/api/2.0/checks/checkid

To resume a check:

 curl -X PUT -u 'your@email:yourpassword' -H 'Content-Type: application/json' -H 'App-Key: yourapplicationkey' -d 'paused=false' https://api.pingdom.com/api/2.0/checks/checkid
  • Replace your@email with your pingdom email.
  • Replace yourpassword with your pingdom password.
  • Replace yourapplicationkey with a generated key from the "Sharing" section in your account.
  • Replace checkid with the numeric ID you see in the browser URL when you click on your check in the Pingdom UI.
Niraj Bhawnani
  • 158
  • 1
  • 3
  • 8
0

You can also use modern way - just API key instead of using also email/password.
First, generate your own API key in https://my.pingdom.com/app/api-tokens and then you can use curl commands like for pausing:

curl -X PUT \
  https://api.pingdom.com/api/3.1/checks \
  -H 'Authorization:Bearer YOURAPIKEY' \  
  -d 'paused=true&checkids=777'  

or for resuming:

curl -X PUT \
  https://api.pingdom.com/api/3.1/checks \
  -H 'Authorization:Bearer YOURAPIKEY' \  
  -d 'paused=false&checkids=777'  

Replace YOURAPIKEY with your real API key and 777 with valid check ID.
checkids can be also omitted, then all checks will be modified.

Rohlik
  • 1,286
  • 19
  • 28