Compare commits

...

15 commits

Author SHA1 Message Date
496c45cf39 New changelog 2025-04-20 22:18:37 +02:00
1469a4dd89 Prepare release 2025-04-20 20:53:16 +02:00
2437dfe5bd Merge branch 'master' of salsa.debian.org:nagios-team/nagios-snmp-plugins 2025-04-20 20:46:47 +02:00
25a8e0eb15 Update standards version to 4.7.2, no changes needed. 2025-04-20 20:42:22 +02:00
Bas Couwenberg
8b74a54a65 Fix old FSF address in copyright file. 2025-03-30 07:50:53 +02:00
Bas Couwenberg
0556666c8b Bump Standards-Version to 4.7.2, no changes. 2025-03-20 12:05:53 +01:00
Bas Couwenberg
133cc65a2e Bump Standards-Version to 4.7.0, no changes. 2024-07-28 20:12:13 +02:00
0ce061bcc4 New changelog 2024-07-23 08:00:29 +02:00
6db06234ca Prepare release 2024-07-23 07:45:16 +02:00
608adcbea1 Merge branch 'master' of github.com:waja/nagios-snmp-plugins 2024-07-22 22:35:30 +02:00
5638743330 Adding d/p/25_check_snmp_int_add_metrik from upsgtream 2024-07-22 22:24:52 +02:00
d0702fa34d Adding d/p/24_tcp_udp_ipv4_ipv6 from upsgtream 2024-07-22 22:22:50 +02:00
67af3233b6 Adding d/p/23_check_snmp_int_interface_speed from upsgtream 2024-07-22 22:19:46 +02:00
waja
6d30de762d
Merge pull request #11 from waja/dependabot-github_actions-dawidd6-action-debian-package-1.6.0
build(deps): bump dawidd6/action-debian-package from 1.5.0 to 1.6.0
2024-01-08 09:58:43 +01:00
dependabot[bot]
f82efb477b
build(deps): bump dawidd6/action-debian-package from 1.5.0 to 1.6.0
Bumps [dawidd6/action-debian-package](https://github.com/dawidd6/action-debian-package) from 1.5.0 to 1.6.0.
- [Release notes](https://github.com/dawidd6/action-debian-package/releases)
- [Commits](https://github.com/dawidd6/action-debian-package/compare/v1.5.0...v1.6.0)

---
updated-dependencies:
- dependency-name: dawidd6/action-debian-package
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-08 04:56:31 +00:00
9 changed files with 1052 additions and 52 deletions

View file

@ -27,7 +27,7 @@ jobs:
run: |
sed -i '0,/restricted/s//stable/' debian/changelog
- name: Build Debian package
uses: dawidd6/action-debian-package@v1.5.0
uses: dawidd6/action-debian-package@v1.6.0
with:
artifacts_directory: debian/build/release/
os_distribution: testing

View file

@ -53,7 +53,7 @@ jobs:
run: |
sed -i '0,/restricted/s//stable/' debian/changelog
- name: Build Debian package
uses: dawidd6/action-debian-package@v1.5.0
uses: dawidd6/action-debian-package@v1.6.0
with:
artifacts_directory: debian/build/release/
os_distribution: testing

25
debian/changelog vendored
View file

@ -1,8 +1,29 @@
nagios-snmp-plugins (2.1.0-4) UNRELEASED; urgency=medium
nagios-snmp-plugins (2.1.0-6) UNRELEASED; urgency=medium
*
-- Jan Wagner <waja@cyconet.org> Mon, 23 Jan 2023 14:23:45 +0000
-- Jan Wagner <waja@cyconet.org> Sun, 20 Apr 2025 22:18:26 +0200
nagios-snmp-plugins (2.1.0-5) unstable; urgency=medium
[ Bas Couwenberg ]
* [133cc65] Bump Standards-Version to 4.7.0, no changes.
* [0556666] Bump Standards-Version to 4.7.2, no changes.
* [8b74a54] Fix old FSF address in copyright file.
-- Jan Wagner <waja@cyconet.org> Sun, 20 Apr 2025 18:52:04 +0000
nagios-snmp-plugins (2.1.0-4) unstable; urgency=medium
[ Bas Couwenberg ]
* [13ac6fb] Explicitly enable test-build-twice job.
[ Jan Wagner ]
* [67af323] Adding d/p/23_check_snmp_int_interface_speed from upsgtream
* [d0702fa] Adding d/p/24_tcp_udp_ipv4_ipv6 from upsgtream
* [5638743] Adding d/p/25_check_snmp_int_add_metrik from upsgtream
-- Jan Wagner <waja@cyconet.org> Tue, 23 Jul 2024 05:44:14 +0000
nagios-snmp-plugins (2.1.0-3) unstable; urgency=medium

2
debian/control vendored
View file

@ -4,7 +4,7 @@ Priority: optional
Maintainer: Debian Nagios Maintainer Group <pkg-nagios-devel@lists.alioth.debian.org>
Uploaders: Jan Wagner <waja@cyconet.org>
Build-Depends: debhelper-compat (= 13)
Standards-Version: 4.6.2
Standards-Version: 4.7.2
Vcs-Browser: https://salsa.debian.org/nagios-team/nagios-snmp-plugins
Vcs-Git: https://salsa.debian.org/nagios-team/nagios-snmp-plugins.git
Homepage: https://github.com/SteScho/manubulon-snmp

9
debian/copyright vendored
View file

@ -45,9 +45,8 @@ License: GPL-2
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
On Debian systems, the complete text of the GNU General Public License version
2 can be found in /usr/share/common-licenses/GPL-2 file.
License: GPL-2+
This program is free software; you can redistribute it and/or modify
@ -60,9 +59,5 @@ License: GPL-2+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
.
On Debian systems, the complete text of the GNU General Public License version
2 can be found in /usr/share/common-licenses/GPL-2 file.

View file

@ -0,0 +1,138 @@
diff --git a/doc/04-Plugins.md b/doc/04-Plugins.md
index c08fe9c..bf2a593 100644
--- a/doc/04-Plugins.md
+++ b/doc/04-Plugins.md
@@ -207,13 +207,13 @@ Usage: ./check_snmp_int.pl [-v] -H <host> -C <snmp_community> [-2] | (-l login -
-G : Make the warning and critical levels in Gbps (with -B) or GBps
-M : Make the warning and critical levels in Mbps (with -B) or MBps
-u : Make the warning and critical levels in % of reported interface speed.
--w, --warning=input,output[,error in,error out,discard in,discard out]
+-w, --warning=input,output[,error in,error out,discard in,discard out,interface speed]
warning level for input / output bandwidth (0 for no warning)
- unit depends on B,M,G,u options
+ unit depends on B,M,G,u options and interface speed is in bps
warning for error & discard input / output in error/min (need -q)
--c, --critical=input,output[,error in,error out,discard in,discard out]
+-c, --critical=input,output[,error in,error out,discard in,discard out,interface speed]
critical level for input / output bandwidth (0 for no critical)
- unit depends on B,M,G,u options
+ unit depends on B,M,G,u options and interface speed is in bps
critical for error & discard input / output in error/min (need -q)
-s, --short=int
Make the output shorter : only the first <n> chars of the interface(s)
diff --git a/doc/html/nagios.manubulon.com/snmp_int.html b/doc/html/nagios.manubulon.com/snmp_int.html
index 8274a05..1c5f68f 100644
--- a/doc/html/nagios.manubulon.com/snmp_int.html
+++ b/doc/html/nagios.manubulon.com/snmp_int.html
@@ -337,13 +337,14 @@
<p class="SectionBody">When the extended checks are activated (-q
option), the warning levels are <br>
-w <i>&lt;In bytes&gt;</i>,<i>&lt;Out bytes&gt;</i>,<i>&lt;In error&gt;</i>,<i>&lt;Out
- error&gt;,<i>&lt;In disc&gt;</i>,<i>&lt;Out disc&gt;</i></i> -c
+ error&gt;,<i>&lt;In disc&gt;</i>,<i>&lt;Out disc&gt;</i>,<i>&lt;Interface speed&gt;</i></i> -c
<i>&lt;In warn&gt;</i>,<i>&lt;Out warn&gt;</i>, .....<br>
In error : warn/crit level in inboud <b>error/minute<br>
</b>Out error : warn/crit level in outbound error/minute<b> </b><br>
In disc : warn/crit level in inboud <b>discarded packets/minute<br>
- </b>Out disc : warn/crit level in outbound discarded packets/minute<b>
- </b><br>
+ </b>Out disc : warn/crit level in outbound discarded packets/minute<b> </b><br>
+ Interface speed : warn/crit level of Interface speed <b>discarded bits/second<br>
+ </b>
</p>
<p class="SectionBody"><b>-k</b> : activates the standard usage feature<br>
<b>-q</b> : activates the extended usage<br>
diff --git a/plugins/check_snmp_int.pl b/plugins/check_snmp_int.pl
index 71f8d14..d978c66 100755
--- a/plugins/check_snmp_int.pl
+++ b/plugins/check_snmp_int.pl
@@ -262,11 +262,11 @@ sub help {
-G : Make the warning and critical levels in Gbps (with -B) or GBps
-M : Make the warning and critical levels in Mbps (with -B) or MBps
-u : Make the warning and critical levels in % of reported interface speed.
--w, --warning=input,output[,error in,error out,discard in,discard out]
+-w, --warning=input,output[,error in,error out,discard in,discard out,interface speed]
warning level for input / output bandwidth (0 for no warning)
unit depends on B,M,G,u options
warning for error & discard input / output in error/min (need -q)
--c, --critical=input,output[,error in,error out,discard in,discard out]
+-c, --critical=input,output[,error in,error out,discard in,discard out,interface speed]
critical level for input / output bandwidth (0 for no critical)
unit depends on B,M,G,u options
critical for error & discard input / output in error/min (need -q)
@@ -452,8 +452,8 @@ sub check_options {
}
if (defined($o_checkperf)) {
@o_warn = split(/,/, $o_warn_opt);
- if (defined($o_ext_checkperf) && ($#o_warn != 5)) {
- print "6 warning levels for extended checks \n";
+ if (defined($o_ext_checkperf) && (($#o_warn < 5) || ($#o_warn > 6))) {
+ print "6 or 7 warning levels for extended checks err val: $#o_warn \n";
print_usage();
exit $ERRORS{"UNKNOWN"};
}
@@ -465,8 +465,8 @@ sub check_options {
@o_crit = split(/,/, $o_crit_opt);
#verb(" $o_crit_opt :: $#o_crit : @o_crit");
- if (defined($o_ext_checkperf) && ($#o_crit != 5)) {
- print "6 critical levels for extended checks \n";
+ if (defined($o_ext_checkperf) && (($#o_crit < 5) || ($#o_crit > 6))) {
+ print "6 or 7 critical levels for extended checks err val: $#o_crit \n";
print_usage();
exit $ERRORS{"UNKNOWN"};
}
@@ -476,10 +476,18 @@ sub check_options {
exit $ERRORS{"UNKNOWN"};
}
for (my $i = 0; $i <= $#o_warn; $i++) {
- if (($o_crit[$i] != 0) && ($o_warn[$i] > $o_crit[$i])) {
- print "Warning must be < Critical level \n";
- print_usage();
- exit $ERRORS{"UNKNOWN"};
+ if ($i != 6) {
+ if (($o_crit[$i] != 0) && ($o_warn[$i] > $o_crit[$i])) {
+ print "Warning must be < Critical level \n";
+ print_usage();
+ exit $ERRORS{"UNKNOWN"};
+ }
+ } else {
+ if (($o_crit[$i] != 0) && ($o_warn[$i] < $o_crit[$i])) {
+ print "Warning must be > Critical level \n";
+ print_usage();
+ exit $ERRORS{"UNKNOWN"};
+ }
}
}
if ( (defined($o_meg) && defined($o_gig))
@@ -946,6 +954,18 @@ sub check_options {
}
if ($l == 0 || $l == 1) { $print_out .= $speed_unit; }
}
+ if (defined($o_perfs) && defined($o_ext_checkperf)) {
+ $print_out .= "/";
+ if (defined($o_crit[6]) && ($o_crit[6] != 0) && ($speed_real < $o_crit[6])) {
+ $final_status = 2;
+ $print_out .= sprintf("CRIT %.0fbps", $speed_real);
+ } elsif (defined($o_warn[6]) && ($o_warn[6] != 0) && ($speed_real < $o_warn[6])) {
+ $final_status = ($final_status == 2) ? 2 : 1;
+ $print_out .= sprintf("WARN %.0fbps", $speed_real);
+ } else {
+ $print_out .= sprintf("%.0fbps", $speed_real);
+ }
+ }
$print_out .= ")";
} else { # Return unknown when no data
$print_out .= " No usable data on file (" . $n_rows . " rows) ";
@@ -1039,7 +1059,10 @@ sub check_options {
}
if (defined($o_perfs)) {
$speed_real = "" unless (defined($speed_real));
- $perf_out .= "'" . $descr[$i] . "_speed_bps'=" . $speed_real . " ";
+ $perf_out .= "'" . $descr[$i] . "_speed_bps'=" . $speed_real . ";";
+ $perf_out .= defined($o_warn[6]) ? $o_warn[6] . ";" : ";";
+ $perf_out .= defined($o_crit[6]) ? $o_crit[6] . ";" : ";";
+ $perf_out .= "; ";
}
if (defined($o_weather) && $usable_data == 1) {
$perf_out .= "in=" . sprintf("%.0f", $checkperf_out_raw[0]) . ";;;0;" . sprintf("%.0f", $speed_real / 8) . " ";

761
debian/patches/24_tcp_udp_ipv4_ipv6 vendored Normal file
View file

@ -0,0 +1,761 @@
From 394ade3c6b5816c4cbca09750cb01622d474e508 Mon Sep 17 00:00:00 2001
From: Patrick Grimm <patrick@lunatiki.de>
Date: Sun, 10 Mar 2024 01:56:45 +0100
Subject: [PATCH] add --protocol= setting tcp/udp and IPv4/IPv6 for
boostedge/cpfw/css/css_main/env/int/linkproof_nhr/nsbox/vrrp/win
reworked the patches from
5369da5d2b3e4351e04f016619736f7d03cbcdfd
---
plugins/check_snmp_boostedge.pl | 22 ++++++++++++++++++----
plugins/check_snmp_cpfw.pl | 22 ++++++++++++++++++----
plugins/check_snmp_css.pl | 22 ++++++++++++++++++----
plugins/check_snmp_css_main.pl | 22 ++++++++++++++++++----
plugins/check_snmp_env.pl | 22 ++++++++++++++++++----
plugins/check_snmp_int.pl | 22 ++++++++++++++++++----
plugins/check_snmp_linkproof_nhr.pl | 22 ++++++++++++++++++----
plugins/check_snmp_nsbox.pl | 22 ++++++++++++++++++----
plugins/check_snmp_vrrp.pl | 22 ++++++++++++++++++----
plugins/check_snmp_win.pl | 19 ++++++++++++++++---
10 files changed, 178 insertions(+), 39 deletions(-)
diff --git a/plugins/check_snmp_boostedge.pl b/plugins/check_snmp_boostedge.pl
index 5eaca78..2284379 100755
--- a/plugins/check_snmp_boostedge.pl
+++ b/plugins/check_snmp_boostedge.pl
@@ -43,6 +43,7 @@
my $o_host = undef; # hostname
my $o_community = undef; # community
my $o_port = 161; # port
+my $o_domain = 'udp/ipv4'; # protocol
my $o_help = undef; # wan't some help ?
my $o_verb = undef; # verbose mode
my $o_version = undef; # print version
@@ -121,6 +122,14 @@ sub help {
<privproto> : Priv protocole (des|aes : default des)
-P, --port=PORT
SNMP port (Default 161)
+--protocol=PROTOCOL
+ Network protocol to be used
+ ['udp/ipv4'] : UDP over IPv4
+ 'udp/ipv6' : UDP over IPv6
+ 'tcp/ipv4' : TCP over IPv4
+ 'tcp/ipv6' : TCP over IPv6
+
+ Network protocol (Default udp/ipv4)
-f, --perfparse, --perfdata
Performance data output
-t, --timeout=INTEGER
@@ -144,6 +153,7 @@ sub check_options {
'hostname:s' => \$o_host,
'p:i' => \$o_port,
'port:i' => \$o_port,
+ 'protocol:s' => \$o_domain,
'C:s' => \$o_community,
'community:s' => \$o_community,
'l:s' => \$o_login,
@@ -252,7 +262,8 @@ sub check_options {
-username => $o_login,
-authpassword => $o_passwd,
-authprotocol => $o_authproto,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
} else {
verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto");
@@ -265,7 +276,8 @@ sub check_options {
-authprotocol => $o_authproto,
-privpassword => $o_privpass,
-privprotocol => $o_privproto,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
}
} else {
@@ -278,7 +290,8 @@ sub check_options {
-version => 2,
-community => $o_community,
-port => $o_port,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
} else {
@@ -288,7 +301,8 @@ sub check_options {
-hostname => $o_host,
-community => $o_community,
-port => $o_port,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
}
}
diff --git a/plugins/check_snmp_cpfw.pl b/plugins/check_snmp_cpfw.pl
index b29c3e9..5e3f7f5 100755
--- a/plugins/check_snmp_cpfw.pl
+++ b/plugins/check_snmp_cpfw.pl
@@ -77,6 +77,7 @@
my $o_community = undef; # community
my $o_version2 = undef; # Version 2
my $o_port = 161; # port
+my $o_domain = 'udp/ipv4'; # protocol
my $o_help = undef; # wan't some help ?
my $o_verb = undef; # verbose mode
my $o_version = undef; # print version
@@ -154,6 +155,14 @@ sub help {
performance data output (only works with -c)
-P, --port=PORT
SNMP port (Default 161)
+--protocol=PROTOCOL
+ Network protocol to be used
+ ['udp/ipv4'] : UDP over IPv4
+ 'udp/ipv6' : UDP over IPv6
+ 'tcp/ipv4' : TCP over IPv4
+ 'tcp/ipv6' : TCP over IPv6
+
+ Network protocol (Default udp/ipv4)
-t, --timeout=INTEGER
timeout for SNMP (Default: Nagios default)
-V, --version
@@ -175,6 +184,7 @@ sub check_options {
'hostname:s' => \$o_host,
'P:i' => \$o_port,
'port:i' => \$o_port,
+ 'protocol:s' => \$o_domain,
'C:s' => \$o_community,
'community:s' => \$o_community,
'2' => \$o_version2,
@@ -315,7 +325,8 @@ sub check_options {
-port => $o_port,
-authpassword => $o_passwd,
-authprotocol => $o_authproto,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
} else {
verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto");
@@ -328,7 +339,8 @@ sub check_options {
-authprotocol => $o_authproto,
-privpassword => $o_privpass,
-privprotocol => $o_privproto,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
}
} else {
@@ -341,7 +353,8 @@ sub check_options {
-version => 2,
-community => $o_community,
-port => $o_port,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
} else {
@@ -351,7 +364,8 @@ sub check_options {
-hostname => $o_host,
-community => $o_community,
-port => $o_port,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
}
}
diff --git a/plugins/check_snmp_css.pl b/plugins/check_snmp_css.pl
index 3f375b4..ab7d52f 100755
--- a/plugins/check_snmp_css.pl
+++ b/plugins/check_snmp_css.pl
@@ -40,6 +40,7 @@
my $o_host = undef; # hostname
my $o_community = undef; # community
my $o_port = 161; # port
+my $o_domain = 'udp/ipv4'; # protocol
my $o_help = undef; # wan't some help ?
my $o_verb = undef; # verbose mode
my $o_version = undef; # print version
@@ -141,6 +142,14 @@ sub help {
<privproto> : Priv protocole (des|aes : default des)
-P, --port=PORT
SNMP port (Default 161)
+--protocol=PROTOCOL
+ Network protocol to be used
+ ['udp/ipv4'] : UDP over IPv4
+ 'udp/ipv6' : UDP over IPv6
+ 'tcp/ipv4' : TCP over IPv4
+ 'tcp/ipv6' : TCP over IPv6
+
+ Network protocol (Default udp/ipv4)
-f, --perfparse
Perfparse compatible output
-t, --timeout=INTEGER
@@ -164,6 +173,7 @@ sub check_options {
'hostname:s' => \$o_host,
'p:i' => \$o_port,
'port:i' => \$o_port,
+ 'protocol:s' => \$o_domain,
'C:s' => \$o_community,
'community:s' => \$o_community,
'l:s' => \$o_login,
@@ -331,7 +341,8 @@ sub check_options {
-username => $o_login,
-authpassword => $o_passwd,
-authprotocol => $o_authproto,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
} else {
verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto");
@@ -344,7 +355,8 @@ sub check_options {
-authprotocol => $o_authproto,
-privpassword => $o_privpass,
-privprotocol => $o_privproto,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
}
} else {
@@ -357,7 +369,8 @@ sub check_options {
-version => 2,
-community => $o_community,
-port => $o_port,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
} else {
@@ -367,7 +380,8 @@ sub check_options {
-hostname => $o_host,
-community => $o_community,
-port => $o_port,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
}
}
diff --git a/plugins/check_snmp_css_main.pl b/plugins/check_snmp_css_main.pl
index 0d52694..a74bb31 100755
--- a/plugins/check_snmp_css_main.pl
+++ b/plugins/check_snmp_css_main.pl
@@ -40,6 +40,7 @@
my $o_host = undef; # hostname
my $o_community = undef; # community
my $o_port = 161; # port
+my $o_domain = 'udp/ipv4'; # protocol
my $o_help = undef; # wan't some help ?
my $o_verb = undef; # verbose mode
my $o_version = undef; # print version
@@ -93,6 +94,14 @@ sub help {
<privproto> : Priv protocole (des|aes : default des)
-P, --port=PORT
SNMP port (Default 161)
+--protocol=PROTOCOL
+ Network protocol to be used
+ ['udp/ipv4'] : UDP over IPv4
+ 'udp/ipv6' : UDP over IPv6
+ 'tcp/ipv4' : TCP over IPv4
+ 'tcp/ipv6' : TCP over IPv6
+
+ Network protocol (Default udp/ipv4)
-t, --timeout=INTEGER
timeout for SNMP in seconds (Default: 5)
-V, --version
@@ -114,6 +123,7 @@ sub check_options {
'hostname:s' => \$o_host,
'p:i' => \$o_port,
'port:i' => \$o_port,
+ 'protocol:s' => \$o_domain,
'C:s' => \$o_community,
'community:s' => \$o_community,
'l:s' => \$o_login,
@@ -210,7 +220,8 @@ sub check_options {
-username => $o_login,
-authpassword => $o_passwd,
-authprotocol => $o_authproto,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
} else {
verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto");
@@ -223,7 +234,8 @@ sub check_options {
-authprotocol => $o_authproto,
-privpassword => $o_privpass,
-privprotocol => $o_privproto,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
}
} else {
@@ -236,7 +248,8 @@ sub check_options {
-version => 2,
-community => $o_community,
-port => $o_port,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
} else {
@@ -246,7 +259,8 @@ sub check_options {
-hostname => $o_host,
-community => $o_community,
-port => $o_port,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
}
}
diff --git a/plugins/check_snmp_env.pl b/plugins/check_snmp_env.pl
index 8e15bc0..3624d4f 100755
--- a/plugins/check_snmp_env.pl
+++ b/plugins/check_snmp_env.pl
@@ -172,6 +172,7 @@
my $o_host = undef; # hostname
my $o_community = undef; # community
my $o_port = 161; # port
+my $o_domain = 'udp/ipv4'; # protocol
my $o_help = undef; # wan't some help ?
my $o_verb = undef; # verbose mode
my $o_version = undef; # print version
@@ -242,6 +243,14 @@ sub help {
<privproto> : Priv protocole (des|aes : default des)
-P, --port=PORT
SNMP port (Default 161)
+--protocol=PROTOCOL
+ Network protocol to be used
+ ['udp/ipv4'] : UDP over IPv4
+ 'udp/ipv6' : UDP over IPv6
+ 'tcp/ipv4' : TCP over IPv4
+ 'tcp/ipv6' : TCP over IPv6
+
+ Network protocol (Default udp/ipv4)
-T, --type=cisco|nokia|bc|iron|foundry
Environemental check :
cisco : All Cisco equipements : voltage,temp,fan,power supply
@@ -278,6 +287,7 @@ sub check_options {
'hostname:s' => \$o_host,
'p:i' => \$o_port,
'port:i' => \$o_port,
+ 'protocol:s' => \$o_domain,
'C:s' => \$o_community,
'community:s' => \$o_community,
'l:s' => \$o_login,
@@ -388,7 +398,8 @@ sub check_options {
-username => $o_login,
-authpassword => $o_passwd,
-authprotocol => $o_authproto,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
} else {
verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto");
@@ -401,7 +412,8 @@ sub check_options {
-authprotocol => $o_authproto,
-privpassword => $o_privpass,
-privprotocol => $o_privproto,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
}
} else {
@@ -414,7 +426,8 @@ sub check_options {
-version => 2,
-community => $o_community,
-port => $o_port,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
} else {
@@ -424,7 +437,8 @@ sub check_options {
-hostname => $o_host,
-community => $o_community,
-port => $o_port,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
}
}
diff --git a/plugins/check_snmp_int.pl b/plugins/check_snmp_int.pl
index 71f8d14..b1214e2 100755
--- a/plugins/check_snmp_int.pl
+++ b/plugins/check_snmp_int.pl
@@ -62,6 +62,7 @@
# Standard options
my $o_host = undef; # hostname
my $o_port = 161; # port
+my $o_domain = 'udp/ipv4'; # protocol
my $o_descr = undef; # description filter
my $o_help = undef; # wan't some help ?
my $o_admin = undef; # admin status instead of oper
@@ -208,6 +209,14 @@ sub help {
<privproto> : Priv protocole (des|aes : default des)
-P, --port=PORT
SNMP port (Default 161)
+--protocol=PROTOCOL
+ Network protocol to be used
+ ['udp/ipv4'] : UDP over IPv4
+ 'udp/ipv6' : UDP over IPv6
+ 'tcp/ipv4' : TCP over IPv4
+ 'tcp/ipv6' : TCP over IPv6
+
+ Network protocol (Default udp/ipv4)
-n, --name=NAME
Name in description OID (eth0, ppp0 ...).
This is treated as a regexp : -n eth will match eth0,eth1,...
@@ -296,6 +305,7 @@ sub check_options {
'hostname:s' => \$o_host,
'p:i' => \$o_port,
'port:i' => \$o_port,
+ 'protocol:s' => \$o_domain,
'n:s' => \$o_descr,
'name:s' => \$o_descr,
'N' => \$o_use_ifname,
@@ -536,7 +546,8 @@ sub check_options {
-username => $o_login,
-authpassword => $o_passwd,
-authprotocol => $o_authproto,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
} else {
verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto");
@@ -549,7 +560,8 @@ sub check_options {
-authprotocol => $o_authproto,
-privpassword => $o_privpass,
-privprotocol => $o_privproto,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
}
} else {
@@ -562,7 +574,8 @@ sub check_options {
-version => 2,
-community => $o_community,
-port => $o_port,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
} else {
@@ -572,7 +585,8 @@ sub check_options {
-hostname => $o_host,
-community => $o_community,
-port => $o_port,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
}
}
diff --git a/plugins/check_snmp_linkproof_nhr.pl b/plugins/check_snmp_linkproof_nhr.pl
index b6dba28..d83932e 100755
--- a/plugins/check_snmp_linkproof_nhr.pl
+++ b/plugins/check_snmp_linkproof_nhr.pl
@@ -34,6 +34,7 @@
my $o_host = undef; # hostname
my $o_community = undef; # community
my $o_port = 161; # port
+my $o_domain = 'udp/ipv4'; # protocol
my $o_help = undef; # wan't some help ?
my $o_verb = undef; # verbose mode
my $o_version = undef; # print version
@@ -98,6 +99,14 @@ sub help {
<privproto> : Priv protocole (des|aes : default des)
-P, --port=PORT
SNMP port (Default 161)
+--protocol=PROTOCOL
+ Network protocol to be used
+ ['udp/ipv4'] : UDP over IPv4
+ 'udp/ipv6' : UDP over IPv6
+ 'tcp/ipv4' : TCP over IPv4
+ 'tcp/ipv6' : TCP over IPv6
+
+ Network protocol (Default udp/ipv4)
-f, --perfparse, --perfdata
Performance data output
-t, --timeout=INTEGER
@@ -121,6 +130,7 @@ sub check_options {
'hostname:s' => \$o_host,
'p:i' => \$o_port,
'port:i' => \$o_port,
+ 'protocol:s' => \$o_domain,
'C:s' => \$o_community,
'community:s' => \$o_community,
'l:s' => \$o_login,
@@ -215,7 +225,8 @@ sub check_options {
-username => $o_login,
-authpassword => $o_passwd,
-authprotocol => $o_authproto,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
} else {
verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto");
@@ -228,7 +239,8 @@ sub check_options {
-authprotocol => $o_authproto,
-privpassword => $o_privpass,
-privprotocol => $o_privproto,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
}
} else {
@@ -241,7 +253,8 @@ sub check_options {
-version => 2,
-community => $o_community,
-port => $o_port,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
} else {
@@ -251,7 +264,8 @@ sub check_options {
-hostname => $o_host,
-community => $o_community,
-port => $o_port,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
}
}
diff --git a/plugins/check_snmp_nsbox.pl b/plugins/check_snmp_nsbox.pl
index 97da635..3e7bfcb 100755
--- a/plugins/check_snmp_nsbox.pl
+++ b/plugins/check_snmp_nsbox.pl
@@ -42,6 +42,7 @@
my $o_host = undef; # hostname
my $o_community = undef; # community
my $o_port = 161; # port
+my $o_domain = 'udp/ipv4'; # protocol
my $o_help = undef; # wan't some help ?
my $o_verb = undef; # verbose mode
my $o_version = undef; # print version
@@ -125,6 +126,14 @@ sub help {
number of diode and vhost that must be up.
-P, --port=PORT
SNMP port (Default 161)
+--protocol=PROTOCOL
+ Network protocol to be used
+ ['udp/ipv4'] : UDP over IPv4
+ 'udp/ipv6' : UDP over IPv6
+ 'tcp/ipv4' : TCP over IPv4
+ 'tcp/ipv6' : TCP over IPv6
+
+ Network protocol (Default udp/ipv4)
-f, --perfparse, --perfdata
Performance data output
-t, --timeout=INTEGER
@@ -148,6 +157,7 @@ sub check_options {
'hostname:s' => \$o_host,
'p:i' => \$o_port,
'port:i' => \$o_port,
+ 'protocol:s' => \$o_domain,
'C:s' => \$o_community,
'community:s' => \$o_community,
'l:s' => \$o_login,
@@ -270,7 +280,8 @@ sub check_options {
-username => $o_login,
-authpassword => $o_passwd,
-authprotocol => $o_authproto,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
} else {
verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto");
@@ -283,7 +294,8 @@ sub check_options {
-authprotocol => $o_authproto,
-privpassword => $o_privpass,
-privprotocol => $o_privproto,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
}
} else {
@@ -296,7 +308,8 @@ sub check_options {
-version => 2,
-community => $o_community,
-port => $o_port,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
} else {
@@ -306,7 +319,8 @@ sub check_options {
-hostname => $o_host,
-community => $o_community,
-port => $o_port,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
}
}
diff --git a/plugins/check_snmp_vrrp.pl b/plugins/check_snmp_vrrp.pl
index b6d4d44..f9c19ec 100755
--- a/plugins/check_snmp_vrrp.pl
+++ b/plugins/check_snmp_vrrp.pl
@@ -89,6 +89,7 @@
my $o_community = undef; # community
my $o_version2 = undef; #use snmp v2c
my $o_port = 161; # port
+my $o_domain = 'udp/ipv4'; # protocol
my $o_help = undef; # wan't some help ?
my $o_verb = undef; # verbose mode
my $o_version = undef; # print version
@@ -147,6 +148,14 @@ sub help {
<privproto> : Priv protocole (des|aes : default des)
-P, --port=PORT
SNMP port (Default 161)
+--protocol=PROTOCOL
+ Network protocol to be used
+ ['udp/ipv4'] : UDP over IPv4
+ 'udp/ipv6' : UDP over IPv6
+ 'tcp/ipv4' : TCP over IPv4
+ 'tcp/ipv6' : TCP over IPv6
+
+ Network protocol (Default udp/ipv4)
-T, --type=<nokia|alteon|lp|nsc|ipso>
Type of vrrp router to check
nokia (default) : Nokia vrrp. Should be working for most vrrp routers
@@ -187,6 +196,7 @@ sub check_options {
'hostname:s' => \$o_host,
'p:i' => \$o_port,
'port:i' => \$o_port,
+ 'protocol:s' => \$o_domain,
'C:s' => \$o_community,
'community:s' => \$o_community,
't:i' => \$o_timeout,
@@ -317,7 +327,8 @@ sub check_options {
-authpassword => $o_passwd,
-authprotocol => $o_authproto,
-port => $o_port,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
} else {
verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto");
@@ -330,7 +341,8 @@ sub check_options {
-privpassword => $o_privpass,
-privprotocol => $o_privproto,
-port => $o_port,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
}
} else {
@@ -343,7 +355,8 @@ sub check_options {
-version => 2,
-community => $o_community,
-port => $o_port,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
} else {
@@ -353,7 +366,8 @@ sub check_options {
-hostname => $o_host,
-community => $o_community,
-port => $o_port,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
}
}
diff --git a/plugins/check_snmp_win.pl b/plugins/check_snmp_win.pl
index c5cb573..1240b46 100755
--- a/plugins/check_snmp_win.pl
+++ b/plugins/check_snmp_win.pl
@@ -50,6 +50,7 @@
my $o_host = undef; # hostname
my $o_community = undef; # community
my $o_port = 161; # port
+my $o_domain = 'udp/ipv4'; # protocol
my $o_version2 = undef; # use snmp v2c
my $o_descr = undef; # description filter
my @o_descrL = undef; # Service descriprion list.
@@ -115,6 +116,14 @@ sub help {
Password for snmpv3 authentication
-p, --port=PORT
SNMP port (Default 161)
+--protocol=PROTOCOL
+ Network protocol to be used
+ ['udp/ipv4'] : UDP over IPv4
+ 'udp/ipv6' : UDP over IPv6
+ 'tcp/ipv4' : TCP over IPv4
+ 'tcp/ipv6' : TCP over IPv6
+
+ Network protocol (Default udp/ipv4)
-T, --type=service
Check type :
- service (default) checks service
@@ -173,6 +182,7 @@ sub check_options {
'hostname:s' => \$o_host,
'p:i' => \$o_port,
'port:i' => \$o_port,
+ 'protocol:s' => \$o_domain,
'C:s' => \$o_community,
'community:s' => \$o_community,
'l:s' => \$o_login,
@@ -265,7 +275,8 @@ sub check_options {
-authpassword => $o_passwd,
-authprotocol => 'md5',
-privpassword => $o_passwd,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
} else {
if (defined($o_version2)) {
@@ -276,7 +287,8 @@ sub check_options {
-version => 2,
-community => $o_community,
-port => $o_port,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
} else {
@@ -285,7 +297,8 @@ sub check_options {
-hostname => $o_host,
-community => $o_community,
-port => $o_port,
- -timeout => $o_timeout
+ -timeout => $o_timeout,
+ -domain => $o_domain
);
}
}

View file

@ -0,0 +1,82 @@
From a0f606c2c29d1f5588fab0b464a7e905f3872255 Mon Sep 17 00:00:00 2001
From: Patrick Grimm <patrick@lunatiki.de>
Date: Mon, 11 Mar 2024 18:28:15 +0100
Subject: [PATCH] add metrik for Interface speed K|M|G Bits/s and more comments
---
doc/04-Plugins.md | 2 ++
plugins/check_snmp_int.pl | 20 ++++++++++++--------
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/doc/04-Plugins.md b/doc/04-Plugins.md
index bf2a593..21b672a 100644
--- a/doc/04-Plugins.md
+++ b/doc/04-Plugins.md
@@ -211,10 +211,12 @@ Usage: ./check_snmp_int.pl [-v] -H <host> -C <snmp_community> [-2] | (-l login -
warning level for input / output bandwidth (0 for no warning)
unit depends on B,M,G,u options and interface speed is in bps
warning for error & discard input / output in error/min (need -q)
+ warning level for interface speed only in K|M|G Bits/s (0 for no warning)
-c, --critical=input,output[,error in,error out,discard in,discard out,interface speed]
critical level for input / output bandwidth (0 for no critical)
unit depends on B,M,G,u options and interface speed is in bps
critical for error & discard input / output in error/min (need -q)
+ critical level for interface speed only in K|M|G Bits/s (0 for no critical)
-s, --short=int
Make the output shorter : only the first <n> chars of the interface(s)
If the number is negative, then get the <n> LAST caracters.
diff --git a/plugins/check_snmp_int.pl b/plugins/check_snmp_int.pl
index d978c66..fd45a61 100755
--- a/plugins/check_snmp_int.pl
+++ b/plugins/check_snmp_int.pl
@@ -266,10 +266,12 @@ sub help {
warning level for input / output bandwidth (0 for no warning)
unit depends on B,M,G,u options
warning for error & discard input / output in error/min (need -q)
+ warning level for interface speed only in K|M|G Bits/s (0 for no warning)
-c, --critical=input,output[,error in,error out,discard in,discard out,interface speed]
critical level for input / output bandwidth (0 for no critical)
unit depends on B,M,G,u options
critical for error & discard input / output in error/min (need -q)
+ critical level for interface speed only in K|M|G Bits/s (0 for no critical)
-s, --short=int
Make the output shorter : only the first <n> chars of the interface(s)
If the number is negative, then get the <n> LAST caracters.
@@ -955,16 +957,18 @@ sub check_options {
if ($l == 0 || $l == 1) { $print_out .= $speed_unit; }
}
if (defined($o_perfs) && defined($o_ext_checkperf)) {
+ my $warn_factor = (defined($o_meg)) ? 1000000 : (defined($o_gig)) ? 1000000000 : 1000;
$print_out .= "/";
- if (defined($o_crit[6]) && ($o_crit[6] != 0) && ($speed_real < $o_crit[6])) {
+ if (defined($o_crit[6]) && ($o_crit[6] != 0) && ($speed_real / $warn_factor < $o_crit[6])) {
$final_status = 2;
- $print_out .= sprintf("CRIT %.0fbps", $speed_real);
- } elsif (defined($o_warn[6]) && ($o_warn[6] != 0) && ($speed_real < $o_warn[6])) {
+ $print_out .= sprintf("CRIT %.0f", $speed_real / $warn_factor);
+ } elsif (defined($o_warn[6]) && ($o_warn[6] != 0) && ($speed_real / $warn_factor < $o_warn[6])) {
$final_status = ($final_status == 2) ? 2 : 1;
- $print_out .= sprintf("WARN %.0fbps", $speed_real);
+ $print_out .= sprintf("WARN %.0f", $speed_real / $warn_factor);
} else {
- $print_out .= sprintf("%.0fbps", $speed_real);
+ $print_out .= sprintf("%.0f", $speed_real / $warn_factor);
}
+ $print_out .= (defined($o_meg)) ? "Mbps" : (defined($o_gig)) ? "Gbps" : "kbps";
}
$print_out .= ")";
} else { # Return unknown when no data
@@ -1058,10 +1062,10 @@ sub check_options {
$perf_out .= "'" . $descr[$i] . "_out_discard'=" . $$result{ $oid_perf_outdisc[$i] } . "c ";
}
if (defined($o_perfs)) {
- $speed_real = "" unless (defined($speed_real));
+ my $warn_factor = (defined($o_meg)) ? 1000000 : (defined($o_gig)) ? 1000000000 : 1000;
$perf_out .= "'" . $descr[$i] . "_speed_bps'=" . $speed_real . ";";
- $perf_out .= defined($o_warn[6]) ? $o_warn[6] . ";" : ";";
- $perf_out .= defined($o_crit[6]) ? $o_crit[6] . ";" : ";";
+ $perf_out .= defined($o_warn[6]) ? $o_warn[6] * $warn_factor . ";" : ";";
+ $perf_out .= defined($o_crit[6]) ? $o_crit[6] * $warn_factor . ";" : ";";
$perf_out .= "; ";
}
if (defined($o_weather) && $usable_data == 1) {

View file

@ -11,5 +11,8 @@
20_check_snmp_int_avaid_huge_amount_of_regex
21_check_snmp_load_update_fortiswitch_and_fortigate4.3
22_check_snmp_storage_fix_space_btrfs
23_check_snmp_int_interface_speed
24_tcp_udp_ipv4_ipv6
25_check_snmp_int_add_metrik
50_disable_epn
51_fix_privacy_doc