Last active
August 29, 2015 13:56
-
-
Save ryanrhanson/9278006 to your computer and use it in GitHub Desktop.
Retrieve all active nimsoft alarms on account
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SoftLayer | |
apiUser = (api username) | |
apiKey = (api key) | |
client=SoftLayer.Client(username=apiUser,api_key=apiKey) | |
acctalarms=client['Account'].getActiveAlarms() | |
for alarm in acctalarms: | |
hostname = client['Monitoring_Robot'].getObject(id=alarm['robotId'],mask="mask[softwareComponent[virtualGuest,hardware]]") | |
if hostname['softwareComponent']['virtualGuest']: | |
print "Hostname: %s" % (hostname['softwareComponent']['virtualGuest']['fullyQualifiedDomainName']) | |
else: | |
print "Hostname: %s" % (hostname['softwareComponent']['hardware']['fullyQualifiedDomainName']) | |
print "Alarm ID: %s" % (alarm['alarmId']) | |
print "Created: %s" % (alarm['createDate']) | |
print "Severity: %s" % (alarm['severity']) | |
print "Message: %s" % (alarm['message']) | |
print "=-=-=-=-=-=" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment