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

Merge branch 'rem-redundant-hostname-code' into 'main'

Rem Redundant Hostname Code in Script

See merge request !10
parents 5f42a13e bb294cb1
No related branches found
No related tags found
1 merge request!10Rem Redundant Hostname Code in Script
...@@ -10,14 +10,11 @@ ...@@ -10,14 +10,11 @@
declare HW_CONTEXT_SWITCH_RATE=0 declare HW_CONTEXT_SWITCH_RATE=0
declare HW_CONTEXT_SWITCH_INTERVAL=0 declare HW_CONTEXT_SWITCH_INTERVAL=0
declare NODENAME=""
# Gather the metrics # Gather the metrics
function uabrc_hw_gather_data() { function uabrc_hw_gather_data() {
NODENAME="$(hostname -s)"
# Gather the nodes context switching rate from Prometheus # 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) # Convert to an integer (hacky as it doesn't round, but insignificant)
HW_CONTEXT_SWITCH_RATE=${HW_CONTEXT_SWITCH_RATE%.*} 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