|
15 | 15 | ## Dependencies |
16 | 16 | # |
17 | 17 | # purestorage Pure Storage Python REST Client (https://github.com/purestorage/rest-client) |
| 18 | +# peapy From the PRTG internal python libraries |
18 | 19 | # |
19 | 20 |
|
20 | 21 | import sys |
|
27 | 28 | from paepy.ChannelDefinition import CustomSensorResult |
28 | 29 |
|
29 | 30 | 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]) |
32 | 33 |
|
33 | 34 | # 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() |
40 | 42 |
|
41 | 43 | # 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