Content-Length: 1622 | pFad | http://github.com/home-assistant-ecosystem/python-netdata/pull/7.patch
thub.com
From 2ce040fd450515917d015b52b18221c3c7dc8546 Mon Sep 17 00:00:00 2001
From: Fabian Affolter
Date: Tue, 16 Jun 2020 11:45:09 +0200
Subject: [PATCH] Update example
---
example.py | 23 ++++-------------------
1 file changed, 4 insertions(+), 19 deletions(-)
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())
--- a PPN by Garber Painting Akron. With Image Size Reduction included!Fetched URL: http://github.com/home-assistant-ecosystem/python-netdata/pull/7.patch
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy