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
7f05c501
Commit
7f05c501
authored
2 years ago
by
Andrea Gottsponer
Browse files
Options
Downloads
Patches
Plain Diff
- add disc check to snmp-synology
parent
6adeaf0f
Branches
Branches containing commit
No related tags found
1 merge request
!48
- add disc check to snmp-synology
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
check_snmp_data
+40
-9
40 additions, 9 deletions
check_snmp_data
with
40 additions
and
9 deletions
check_snmp_data
+
40
−
9
View file @
7f05c501
...
...
@@ -14,7 +14,7 @@
#
# SYNTAX:
# label --> DATA:[method]:label:[text]
# n x data --> DATA:[method]:data:[perf-label]:[oid]:[optional unit]
# n x data --> DATA:[method]:data:[perf-label]:[oid]:[optional unit]
:[loop oid]
#
# DATA:cpu:label:CPU usage
# DATA:cpu:data:cpu-user:1.3.6.1.4.1.2021.11.9.0:%
...
...
@@ -33,6 +33,10 @@
# DATA:synotemp:label:Synology NAS temperature
# DATA:synotemp:data:temp:1.3.6.1.4.1.6574.1.2.0:°C
#
# DATA:disc:label:Disc usage
# DATA:disc:data:disc-free:1.3.6.1.4.1.6574.3.1.1.2::1.3.6.1.4.1.6574.3.1.1.4
# DATA:disc:data:disc-space:1.3.6.1.4.1.6574.3.1.1.2::1.3.6.1.4.1.6574.3.1.1.5
#
# ----------------------------------------------------------------------
# 2020-08-11 <axel.hahn@iml.unibe.ch> initial version
# 2020-08-13 <axel.hahn@iml.unibe.ch> add host in label for counter data
...
...
@@ -45,6 +49,7 @@
ABOUT
=
"SNMP performance data v0.4"
SNMPCOMMUNITY
=
"public"
SNMPVERSION
=
"2c"
SNMPWALK
=
$(
which snmpwalk
)
SNMPGET
=
$(
which snmpget
)
HOSTNAME
=
"127.0.0.1"
...
...
@@ -201,9 +206,30 @@ fi
prflist
=(
$(
_cfg_dataitem 4
)
)
oidlist
=(
$(
_cfg_dataitem 5
)
)
unitlist
=(
$(
_cfg_dataitem 6
)
)
looplist
=(
$(
_cfg_dataitem 7
)
)
# --- check for looplist
if
[
-n
"
$looplist
"
]
;
then
nb
=
`
$SNMPWALK
-OQne
-t
10
-v
$SNMPVERSION
-c
$SNMPCOMMUNITY
$HOSTNAME
${
oidlist
[*]
}
2> /dev/null |
wc
-l
`
declare
-a
tmpPrflist
=()
declare
-a
tmpOidlist
=()
declare
-a
tmpUnitlist
=()
for
i
in
`
seq
1
$nb
`
;
do
for
j
in
`
seq
1
${#
looplist
[@]
}
`
do
tmpPrflist+
=(
"
${
prflist
[
$((
$j
-
1
))
]
}
.
$((
$i
-
1
))
"
)
tmpOidlist+
=(
"
${
looplist
[
$((
$j
-
1
))
]
}
.
$((
$i
-
1
))
"
)
tmpUnitlist+
=(
"
${
unitlist
[
$((
$j
-
1
))
]
}
"
)
done
done
prflist
=(
"
${
tmpPrflist
[@]
}
"
)
oidlist
=(
"
${
tmpOidlist
[@]
}
"
)
unitlist
=(
"
${
tmpUnitlist
[@]
}
"
)
fi
# --- SNPGET to all wanted oids
# --- SNMPGET to all wanted oids
SYNO
=
`
$SNMPGET
-One
-t
10
-v
$SNMPVERSION
-c
$SNMPCOMMUNITY
$HOSTNAME
${
oidlist
[*]
}
2> /dev/null
`
if
[
$?
-ne
0
]
;
then
...
...
@@ -219,13 +245,18 @@ do
value
=
$(
_get
${
oidlist
[
$index
]
}
)
unit
=
"
${
unitlist
[
$index
]
}
"
# handle counter data
if
[
"
$(
_iscounter
${
oidlist
[
$index
]
}
)
"
=
"true"
]
;
then
value2
=
`
ph.perfdeltaspeed
"snmp-data-
${
HOSTNAME
}
-
${
method
}
-
${
label
}
"
$value
`
_wd
"
$(
printf
'%-14s total: %-14s delta: %6s %s per sec'
$label
$value
$value2
$unit
)
"
value
=
$value2
# handle loop data
if
[
-n
"
$looplist
"
]
;
then
_wd
"
$(
printf
'%-14s %s %s'
$label
$value
$unit
)
"
else
_wd
"
$(
printf
'%-14s %s %s'
$label
$value
$unit
)
"
# handle counter data
if
[
"
$(
_iscounter
${
oidlist
[
$index
]
}
)
"
=
"true"
]
;
then
value2
=
`
ph.perfdeltaspeed
"snmp-data-
${
HOSTNAME
}
-
${
method
}
-
${
label
}
"
$value
`
_wd
"
$(
printf
'%-14s total: %-14s delta: %6s %s per sec'
$label
$value
$value2
$unit
)
"
value
=
$value2
else
_wd
"
$(
printf
'%-14s %s %s'
$label
$value
$unit
)
"
fi
fi
ph.perfadd
"
${
label
}
"
"
${
value
}
"
...
...
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