Created
July 29, 2016 01:46
-
-
Save tonybaloney/9feacfab2c2c3050aabe648d9956c577 to your computer and use it in GitHub Desktop.
This file contains 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
from sciencelogic.client import Client | |
from pprint import pprint | |
c = Client('jazz', 'hands!', 'https://au-monitoring.mcp-services.net/') | |
# API details | |
print(c.sysinfo) | |
# Get the first device | |
devices = c.devices(details=True) | |
for d in devices: | |
print(d.details) | |
# Custom attribute | |
target_server_id = '56a20d29-95cc-46b8-b43c-41a96be18ace' | |
# Match by custom attribute | |
d1 = [device for device in devices | |
if device.details['c-server-id'] == target_server_id][0] | |
# Get the details of the client | |
print(d1.details) | |
# Get a list of available performance counters | |
counters = d1.performance_counters() | |
print ("Available counters") | |
for counter in counters: | |
print("%s" % (counter.name())) | |
# Get historic performance data of the first counter | |
data = counters[0].get_presentations()[0].get_data() | |
pprint(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment