0

So, me and my team uses Pingdom for up time monitoring among other things. During our release process Pingdom alerts us that some of our websites are down, which is expected.

I would like to automate the process of pausing the necessary Pingdom checks. I have tried the following methods.

curl -X PUT -u 'username:Password' -H 'Content-Type: application/json' -H 'App-Key: applicationkey' -d 'paused=true' https://api.pingdom.com/api/2.0/checks/2477066

And followed a guide on how to do the same thing via a Python script (I have very minimal knowledge of Python).

    #!/usr/bin/python
    import sys
    import pingdom 
    sys.path.append('/home/ec2-user/git-repo/pingdom-cli')
    p = pingdom.Pingdom(username='username', password='password', appkey='applicationkey')
    p.pause_check('2477066')

As I said my knowledge is very minimal so I'm sure I've done something obviously wrong, any help would be appreciated.

Cheers.

jto
  • 175
  • 6
  • 21

1 Answers1

1

Instead of import pingdom use import pingdomlib as this is the right name of the library.

import sys
import pingdomlib 
...
p = pingdomlib.Pingdom(username='username', password='password', apikey='applicationkey')
...
omri_saadon
  • 10,193
  • 7
  • 33
  • 58
  • There is no `pause_check()` function. Check it out in the api and correct it accordingly. https://github.com/KennethWilke/PingdomLib/search?utf8=%E2%9C%93&q=pause_check – Mohammad Yusuf Jan 30 '17 at 10:00
  • Hi @omri_saadon thanks for the reply, I tried switching pingdom to pingdomlib and I get the following error: Traceback (most recent call last): File "pingdom.py", line 3, in import pingdomlib ImportError: No module named pingdomlib – jto Jan 30 '17 at 12:25
  • Cheers, I'm really showing my inexperience of Python here - Excuse me! – jto Jan 30 '17 at 12:30
  • I've updated my script to this #!/usr/bin/python import sys import pingdom import pingdomlib sys.path.append('/home/ec2-user/git-repo/pingdom-cli') p=pingdomlib.Pingdom(username='username',password='password',appkey='appkey') p.pause_check('2238054') – jto Jan 30 '17 at 14:20
  • And I now get the following error: TypeError: __init__() got an unexpected keyword argument 'appkey' – jto Jan 30 '17 at 14:22
  • @jto You should change the `appkey` to `apikey`, for more info see [here](https://github.com/KennethWilke/PingdomLib) – omri_saadon Jan 30 '17 at 14:24
  • Woo, thank you! I just need to work on the multi-user authentication section of this script now. You've been a lot of help, thank you! – jto Jan 30 '17 at 14:29