def unpause(checkid, uid, passwd, key): c = pingdom.PingdomConnection(uid, passwd, key) c.modify_check(checkid, paused=False) check = c.get_check(checkid) name = check.name result = check.status #if result != "up": # api output buggy - accept raw exception for now # return (True, name, result) return (False, name, result)
def __init__(self): self.uptime_classes = pingdom_settings.UPTIME_CLASSES self.connection = pingdom.PingdomConnection( pingdom_settings.PINGDOM_USERNAME, pingdom_settings.PINGDOM_PASSWORD, pingdom_settings.PINGDOM_APPKEY) self.cache_directory = "cache/" self.data = None self.cdata = None self.redis = redis.Redis(unix_socket_path="/home/redis/redis.sock") self.pipe = self.redis.pipeline(transaction=False) self.stats = {}
def __init__(self): ##Sets the fields that are imported from ansible fields = { "check":{"required":True,"type":"dict", "options":{ "checkName": {"required":True,"type":"str"}, "check_url": {"required":True,"type":"str"}, "content_match": {"required":False,"type":"str"}, "header_type": {"required":False,"type":"str","choices":["Accept","Accept-Charset","Accept-Encoding","aacept-language","Cache-Control","Connection","Cookie","Keep-Alive","Referer"]}, "header": {"required":False,"type":"str"}, "check_interval": {"required":True,"type":"int","choices":[1,5,15,30],"default":1}, "notification_delay": {"required":False,"type":"int","default":3} }}, "user": {"required": True,"type":"str"}, "password": {"required":True,"type":"str"}, "api_key": {"required":True,"type":"str"}, "customer": {"required":False,"type":"str"}, "integrations": {"required":False,"type":"str","choices":["85002"]}, "users": {"required":False,"type":"list","elements":"str"} } ##Set the variables to be used in the function self.module = AnsibleModule(argument_spec=fields) self.checkDetails = self.module.params.get("check") self.userName = self.module.params.get("user") self.password = self.module.params.get("password") self.api_key = self.module.params.get("api_key") try: self.customerName = self.module.params.get("customer") try: self.integration = self.module.params.get("integrations") try: self.users = self.module.params.get("users") self.checkName = '[' + self.customerName.upper() + '] ' + self.checkDetails['name'] connection = pingdom.PingdomConnection(self.userName,self.password,self.api_key) self.json_output = { "check name": self.checkName, "check exists": False, "check updated": False, "check created": False, "changed": False }
import pingdom connection = pingdom.PingdomConnection('*****@*****.**', 'Sc00byD00') connection.apikey = "nog1os9rtnzbr59t18a8q93a68xlwas4" checks = connection.get_all_checks() req = pingdom.PingdomRequest(connnection, ) exit() for check in checks: checkdetails = connection.get_check(check.id) contactids = checkdetails.contactids print checkdetails.name #, checkdetails.contactids for contactid in contactids: print contactid # req = pingdom.PingdomRequest(connection=connection, # resource='/get/resource') # contactlist = {"contactid": contactid} # contact2 = pingdom.PingdomContact(contactlist) # property_names = [p for p in dir(contact2) if isinstance(getattr( # contact2, p), property)] # print contact2.__str__() # contact = pingdom.PingdomContact(contactid) # print contact.name