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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
icinga-checks
Merge requests
!48
- add disc check to snmp-synology
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
- add disc check to snmp-synology
feature-synology_disc
into
master
Overview
0
Commits
1
Pipelines
0
Changes
1
Merged
Gottsponer Andrea Leonardo (ag18y076)
requested to merge
feature-synology_disc
into
master
2 years ago
Overview
0
Commits
1
Pipelines
0
Changes
1
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
7f05c501
1 commit,
2 years ago
1 file
+
40
−
9
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
check_snmp_data
+
40
−
9
View file @ 7f05c501
Edit in single-file editor
Open in Web IDE
Show full file
@@ -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
}
"
Loading