Skip to content
Snippets Groups Projects
Commit bb294cb1 authored by Mike Hanby's avatar Mike Hanby
Browse files

Rem Redundant Hostname Code in Script

NHC function [nhcmain_init_env()](https://github.com/mej/nhc/blob/master/nhc#L210) already initiallizes a variable containing the short hostname `HOSTNAME_S`.

The merge removes `NODENAME` and related code in favor of `$HOSTNAME_S`
parent 5f42a13e
No related branches found
No related tags found
1 merge request!10Rem Redundant Hostname Code in Script
......@@ -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%.*}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment