Content-Length: 1336 | pFad | http://github.com/home-assistant-ecosystem/python-netdata/pull/7.diff

thub.com diff --git a/example.py b/example.py index a6db274..ed20283 100644 --- a/example.py +++ b/example.py @@ -8,33 +8,18 @@ async def main(): """Get the data from a Netdata instance.""" - with aiohttp.ClientSession() as session: - data = Netdata("localhost", loop, session, data="data") + async with aiohttp.ClientSession() as session: + data = Netdata("localhost", loop, session) + # Get data for the CPU await data.get_data("system.cpu") - print(json.dumps(data.values, indent=4, sort_keys=True)) # Print the current value of the system's CPU print("CPU System:", round(data.values["system"], 2)) - with aiohttp.ClientSession() as session: - data = Netdata("localhost", loop, session, data="alarms") + # Get the alarms which are present await data.get_alarms() - print(data.alarms) - with aiohttp.ClientSession() as session: - data = Netdata("localhost", loop, session) - await data.get_allmetrics() - - print(data.metrics) - - # Print the current value for the system's CPU - print( - "CPU System:", - round(data.metrics["system.cpu"]["dimensions"]["system"]["value"], 2), - ) - - loop = asyncio.get_event_loop() loop.run_until_complete(main())








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/home-assistant-ecosystem/python-netdata/pull/7.diff

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy