How can I use the Pingdom API to pause and resume checks from bash?

2.8k views Asked by At

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?

2

There are 2 answers

0
Niraj Bhawnani On

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.
0
Rohlik On

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.