API/Script
Hi I want to create device group named as "Fileserver" in /device/servers This is the first time I am running the script, so could you please check if my script is ok. Also please let me know how I run this script. I am sharing the scriptwith you. #!/bin/env python import requests import json import hashlib import base64 import time import hmac #Account Info AccessId ='TBA' AccessKey ='TBA' Company = 'contoso' #Request Info httpVerb ='POST' resourcePath = '/device/servers' data = '{"name":"Fileserver"}' #Construct URL url = 'https://'+ Company +'.logicmonitor.com/santaba/rest' + resourcePath #Get current time in milliseconds epoch = str(int(time.time() * 1000)) #Concatenate Request details requestVars = httpVerb + epoch + data + resourcePath #Construct signature signature = base64.b64encode(hmac.new(AccessKey,msg=requestVars,digestmod=hashlib.sha256).hexdigest()) #Construct headers auth = 'LMv1 ' + AccessId + ':' + signature + ':' + epoch headers = {'Content-Type':'application/json','Authorization':auth} #Make request response = requests.post(url, data=data, headers=headers) #Print status and body of response print 'Response Status:',response.status_code print 'Response Body:',response.content6Views0likes7CommentsAWS Service Health Eventsource - Report at AWS Device Group Level
Today we were flooded with hundreds of alerts in our alert dashboard. AWS was having an issue in the ap-southeast-1 region with launching new instances. The "AWS Service Health" datasource found this issue and then alerted on it for each instance & ebs volume we had in that region. That was too many alerts, especially since the issue wasn't with our existing devices in that region. I would like this alert to happen on the AWS Device Group itself - per region, so that we can know about it, but it won't generate an excessive number of alerts with the same exact information.3Views0likes4Comments