Skip to content

Commit fb5987c

Browse files
committed
Add new options
1 parent 9d77916 commit fb5987c

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

example.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,29 @@
1313
async def main():
1414
"""Get the data from a Netdata instance."""
1515
with aiohttp.ClientSession() as session:
16-
data = Netdata('localhost', 'system.cpu', loop, session)
17-
await data.async_get_data()
16+
data = Netdata('localhost', loop, session, data='data')
17+
await data.get_data('system.cpu')
1818

1919
print(json.dumps(data.values, indent=4, sort_keys=True))
2020

2121
# Print the current value of the system's CPU
2222
print("CPU System:", round(data.values['system'], 2))
2323

24+
with aiohttp.ClientSession() as session:
25+
data = Netdata('localhost', loop, session, data='alarms')
26+
await data.get_alarms()
27+
28+
print(data.alarms)
29+
30+
with aiohttp.ClientSession() as session:
31+
data = Netdata('localhost', loop, session)
32+
await data.get_allmetrics()
33+
34+
print(data.metrics)
35+
36+
# Print the current value for the system's CPU
37+
print("CPU System:", round(data.metrics['system.cpu']
38+
['dimensions']['system']['value'], 2))
2439

2540
loop = asyncio.get_event_loop()
2641
loop.run_until_complete(main())

0 commit comments

Comments
 (0)