Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
rc-nhc
Manage
Activity
Members
Labels
Plan
Issues
2
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
rc
rc-nhc
Commits
b9ac20aa
Commit
b9ac20aa
authored
1 year ago
by
Mike Hanby
Browse files
Options
Downloads
Plain Diff
Merge branch 'test-checkin-of-script' into 'main'
Test checkin of script See merge request
!8
parents
37b5e002
23188c05
No related branches found
No related tags found
1 merge request
!8
Remove debug code from uabrc_hw.nhc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
uabrc_hw.nhc
+12
-8
12 additions, 8 deletions
uabrc_hw.nhc
with
12 additions
and
8 deletions
uabrc_hw.nhc
+
12
−
8
View file @
b9ac20aa
...
@@ -5,20 +5,28 @@
...
@@ -5,20 +5,28 @@
#
#
# Copyright and/or license information if different from upstream
# Copyright and/or license information if different from upstream
#
#
# Requires 'curl' and 'jq'
#
declare HW_CONTEXT_SWITCH_RATE=0
declare HW_CONTEXT_SWITCH_RATE=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() {
# HW_CONTEXT_SWITCH_RATE=$(curl --silent http://localhost:9100/metrics | grep ^node_context_switches_total | awk '{print $2}' | awk '{printf("%d\n", $1*1e$2)}')
NODENAME="$(hostname -s)"
HW_CONTEXT_SWITCH_RATE=$(curl -fs --data-urlencode 'query=snode_context_switches_total{job="compute-node",name="c0159"}(30m)' https://nagios.rc.uab.edu:9090/api/v1/query | jq -r '.data.result[] | [.metric.container_name, .metric.namespace, .value[1] ] | @csv')
# 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]')
# Convert to an integer (hacky as it doesn't round, but insignificant)
HW_CONTEXT_SWITCH_RATE=${HW_CONTEXT_SWITCH_RATE%.*}
}
}
curl -fs --data-urlencode 'query=snode_context_switches_total{job="compute-node",name="c0159"}(30m)' https://nagios.rc.uab.edu:9090/api/v1/query | jq -r '.data.result[] | [.metric.container_name, .metric.namespace, .value[1] ] | @csv'
# Check that total context switches are less than max context switches ($1)
# Check that total context switches are less than max context switches ($1)
# The total context switches is collected from Prometheus Node Exporter
# The total context switches is collected from Prometheus Node Exporter
function uabrc_check_
HW_CONTEXT_SWITCH_RATE
() {
function uabrc_check_
hw_context_switch_rate
() {
local CONTEXT_SWITCH_RATE_MAX="$1"
local CONTEXT_SWITCH_RATE_MAX="$1"
HW_CONTEXT_SWITCH_INTERVAL="$2"
if [[ $HW_CONTEXT_SWITCH_RATE -eq 0 ]]; then
if [[ $HW_CONTEXT_SWITCH_RATE -eq 0 ]]; then
uabrc_hw_gather_data
uabrc_hw_gather_data
...
@@ -28,8 +36,4 @@ function uabrc_check_HW_CONTEXT_SWITCH_RATE() {
...
@@ -28,8 +36,4 @@ function uabrc_check_HW_CONTEXT_SWITCH_RATE() {
die 1 "$FUNCNAME: Total Context Switches ($HW_CONTEXT_SWITCH_RATE) greater than maximum allowed ($CONTEXT_SWITCH_RATE_MAX)."
die 1 "$FUNCNAME: Total Context Switches ($HW_CONTEXT_SWITCH_RATE) greater than maximum allowed ($CONTEXT_SWITCH_RATE_MAX)."
return 1
return 1
fi
fi
echo "HW_CONTEXT_SWITCH_RATE: $HW_CONTEXT_SWITCH_RATE"
echo "CONTEXT_SWITCH_RATE_MAX: $CONTEXT_SWITCH_RATE_MAX"
}
}
uabrc_check_HW_CONTEXT_SWITCH_RATE $1
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment