Skip to content

Commit ec55d2a

Browse files
authored
Update Pure-FA_prtg.py
1 parent 965988e commit ec55d2a

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

Pure-FA_prtg.py

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
## Dependencies
1616
#
1717
# purestorage Pure Storage Python REST Client (https://github.com/purestorage/rest-client)
18+
# peapy From the PRTG internal python libraries
1819
#
1920

2021
import sys
@@ -27,25 +28,26 @@
2728
from paepy.ChannelDefinition import CustomSensorResult
2829

2930
if __name__ == "__main__":
30-
# interpret first command line parameter as json object
31-
data = json.loads(sys.argv[1])
31+
# interpret first command line parameter as json object
32+
data = json.loads(sys.argv[1])
3233

3334
# create sensor result
34-
params = json.loads(data['params'])
35-
result = CustomSensorResult("Pure Storage performance info")
36-
urllib3.disable_warnings()
37-
fa = purestorage.FlashArray(params['addr'], api_token=params['api_token'])
38-
fainfo = fa.get(action='monitor')
39-
fa.invalidate_cookie()
35+
params = json.loads(data['params'])
36+
result = CustomSensorResult("Pure Storage performance info")
37+
urllib3.disable_warnings()
38+
# gat basic statistics from the FlashArray specified in the json object
39+
fa = purestorage.FlashArray(params['addr'], api_token=params['api_token'])
40+
fainfo = fa.get(action='monitor')
41+
fa.invalidate_cookie()
4042

4143
# add primary channel
42-
result.add_channel(channel_name="wr sec", unit="IOPS write", value=fainfo[0]['writes_per_sec'], primary_channel=True)
43-
# add additional channels
44-
result.add_channel(channel_name="rd sec", unit="IOPS read", value=fainfo[0]['reads_per_sec'])
45-
result.add_channel(channel_name="wr latency", unit="usec", value=fainfo[0]['usec_per_write_op'])
46-
result.add_channel(channel_name="rd latency", unit="usec", value=fainfo[0]['usec_per_read_op'])
47-
result.add_channel(channel_name="in sec", unit="BytesBandwidth", value=fainfo[0]['input_per_sec'])
48-
result.add_channel(channel_name="out sec", unit="BytesBandwidth", value=fainfo[0]['output_per_sec'])
49-
result.add_channel(channel_name="q depth", unit="avg queued", value=fainfo[0]['queue_depth'])
50-
# print sensor result to std
51-
print(result.get_json_result())
44+
result.add_channel(channel_name="wr sec", unit="IOPS write", value=fainfo[0]['writes_per_sec'], primary_channel=True)
45+
# add additional channels
46+
result.add_channel(channel_name="rd sec", unit="IOPS read", value=fainfo[0]['reads_per_sec'])
47+
result.add_channel(channel_name="wr latency", unit="usec", value=fainfo[0]['usec_per_write_op'])
48+
result.add_channel(channel_name="rd latency", unit="usec", value=fainfo[0]['usec_per_read_op'])
49+
result.add_channel(channel_name="in sec", unit="BytesBandwidth", value=fainfo[0]['input_per_sec'])
50+
result.add_channel(channel_name="out sec", unit="BytesBandwidth", value=fainfo[0]['output_per_sec'])
51+
result.add_channel(channel_name="q depth", unit="avg queued", value=fainfo[0]['queue_depth'])
52+
# print sensor result to stdout
53+
print(result.get_json_result())

0 commit comments

Comments
 (0)