Skip to content

Commit 3d86911

Browse files
Corrected the disk monitoring example
1 parent 4e2d587 commit 3d86911

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ interval.
8686
partitions = psutil.disk_partitions()
8787
for p in partitions:
8888
instance_name = p.device
89-
usage = psutil.disk_usage(instance_name).__dict__
89+
usage = psutil.disk_usage(instance_name)._asdict()
9090
# Create the instance object for every device. Name should not have the
9191
# special characters so replacing it with the '-'.
9292
instance = DataSourceInstance(name=instance_name.replace('/', '-'),

example/disk_metrics.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
import logging
22
import os
3-
import sys
43
import time
54

65
import psutil as psutil
76

8-
sys.path.append("..")
97
import logicmonitor_api_sdk
8+
from logicmonitor_api_sdk.api.metrics import Metrics
109
from logicmonitor_api_sdk.api.response_interface import ResonseInterface
1110
from logicmonitor_api_sdk.models import Resource, DataSource, DataPoint, \
1211
DataSourceInstance
1312

14-
from logicmonitor_api_sdk.api.metrics import Metrics
15-
1613
logger = logging.getLogger('lmingest.api')
1714
logger.setLevel(logging.INFO)
1815

@@ -48,7 +45,7 @@ def MetricRequest():
4845
for p in partitions:
4946
# Using the device as instance name. We can use the mountpoint as well.
5047
instance_name = p.device
51-
usage = psutil.disk_usage(instance_name).__dict__
48+
usage = psutil.disk_usage(instance_name)._asdict()
5249
# Create the instance object for every device. Name should not have the
5350
# special characters so replacing it with the '-'.
5451
instance = DataSourceInstance(name=instance_name.replace('/', '-'),

0 commit comments

Comments
 (0)