diff --git a/uabrc_hw.nhc b/uabrc_hw.nhc index c5663ccdeb7fb9a45d46384fd83e4a645dac2e65..96740f6ff3fcb8096668dabd3c8eb1f24324af83 100644 --- a/uabrc_hw.nhc +++ b/uabrc_hw.nhc @@ -10,14 +10,11 @@ declare HW_CONTEXT_SWITCH_RATE=0 declare HW_CONTEXT_SWITCH_INTERVAL=0 -declare NODENAME="" # Gather the metrics function uabrc_hw_gather_data() { - NODENAME="$(hostname -s)" - # Gather the nodes context switching rate from Prometheus - HW_CONTEXT_SWITCH_RATE=$(curl -fs --data-urlencode "query=irate(node_context_switches_total{job=\"compute-node\",name=\"$NODENAME\"}[$HW_CONTEXT_SWITCH_INTERVAL])" http://nagios.rc.uab.edu:9090/api/v1/query | jq -r '.data.result[] | .value[1]') + HW_CONTEXT_SWITCH_RATE=$(curl -fs --data-urlencode "query=irate(node_context_switches_total{job=\"compute-node\",name=\"$HOSTNAME_S\"}[$HW_CONTEXT_SWITCH_INTERVAL])" http://nagios.rc.uab.edu:9090/api/v1/query | jq -r '.data.result[] | .value[1]') # Convert to an integer (hacky as it doesn't round, but insignificant) HW_CONTEXT_SWITCH_RATE=${HW_CONTEXT_SWITCH_RATE%.*} }