Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
icinga-checks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
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
IML Open Source
icinga-checks
Commits
5d865639
Commit
5d865639
authored
1 year ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
add detection for disabled hosts; update texts
parent
539fedc7
Branches
Branches containing commit
No related tags found
1 merge request
!176
check_onehost - add detection for disabled hosts; update texts
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
check_onehost
+18
-14
18 additions, 14 deletions
check_onehost
docs/20_Checks/check_onehost.md
+16
-15
16 additions, 15 deletions
docs/20_Checks/check_onehost.md
with
34 additions
and
29 deletions
check_onehost
+
18
−
14
View file @
5d865639
...
...
@@ -10,12 +10,13 @@
# 2023-06-09 v1.0 <axel.hahn@unibe.ch> initial version
# 2023-06-12 v1.1 <axel.hahn@unibe.ch> show message if no sudo permissions on onehost command exist
# 2023-08-23 v1.2 <axel.hahn@unibe.ch> update help; show help without requirements
# 2023-09-15 v1.3 <axel.hahn@unibe.ch> add detection for disabled hosts; update texts
# ======================================================================
.
$(
dirname
$0
)
/inc_pluginfunctions
self_APPVERSION
=
1.
2
self_APPVERSION
=
1.
3
# ----------------------------------------------------------------------
# functions
...
...
@@ -26,13 +27,14 @@ function showHelp(){
cat
<<
EOF
$(
ph.showImlHelpHeader
)
Show count of hosts in OpenNebula and warn if a host is down.
Show count of hosts in OpenNebula and warn if a host is disabled or on error.
It switches to critical if more than a given critical level are not running.
SYNTAX:
$_self
[ -w value -c value -h ]
-w VALUE
cpu usage
warning level (default: 1)
-c VALUE
cpu usage
critical level (default: 2)
-w VALUE warning level (default: 1)
-c VALUE critical level (default: 2)
-h or --help show this help.
PARAMETERS:
...
...
@@ -83,22 +85,24 @@ csvdata=$( echo "$cmdout" | sed -n '2,$p' )
out
=
""
typeset
-i
iTotal
;
iTotal
=
$(
echo
"
$csvdata
"
|
wc
-l
)
typeset
-i
iOn
;
iOn
=
$(
echo
"
$csvdata
"
|
grep
-c
"on$"
)
typeset
-i
iOther
;
iOther
=
$iTotal
-
$iOn
typeset
-i
iDis
;
iDis
=
$(
echo
"
$csvdata
"
|
grep
-c
"dsbl$"
)
typeset
-i
iNotOn
;
iNotOn
=
$iTotal
-
$iOn
typeset
-i
iOther
;
iOther
=
$iTotal
-
$iOn
-
$iDis
ph.perfadd
"total"
"
${
iTotal
}
"
ph.perfadd
"on"
"
${
iOn
}
"
ph.perfadd
"other"
"
${
iOther
}
"
ph.perfadd
"total"
"
${
iTotal
}
"
ph.perfadd
"on"
"
${
iOn
}
"
ph.perfadd
"disabled"
"
${
iDis
}
"
ph.perfadd
"other"
"
${
iOther
}
"
if
[
$iOther
-ge
$iCriticalLimit
]
;
then
out
=
"ERROR: not all hosts are up - count
$iOther
reached critical value
$iCriticalLimit
"
if
[
$iNotOn
-ge
$iCriticalLimit
]
;
then
out
=
"ERROR: not all hosts are up - count
$iNotOn
reached critical value
$iCriticalLimit
"
ph.setStatus
"critical"
elif
[
$i
Other
-ge
$iWarnLimit
]
;
then
out
=
"
ERROR
: not all hosts are up - count
$i
Other
reached
critical
value
$iWarnLimit
"
elif
[
$i
NotOn
-ge
$iWarnLimit
]
;
then
out
=
"
WARNING
: not all hosts are up - count
$i
NotOn
reached
warning
value
$iWarnLimit
"
ph.setStatus
"warning"
fi
ph.status
"ONEHOST - Total:
$iTotal
.. on:
$iOn
.. other:
$iOther
"
ph.status
"ONEHOST - Total:
$iTotal
.. on:
$iOn
..
disabled:
$iDis
...
other:
$iOther
"
echo
"
$cmdout
"
echo
"
$out
"
ph.exit
This diff is collapsed.
Click to expand it.
docs/20_Checks/check_onehost.md
+
16
−
15
View file @
5d865639
...
...
@@ -23,7 +23,7 @@ icingaclient ALL=(ALL) NOPASSWD: /bin/onehost
______________________________________________________________________
CHECK_ONEHOST
v1.
1
v1.
3
(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3
...
...
@@ -31,13 +31,14 @@ Licence: GNU GPL 3
https://os-docs.iml.unibe.ch/icinga-checks/Checks/check_onehost.html
______________________________________________________________________
show count of hosts in OpenNebula and warn if a host is down.
Show count of hosts in OpenNebula and warn if a host is disabled or on error.
It switches to critical if more than a given critical level are not running.
SYNTAX:
check_onehost [ -w value -c value -h ]
-w VALUE
cpu usage
warning level (default: 1)
-c VALUE
cpu usage
critical level (default: 2)
-w VALUE warning level (default: 1)
-c VALUE critical level (default: 2)
-h or --help show this help.
PARAMETERS:
...
...
@@ -51,17 +52,17 @@ check_onehost -c 1 set to critical if the 1st host is off.
## Example
Without parameter
Without parameter we get a warning if the 1st host is disabled or on error.
``./check_onehost``
returns
```
txt
/check_onehost
OK: ONEHOST - Total: 5 .. on: 5 .. other: 0
WARNING: ONEHOST - Total: 5 .. on: 4 .. disabled: 1 ... other: 0
ID,NAME,CLUSTER,TVM,ALLOCATED_CPU,ALLOCATED_MEM,STAT
4,kvm5.backend.one.intra,default,5,600 / 2400 (25%),13G / 503.1G (2%),on
3,kvm4.backend.one.intra,default,5,1100 / 2400 (45%),22G / 503.1G (4%),on
2,kvm3.backend.one.intra,default,8,1150 / 2400 (47%),20G / 251.1G (7%),on
1,kvm2.backend.one.intra,default,6,1000 / 2400 (41%),12G / 188.1G (6%),on
0,kvm1.backend.one.intra,default,8,1350 / 2400 (56%),18.5G / 188.1G (9%),on
|total=5;; on=5;; other=0;;
```
\ No newline at end of file
4,kvm5.example.com,default,11,1930 / 2400 (80%),76G / 503.1G (15%),dsbl
3,kvm4.example.com,default,2,400 / 2400 (16%),5G / 503.1G (0%),on
2,kvm3.example.com,default,9,1600 / 2400 (66%),55G / 251.1G (21%),on
1,kvm2.example.com,default,14,1770 / 2400 (73%),71.5G / 188.1G (38%),on
0,kvm1.example.com,default,16,2380 / 2400 (99%),75G / 188.1G (39%),on
WARNING: not all hosts are up - count 1 reached warning value 1
|total=5;; on=4;; disabled=1;; other=0;;
```
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