forked from stfc/telegraf-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmetrics-influxdb-condor-wn-echo
executable file
·34 lines (28 loc) · 1.34 KB
/
metrics-influxdb-condor-wn-echo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/python
import classad
import htcondor
coll = htcondor.Collector()
results = coll.query(htcondor.AdTypes.Startd, 'PartitionableSlot == TRUE', ["ECHO_XROOTD_GATEWAY_STATUS", "ECHO_XROOTD_PROXY_STATUS"])
echoXrootdGatewayGood = 0
echoXrootdGatewayBad = 0
echoXrootdGatewayNone = 0
echoXrootdProxyGood = 0
echoXrootdProxyBad = 0
echoXrootdProxyNone = 0
for result in results:
if 'ECHO_XROOTD_GATEWAY_STATUS' in result:
if result['ECHO_XROOTD_GATEWAY_STATUS'] == 'Healthy':
echoXrootdGatewayGood += 1
elif result['ECHO_XROOTD_GATEWAY_STATUS'] == 'Unhealthy':
echoXrootdGatewayBad += 1
elif result['ECHO_XROOTD_GATEWAY_STATUS'] == 'None':
echoXrootdGatewayNone += 1
if 'ECHO_XROOTD_PROXY_STATUS' in result:
if result['ECHO_XROOTD_PROXY_STATUS'] == 'Healthy':
echoXrootdProxyGood += 1
elif result['ECHO_XROOTD_PROXY_STATUS'] == 'Unhealthy':
echoXrootdProxyBad += 1
elif result['ECHO_XROOTD_PROXY_STATUS'] == 'None':
echoXrootdProxyNone += 1
print 'wn_gateways,type=xrootd_gateway healthy=%d,unhealthy=%d,notapplicable=%d' % (echoXrootdGatewayGood, echoXrootdGatewayBad, echoXrootdGatewayNone)
print 'wn_gateways,type=xrootd_proxy healthy=%d,unhealthy=%d,notapplicable=%d' % (echoXrootdProxyGood, echoXrootdProxyBad, echoXrootdProxyNone)