Coder Social home page Coder Social logo

stescho / manubulon-snmp Goto Github PK

View Code? Open in Web Editor NEW
72.0 16.0 71.0 596 KB

Set of Icinga/Nagios plugins to check hosts and hardware with the SNMP protocol.

License: GNU General Public License v2.0

Perl 97.89% Shell 2.11%
snmp perl icinga icinga2 plugins

manubulon-snmp's Introduction

Manubulon SNMP Plugins

Table of Contents

  1. About
  2. License
  3. Support
  4. Requirements
  5. Installation
  6. Configuration
  7. FAQ
  8. Thanks
  9. Contributing

About

Manubulon SNMP plugins is a set of Icinga/Nagios plugins to check hosts/devices using the SNMP protocol.

Plugin Overview

Plugin Description
check_snmp_storage Storage checks (disks, swap, memory, etc.)
check_snmp_int Interface states, usage on hosts, switches, routers, etc.
check_snmp_process Running processes, their number, used CPU and memory.
check_snmp_load Load/CPU checks
check_snmp_mem Memory and swap usage
check_snmp_env Environmental status of fan, temp, power supplies.
check_snmp_vrrp Interface state of a VRRP cluster
check_snmp_cpfw Checkpoint Firewall-1 status
check_snmp_win Windows services
check_snmp_css CSS service states
check_snmp_nsbox Nsbox VHost and diode status
check_snmp_boostedge Boostedge services
check_snmp_linkproof_ndr Linkproof NHR

License

These plugins are licensed under the terms of the GNU General Public License. You will find a copy of this license in the LICENSE file included in the source package.

Support

Requirements

Installation

Detailed installation instructions can be found here.

Configuration

Proceed here to get details on the configuration with Icinga 2, Icinga 1.x, etc.

FAQ

Thanks

Patrick Proy for creating and maintaining the original plugins. Michael Friedrich for maintaing the CVS import and adding community patches.

Contributing

Fork this repository on GitHub and send in a PR.

There's a .perltidyrc file in the main repository tree. If you are uncertain about the coding style, create your patch and then run:

$ perltidy -b plugins/*.pl

This requires the perltidy module being installed.

manubulon-snmp's People

Contributors

araujorm avatar casvcasv avatar darksoul42 avatar db-cl avatar deantwo avatar dnsmichi avatar haxk20 avatar jimbobmcgee avatar jochenfriedrich avatar kwork-er avatar miken32 avatar mj84 avatar morgajel avatar pasancario avatar patrickpr avatar pgranado avatar phsm avatar pszafer avatar sbraz avatar spali avatar stargieg avatar stescho avatar stromvirvel avatar theasylum-dk avatar thecry avatar virtualtam avatar waja avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

manubulon-snmp's Issues

check_snmp_load.pl with -T netsl uses wrong oid

Using the latest version from git I get this:

# ./check_snmp_load.pl -v -H habocp1 -C public -2 -T netsl -w 5,5,4 -c 7,7,5
Alarm in 5 seconds
SNMP v2c login
Checking linux load
ERROR: Description table : The requested table is empty or does not exist.

And that's because the wrong oid is requested.

 00:00:00.000000 5a:61:54:8f:4c:42 > ac:1f:6b:28:03:c0, ethertype IPv4 (0x0800), length 87: 10.10.8.17.33869 > 10.10.10.230.161:  GetBulk(30)  N=0 M=25 .1.3.6.1.2.1.25.3.3.1.1

If I'd request the right oid I do get an answer:

# snmpwalk -v2c -c public habocp1 .1.3.6.1.4.1.2021.10.1.3.3                
iso.3.6.1.4.1.2021.10.1.3.3 = STRING: "0.28"

Reading the code:

# Generic with host-ressource-mib                                                                                              
my $base_proc = "1.3.6.1.2.1.25.3.3.1";      # oid for all proc info                                                           
my $proc_id   = "1.3.6.1.2.1.25.3.3.1.1";    # list of processors (product ID)                                                 
my $proc_load = "1.3.6.1.2.1.25.3.3.1.2";    # %time the proc was not idle over last minute                                    
                                                                                                                               
# Linux load                                                                                                                   
                                                                                                                               
my $linload_table = "1.3.6.1.4.1.2021.10.1";      # net-snmp load table                                                        
my $linload_name  = "1.3.6.1.4.1.2021.10.1.2";    # text 'Load-1','Load-5', 'Load-15'                                          
my $linload_load  = "1.3.6.1.4.1.2021.10.1.3";    # effective load table                                                       

check_snmp_load.pl => SNMPv3 do not use the -p (port) option

Hi,

I'm not sure if it is a bug or an intentional behavior but the check_snmp_load (and maybe others) plugin is not using the -p (port) option when using SNMPv3

I made a few modifications and it's working now (at least for me).

Before :

if (defined($o_login) && defined($o_passwd)) {

    # SNMPv3 login
    verb("SNMPv3 login");
    if (!defined($o_privpass)) {
        verb("SNMPv3 AuthNoPriv login : $o_login, $o_authproto");
        ($session, $error) = Net::SNMP->session(
            -hostname     => $o_host,
            -version      => '3',
            -username     => $o_login,
            -authpassword => $o_passwd,
            -authprotocol => $o_authproto,
            -timeout      => $o_timeout,
            -domain       => $o_domain
        );
    } else {
        verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto");
        ($session, $error) = Net::SNMP->session(
            -hostname     => $o_host,
            -version      => '3',
            -username     => $o_login,
            -authpassword => $o_passwd,
            -authprotocol => $o_authproto,
            -privpassword => $o_privpass,
            -privprotocol => $o_privproto,
            -timeout      => $o_timeout,
            -domain       => $o_domain
        );
    }
}

After :

if (defined($o_login) && defined($o_passwd)) {

    # SNMPv3 login
    verb("SNMPv3 login");
    if (!defined($o_privpass)) {
        verb("SNMPv3 AuthNoPriv login : $o_login, $o_authproto");
        ($session, $error) = Net::SNMP->session(
            -hostname     => $o_host,
            -port         => $o_port,
            -version      => '3',
            -username     => $o_login,
            -authpassword => $o_passwd,
            -authprotocol => $o_authproto,
            -timeout      => $o_timeout,
            -domain       => $o_domain
        );
    } else {
        verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto");
        ($session, $error) = Net::SNMP->session(
            -hostname     => $o_host,
            -port         => $o_port,
            -version      => '3',
            -username     => $o_login,
            -authpassword => $o_passwd,
            -authprotocol => $o_authproto,
            -privpassword => $o_privpass,
            -privprotocol => $o_privproto,
            -timeout      => $o_timeout,
            -domain       => $o_domain
        );
    }
}

Thx !

check_snmp_load.pl - Linux load multiple CPUs

Linux load doesn't handle multiple CPUs properly. Here is a patch that makes the plugin to get the number of CPUs for a particular system and multiply warning and critical limits by this number.

Questen Parameter usage for icinga2

Hi,

i wan't use your snmp check script to monitor my network interfaces in icnga2. In my case i create a check command with the following paramaters:

-t 10 snmp timeout in seconds
-H host
-L <authp,privp>
-l snmpv3 username
-x password Auth
-X password Priv
-n
--64bits use 64Bit snmp-counter (for 1GBit/s and higher)
--label
-N use IfName instead ifDeDescr
-Y output performance data in bits/s
-B output performance data in bits instead bytes
-k check Bandwith
-q check Bandwith include error and discard
-f Performance data output for graphite/nagvis/grafana
-e Performance data output include error and discard
-S Include speed in performance (output: $interface$_speed_bps)
-d 60 average of Delta in seconds
-M warning and critiacl in Mbps
-w 200,200,1,1,1,1
-c 280,280,2,2,2,2

Now I have 3 question for usable and hope, that somebody can help me.

  1. With the Parameter -S i get following error:
    Use of uninitialized value $speed_real in concatenation (.) or string at /usr/lib64/nagios/plugins/check_snmp_int.pl line 1100.
    The output looks like this: eth0_speed_bps=
    Is this a script error?

  2. In every 60s output I see 531 discard-errors on interface: 'eth0_in_discard'=531c
    Is it possible the only the delta discard and error packets?

  3. The warning and critical level for discards and errors don't work for me:

    grafik

    Is it possible, that the sensor switch to warning/critical, when the delta contains x discard/error-packets?

Thx a lot for every help!

Have waiting info always

Hello,

I've just download your plugins and I'm trying to getting work only check_snmp_storage for the moment. But when I try to use it, I have always the same answer : "Waiting for info"....

Here is my command line :
./check_snmp_storage.pl -H 192.168.1.139 -w 70 -c 90 -m C: -C public

Is there a problem ? Or I have to install something else on hosts ?

Thanks in advance.

check_snmp_process - Slightly confusing error message due to rounding

As far as I could tell, this is the most popular/official migration of http://nagios.manubulon.com/ ?

There's a slightly confusing issue with check output sometimes, if something is just over the threshold.
2 process matching foo.exe (> 1) (<= 2):OK, Mem : 20.0Mb > 20 WARNING | 'memory_usage'=20.0MB;20;30 'num_process'=2;1;1

I don't feel like I've had this much with other checks for some reason, perhaps they just don't have as much granularity...

Expected Behavior

Unsure, something less confusing...

Current Behavior

The check outputs this warning:
2 process matching foo.exe (> 1) (<= 2):OK, Mem : 20.0Mb > 20 WARNING | 'memory_usage'=20.0MB;20;30 'num_process'=2;1;1

Printing the raw values shows:
20.04296875 > 20

Possible Solution

I'm not sure of an ideal solution, showing more decimal places wouldn't be flawless and would be noisy. Rounding the source data earlier loses accuracy...

Steps to Reproduce (for bugs)

  1. Check something with a minor increase over the configured threshold.

Admittedly I've not tried the latest release yet, but the comparison line is the same so I doubt it's fixed.

Context

Just slightly confusing for users of the monitoring.

Your Environment

  • Version used (e.g. check_snmp_int.pl -V): check_snmp_process version : 1.10
  • Perl version (perl -v): This is perl 5, version 22, subversion 1 (v5.22.1) built for x86_64-linux-gnu-thread-multi
  • Operating System and version: Ubuntu 16.04
  • Monitoring system (e.g. icinga2 --version): Nagios Core 3.5.1
  • CheckCommand and Service configuration: snmp_process.pl -H $HOSTADDRESS$ -C $_HOSTSNMP_COMMUNITY$ -n $ARG1$ -w$ARG2$,$ARG3$ -c$ARG4$,$ARG5$ -m$ARG6$,$ARG7$ --perfout --v2c
  • Full command line executed by Icinga, if relevant: check_snmp_process.pl -H 1.2.3.4 -C bar -n foo.exe -w1,2 -c1,2 -m20,30 --perfout --v2c

Create option to allow perfdata in percent (%)

http://sourceforge.net/p/nagios-snmp/feature-requests/29/

This is a great tool. It would be great to also have an option to output
pnp2nagios data in percent. It can be easily done by changing the variable
$perf_out depending on an additional flag (which I defined as $o_percentage)
as long as o_warn and o_crit are defined in percent.

my $o_percentage=       undef;  # Output performance data as percentages
...
        'F'     => \$o_percentage
...
  # Performance output (in MB)
  if (defined($o_percentage)) {
    #this requires o_warn and o_crit is in percent 
    $perf_out .= "'".$Pdescr. "'=" . round($pu,0) . "%;$o_warn;$o_crit;0;100" ;
  } else { 
    $perf_out .= "'".$Pdescr. "'=" . round($bu,0) . $output_metric ."B;" .     round($p_warn,0) 
             . ";" . round($p_crit,0) . ";0;" . round($to,0);
  }

check_snmp_mem.pl not work on cisco SG200-50FP

Hello,
i try to get mem info from my cisco switch SG200-50FP but i get always this error:

ERROR: Description table : The requested table is empty or dows not exist

this is the command line that i use:

./check_snmp_mem.pl -H 192.168.0.66 -C public -w 99 -c 100 -I

SNMP is enable on switch because i can retry CPU usage information

How can i fix it?

Thanks

check_snmp_load.pl NetScreen OID's wrong?

Hi,

the documentation of Juniper has a different description as the github script as you can see here:
http://kb.juniper.net/InfoCenter/index?page=content&id=KB25797&actp=search

Juniper:
.1.3.6.1.4.1.3224.16.1.1.0 Average System CPU utilization in percentage.
.1.3.6.1.4.1.3224.16.1.2.0 Last one minute CPU utilization in percentage.
.1.3.6.1.4.1.3224.16.1.3.0 Last Five minute CPU utilization in percentage.
.1.3.6.1.4.1.3224.16.1.4.0 Last Fifteen minute CPU utilization in percentage.

Script:
my $nsc_cpu_5m = "1.3.6.1.4.1.3224.16.1.4.0"; # NS CPU load (5min %)
my $nsc_cpu_1m = "1.3.6.1.4.1.3224.16.1.2.0"; # NS CPU load (1min %)
my $nsc_cpu_5s = "1.3.6.1.4.1.3224.16.1.3.0"; # NS CPU load (5sec %)

The documentation of Juniper dates back to 2012. I can't tell if juniper changed something or not....

Error with check_snmp_process.pl

Hi,

I have an error with check_snmp_process.pl define in icinga2 manubulon plugin, I can't specify warning or critical with negative values like -1,20

ie :

I want to check the number of process for smtp, and this number can be 0

so I run this check :

 /usr/lib/nagios/plugins/check_snmp_process.pl -C public -H toto -2 -n smtp -c -1,100 -w -1,20
No process matching smtp found : YOU told me it was : OK

But icinga run it like :

/usr/lib/nagios/plugins/check_snmp_process.pl -C public -H toto -2 -n smtp -c -1,100 -w -1,20
Unknown option: 1
Unknown option: ,
Unknown option: 1
Unknown option: 0
Unknown option: 0
Unknown option: 1
Unknown option: ,
Unknown option: 0
Use of uninitialized value $num in pattern match (m//) at /usr/lib/nagios/plugins/check_snmp_process.pl line 89.
Numerical values for warning and critical
Usage: /usr/lib/nagios/plugins/check_snmp_process.pl [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd) [-p <port>] -n <name> [-w <min_proc>[,<max_proc>] -c <min_proc>[,max_proc] ] [-m<warn Mb>,<crit Mb> -a -u<warn %>,<crit%> -d<delta> ] [-t <timeout>] [-o <octet_length>] [-f -A -F ] [-r] [-V] [-g]

The problem is the space betwen -c or -w and value, must be -c-1,100 not -c(space)-1,100

Do you know how can I remove this useless space for this two args ?

I'm using the latest version of plugins

Thanks

Check_snmp_storage.pl gives me a use of 123%

Hey,
I try to monitor a Mac Mini in my Network, it has a mounted drive via AFP, that gives me a usage of 123%, whats seems a little impossible. ;)

My call for the hole Mac is this:

/usr/lib/nagios/plugins/check_snmp_storage.pl -H x.x.x.x -C public -m / -w 80 -c 90

And the output is:

/: 25%used(58994MB/239172MB) /Network/Servers: 0%used(0MB/0MB) /Volumes/ARQ: 123%used(2143914MB/1739805MB) /Volumes/Promise Pegasus: 24%used(2777550MB/11443754MB) /dev: 100%used(0MB/0MB) /home: 0%used(0MB/0MB) /net: 0%used(0MB/0MB) /private/var/vm: 1%used(3072MB/239172MB) (>90%) : CRITICAL

The ARQ drive has a volume of 19,42 TB and has free 17,17 TB.

Would be cool, if that could be fixed.

check_snmp_int filling 0 valued rows PALO-ALTO 3220

Hi,
Sometimes in our /tmp/tmp_Icinga_int.[IP].161.[interface_name] file lines with 0 values appear

Expected Behavior

1677147427:130606416903670:49920642709205:0:0:0:0
1677147727:130633105024917:49926414084156:0:0:0:0
1677148148:130666857271937:49932368204656:0:0:0:0
1677148448:130690060146440:49937607659580:0:0:0:0

Current Behavior

1677147427:130606416903670:49920642709205:0:0:0:0
1677147727:130633105024917:49926414084156:0:0:0:0
1677148027:0:0:0:0:0:0
1677148148:130666857271937:49932368204656:0:0:0:0
1677148448:130690060146440:49937607659580:0:0:0:0

Possible Solution

We've modified the read_file function to bypass those lines when in value less than 1

# if ($#file_values >= ($items_number - 1)) {
# modifié le 23/02/2023 par A.FERNIQUE
# j'ajoute une condition si le compteur dans le fichier est 0 on saute
if (($#file_values >= ($items_number - 1))&&($file_values[1] >=1)) {

Steps to Reproduce (for bugs)

Dunno this only seems to happens on our palo-alto 3220 (rev 10.2.3-h2) So i guess it somehow sends bad values.

Context

monitoring solutions, huge throughput appearing on graph which are false

Your Environment

omd distrib on debian bullseye with snmp plugins for ease of use.

check_snmp_int.pl does not allow use of ifName

Hi,

option "-N" (to use ::ifName to select interface) seems to not exist in current (1.4.6) version, neither in "--help" message, nor in perl file (responds with "unknown option"), but this is needed to select proper interface from Ubuntu 16 (VM under vSphere 6.5, is using for all interfaces ::ifDescr value "VMware VMXNET3 Ethernet Controller").

check_snmp_load.pl fails with stacked cisco 3650

When running the script via icinga2, the following error is returned:
ERROR: Description table : No response from remote host "10.x.x.x".

There are three cisco 3650's in a stack, and the snmp requests are going to the stack master.
Based on my queries using snmp-walk and get, it seems you have to query oid's:]

1.3.6.1.4.1.9.9.109.1.1.1.1.3
1.3.6.1.4.1.9.9.109.1.1.1.1.4
1.3.6.1.4.1.9.9.109.1.1.1.1.5

but you get back a "array" of values

.iso.org.dod.internet.private.enterprises.9.9.109.1.1.1.1.3.19 = Gauge32: 11
.iso.org.dod.internet.private.enterprises.9.9.109.1.1.1.1.3.20 = Gauge32: 10
.iso.org.dod.internet.private.enterprises.9.9.109.1.1.1.1.3.21 = Gauge32: 8

which correspond to the 5 minute average for each switch in the stack
and which matches the documentation from cisco

https://www.cisco.com/c/en/us/support/docs/ip/simple-network-management-protocol-snmp/15215-collect-cpu-util-snmp.html#topic1

Data Not Fully Defined - UNKNOWN

The plugin check_snmp_storage.pl is currently returning a UNKNWON error. The SNMP communication seems fine and he seem to be implying the difficulty is in the new pam_systemd user running environment.

It has been working fine with RHEL6, but recently installed a new server with RHEL7 which is returning this error.

[username@localhost ~]$ /usr/bin/perl check_snmp_storage.pl -H servertocheck -C communitystring -2 -p 161 -w 85 -c 90 -f -q FixedDisk -G -f '' -e -m '/dev|/otherpath'
Use of uninitialized value in concatenation (.) or string at test line 659.
Use of uninitialized value in concatenation (.) or string at test line 660.
Use of uninitialized value in concatenation (.) or string at test line 661.
Data not fully defined for storage /run/user/66236 : UNKNOWN

Installation requires perl-bignum on Fedora (likely CentOS/Redhat) for bigint package

bigint was moved into a new package perl-bignum.

Related here: https://bugzilla.redhat.com/show_bug.cgi?id=1286363

[root@nms plugins]# ./check_snmp_int.pl
Can't locate bigint.pm in @inc (you may need to install the bigint module) (@inc contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at ./check_snmp_int.pl line 412.
BEGIN failed--compilation aborted at ./check_snmp_int.pl line 412.

[root@nms plugins]# dnf install perl-Math-BigInt
Last metadata expiration check: 0:06:17 ago on Mon 03 Jun 2019 18:07:27 BST.
Package perl-Math-BigInt-1:1.9998.13-3.fc29.noarch is already installed.
Dependencies resolved.
Nothing to do.
Complete!

dnf install perl-bignum

[root@nms plugins]# ./check_snmp_int.pl
Usage: ./check_snmp_int.pl [-v] -H -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L ,) [-p ] -n [-N -A -i -a -D --down] [-r] [-f[eSyY]] [-k[qBMGu] -g -w -c -d] [-o <octet_length>] [-t ] [-s] --label [-V]
[root@nms plugins]#

perfdata output of check_snmp_int.pl not following specs

As per https://www.monitoring-plugins.org/doc/guidelines.html#AEN201 (Note 1) the perfdata has to be a list of label/value pairs separated by a space.

Sometimes, in check_snmp_int.pl, those pairs are separated by several whitespaces (specially if you are listing all the interfaces and some of them are DOWN)

The problem is that other software (influxdb writer of Icinga2, for example) is expecting only one space to parse all the pairs in perfdata, and so the parsing is not correct.

Net::SNMP version string no longer numeric in CentOS 7

on the new EL7 systems, the EPEL package perl-Net-SNMP-6.0.1-7.el7.noarch now has the variable Net::SNMP->VERSION set as a string rather than a number:

/usr/share/perl5/vendor_perl/Net/SNMP.pm:109:   our $VERSION = 'v6.0.1';


perl -e 'use Net::SNMP; print Net::SNMP->VERSION ."\n" ;'
v6.0.1

This is a problem for check_snmp_load.pl, which now throws
Argument "v6.0.1" isn't numeric in numeric lt (<) at /opt/manubulon/plugins/check_snmp_load.pl line 368.

The comparison (Net::SNMP->VERSION < 4) is no longer valid, and is used in multiple checks.

It may make sense to use something like http://search.cpan.org/~bdfoy/Perl-Version-1.013/lib/Perl/Version.pm, although that would create another dependency.

SNMP interface check doesn't work with Perl < 5.13.2

Current Behavior

Commit 9f9b15a added a bunch of string replacements using the /r modifier which is only available in versions of Perl since 5.13.2. Other versions (like those still in use by RHEL6) will complain with "Bareword found where operator expected."

Possible Solution

Find a different method of escaping dots. If this is needed, there are a dozen other ways to do it that would not break backward compatibility.

Your Environment

check_snmp_int version : 2.1.0
This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi
Scientific Linux release 6.9 (Carbon)

check_snmp_process.pl hangs until ALARM with -A (arguments)

I have not yet identified what is causing this but on a specific server the -A causes it to hang and not match any processes. The same check against other servers works fine. We have some java processes on this server with a very long list of arguments and I wonder if that could be to blame.

I'll continue to try to debug further.

SNMP retries not respected due to global timeout

Hello,
I'm looking at check_snmp_storage.pl but this most likely applies to most if not all the plugins.
From the code, I see that the script is forced to end after the timeout (given in arguments, default 5):

if (defined($o_timeout)) {
    verb("Alarm in $o_timeout seconds");
    alarm($o_timeout);
}

$SIG{'ALRM'} = sub {
    print "No answer from host $o_host:$o_port\n";
    exit $ERRORS{"UNKNOWN"};
};

The snmp session has the same timeout value and a retries value of 10:

        ($session, $error) = Net::SNMP->session(
            -hostname  => $o_host,
            -version   => 2,
            -community => $o_community,
            -port      => $o_port,
            -retries   => 10,
            -timeout   => $o_timeout,
            -domain    => $o_domain
        );

From my understanding the retries can not be respected as the script will be forced to end after the first snmp attempt (same timeout for the script and the snmp)

Am I right ?

Expected Behavior

Script doesn't end before snmp retries are executed

Current Behavior

No snmp retries executed as the script will end after the snmp timeout of the first attempt

Possible Solution

One solution would be to calculate a global timeout as $o_timeout*10

if (defined($o_timeout)) {
    my $global_timeout = $o_timeout * 10;
    verb("Alarm in $global_timeout seconds");
    alarm($global_timeout);
}

$SIG{'ALRM'} = sub {
    print "No answer from host $o_host:$o_port\n";
    exit $ERRORS{"UNKNOWN"};
};

Context

On one monitored Linux host we are getting "No answer from host ip:161" from time to time.

check_snmp_int.pl - Quantifier follows nothing in regex

Hello,

I've tried setting up the snmp-interface template check in Icinga2 (which uses check_snmp_int.pl) but I get the following error:

Quantifier follows nothing in regex; marked by <-- HERE in m/* <-- HERE / at /usr/libexec/icinga2/check_snmp_int.pl line 627.

So I tried to search for a * in a regex that's used alone but didn't find one...
As I have 0 knowledge on perl I'm a bit stuck :s (I'm not even sure I'm reading the error message right...)

Help would be very appreciated :D

Here's the command executed by my Icinga2 host:
'/usr/libexec/icinga2/check_snmp_int.pl' '-B' '-C' 'some_community' '-H' '10.18.50.4' '-M' '-Y' '-c' '0,600' '-d' '300' '-e' '-f' '-k' '-n' '*' '-t' '5' '-w' '300,400'

I've tried downloading again the script from this repo btw, didn't solve the issue.

Thank you very much,

Add support for SHA-256 auth and AES128 priv

The plugins don't support using SHA-256 as the authentication algorithm or AES128 as the privacy algorithm.
It would be great if support could be added for these algorithms so that I could use these plugins for my use case.

Error with check_snmp_process.pl with snmpv3 but not check_snmp_storage.pl

I have configure snmp v3 on a vcenter, it works for check_snmp_storage.pl but not for check_snmp_process.pl with the same configuration

Work
check_snmp_storage.pl -H @ip -l $USER4$ -x $USER5$ -X $USER5$ -L sha,aes -m /storage/archive -e -w 90 -c 95 -S 0 -q FixedDisk -f
All selected storages (<90%) : OK | '/'=5723.9648MB;9746;10288;0;10829 '/boot'=33.9639MB;108;114;0;120 '/dev'=0.0000MB;7208;7609;0;8009 '/dev/shm'=0.7930MB;7217;7618;0;8019 '/run'=0.6602MB;7217;7618;0;8019 '/storage/autodeploy'=22.4961MB;8949;9446;0;9943 '/storage/core'=1152.6016MB;45235;47748;0;50261 '/storage/db'=278.0000MB;8949;9446;0;9943 '/storage/dblog'=3701.5117MB;13485;14234;0;14983 '/storage/imagebuilder'=22.5000MB;8949;9446;0;9943 '/storage/log'=1864.0938MB;8949;9446;0;9943 '/storage/netdump'=1.2539MB;886;935;0;984 '/storage/seat'=1649.1797MB;22556;23809;0;25062 '/storage/updatemgr'=68.9414MB;90592;95624;0;100657 '/sys/fs/cgroup'=0.0000MB;7217;7618;0;8019 '/tmp'=1.3477MB;7217;7618;0;8019 '/var/spool/snmp'=0.0000MB;1;1;0;1

Don't work
./check_snmp_process3.pl -H @ip -l $USER4$ -x $USER5$ -X $USER5$ -L sha,aes -n -r -v
0 0 0 0
Alarm at 15
SNMPv3 AuthPriv login : $USER4$, sha, aes
ERROR: Process name table : No response from remote host "@ip".

Could you help me?

Nagios shows KB instead of MB with check_snmp_storage

Hi there,

once using the script i see that the MB Size is sent to nagios graph. but the graph itself is saying K on the Left.

So Value is 624900.055MB > but on left is showing it passed the 500KB Line

Could i fix it in the Code somehow? i'am not that familiar with Perl code.

untitled

Many thx

Max

Consider Changing check_snmp_load -T netsl value names

After I solved this issue
https://monitoring-portal.org/t/graphite-no-graphs-found/3190
I found that the names of the perfdata, and therefore Graphite are load_1_min.value etc. while the standard load names are load1.value etc..
I want to suggest that the names are changed to the icinga names. Sadly this would be a breaking change which could be resolved with a one-line command but I don't think this is desirable.
I am happy to hear other ideas on how to resolve this or if this is considered to be too minor.

check_snmp_storage and 5% reserved space on local FS

Nagios core 4.2.1 and check_snmp_storage Ver. 1.3.3
The check is available on Nagiosexchange web site

The check_snmp_storage has -R option in order to sum 5% space to %occupied space
The rule should be applie only to ext2 and ext3 FS but the script sum this 5% to NFS FS
This is the error

Someone could be fix the problem
Regards and Thanks
Emilio

Fallback SNMP versions and counter sizes

I wish I don't have to manage if my host will reply correctly with 64 bits or 32 bits counter, SNMP v2 or v1.

Perhaps the SNMP Interface check script can test and failover this way :

  • try SNMP v2c and 64 bits Counter
  • if not found, Try 32 bits Counter
  • if not found, try SNMP v1

I know it will add some latency, but only on old platform which does not already support 64 bits counters...

Issues with 2012R2 and check_snmp_mem.pl

This same check is currently working for my 2016 servers, but this is what happens with 2012R2.

Command line

# /opt/manubulon-snmp/plugins/check_snmp_mem.pl -H 192.168.21.37 -C mycomm -w 80,1 -c 90,1 
ERROR: netsnmp : Received noSuchName(2) error-status at error-index 1.

From Nagios

(Return code of 255 is out of bounds : (No output on stdout) stderr: Argument "noSuchObject" isn't numeric in addition (+) at /opt/manubulon-snmp/plugins/check_snmp_mem.pl line 576.))

check_snmp_int.pl treats device reboot as octet counters overflow

In order to deal with overflown octet in/out counters, the plugin checks if the counters that were currently retrieved from the device have a value lower than the ones stored in the file from the previous run(s).
But the same thing will happen (i.e. retrieved counters are lower than previously stored ones) in case of a device reboot. So the plugin will assume a reset of the counters as an overflow and will report erroneous interface utilization (way over 100%). In case warning/critical thresholds have been specified, the plugin will also report warning/critical result.

Obviously the best way to solve this would be to introduce an extra check for the device uptime.
A good workaround though, that requires much less changes in the plugin code, is to check if both octet-in and -out counters have "overflown" at the same run.
It is extremely rare that a simultaneous in/out counter overflown would have happened in real world interface traffic conditions, so I think this workaround is a pretty safe to assume.

If you agree I can create a pull request that implements this workaround.

Thank you.

check_snmp_mem.pl plugin giving wrong results

We are using GItHub Enterprise as our source code management system and its installed as an appliance in Vmware Esxi.
For monitoring purpose we are using Nagios over SNMP for getting the performance metrics.

Nagios over SNMP ( GHE provides the resource metric by default over SNMP) we enabled SNMPV3 from GHE appliance side

But its noticed that GHE will create a much cached memory which will result in unwanted alerts.

There is 4.6 G of cached memory, how to configure Nagios to alert the threshold for GHE (used-cached) memory instead of just used memory.

Current memory usage on the system is:

free -h

total used free shared buffers cached Mem:
15G 14G 909M 1.5M 375M 4.6G
-/+ buffers/cache: 9.8G 5.9G
Swap: 0B 0B 0B

But in Nagios side is there any way to exclude these linux consumed memory and monitor only the GHE consumed memory alone?

Current Behavior

check_snmp_mem.pl -H XXXXX --login=XXXXX --passwd=XXXXX --privpass=XXXXX --protocols=sha,aes -m -w 90,90 -c 95,95 -v

Alarm at 15
SNMPv3 AuthPriv login : XXXXX, sha, aes
Ram : 526920 / 16437176 : 97
Swap : 0 / 0 : 0
Ram : 97%, Swap : 0% : > 95, 95 ; CRITICAL

its again showing as 97 % , which is not correct( its again including the cache memory in the used memory)

free
total used free shared buff/cache available
Mem: 16437176 11679836 771992 5100 3985348 4413996
Swap: 0 0 0

Note:- I think, in your example also, its showing wrong details.

linux will treat cache memory as used memory and in order to get the application consumed memory:-

We have to get the value in way like

(used memory - available memory)
________________________________ * 100

(Total memory)

But in your example also its not showing correct values.. Please read this.. https://www.linuxatemyram.com/

check_snmp_int.pl stop working

When I run this command on my machine, I get following error:

root@efomf:/usr/lib/nagios/plugins# ./check_snmp_int.pl -H 192.168.200.1 -C abcdefg -s -n Eth*
usage: $sock->socket(DOMAIN, TYPE, PROTOCOL) at /usr/share/perl5/Net/SNMP/Transport/IPv4.pm line 36

Running in a docker container 'google/debian:wheezy'
Debian version 7.8
Linux efomf.dk 2.6.32-504.12.2.el6.x86_64 #1 SMP Wed Mar 11 22:03:14 UTC 2015 x86_64 GNU/Linux

Cisco SMB switch

Cisco SMB switches seams to use different OID's.
At least I tested it with my SG500, by overwriting the cisco values:

my $cisco_cpu_5m = "1.3.6.1.4.1.9.6.1.101.1.9.0";      # Cisco CPU load (5min %)
my $cisco_cpu_1m = "1.3.6.1.4.1.9.6.1.101.1.8.0";      # Cisco CPU load (1min %)
my $cisco_cpu_5s = "1.3.6.1.4.1.9.6.1.101.1.7.0";      # Cisco CPU load (5sec %)

Output for the plugin: CPU : 5 3 3 : OK
Source: https://supportforums.cisco.com/discussion/12195886/sg-500-snmp-oid-cpu-load

Just in case you want to include this as an additional type

check_snmp_mem.pl fails with a specific device

Expected Behavior

Get correct memory values reported.

Current Behavior

I try this:

# /usr/lib/nagios/plugins/check_snmp_mem.pl -v -H 10.0.0.134 -C secret42 -2 -m -w90,90 -c95,95 
Alarm at 15
SNMP v2c login
Argument "noSuchObject" isn't numeric in addition (+) at /usr/lib/nagios/plugins/check_snmp_mem.pl line 580.
Argument "noSuchObject" isn't numeric in subtraction (-) at /usr/lib/nagios/plugins/check_snmp_mem.pl line 580.
Illegal division by zero at /usr/lib/nagios/plugins/check_snmp_mem.pl line 580.

Possible Solution

Maybe the implemented OIDs don't match the ones requested by the script?

Steps to Reproduce (for bugs)

  1. use icinga2 on Debian 11.1
  2. install this repo
  3. run above check

Your Environment

  • Version used (e.g. check_snmp_int.pl -V): 2.1.0
  • Perl version (perl -v): v5.32.1
  • Operating System and version: Debian GNU/Linux 11 (bullseye)
  • Monitoring system (e.g. icinga2 --version): icinga2 r2.12.3-1
  • Full command line executed by Icinga, if relevant: see above

check_snmp_storage - multiple warning args

Hi,

Is there a way to specify multiple warning levels for different sections like one for Memory and a separate one for disk space rather than just having one global warning / critical level?

Thanks!

Allow output for NagVis "weathermap" lines

More info on the expected format is available here. It's a very poor format (would be nice if we could tell it how to parse standard plugin output) but it's very useful for visualizing bandwidth. I made the following changes which should merge nicely without affecting existing users. Of course, Icinga's command-plugins-manubulon.conf file would need to be updated to support this as well.

diff --git a/plugins/check_snmp_int.pl b/plugins/check_snmp_int.pl
index 7bebf10..f612741 100755
--- a/plugins/check_snmp_int.pl
+++ b/plugins/check_snmp_int.pl
@@ -73,6 +73,7 @@ my $o_version = undef;    # print version
 my $o_noreg   = undef;    # Do not use Regexp for name
 my $o_short   = undef;    # set maximum of n chars to be displayed
 my $o_label   = undef;    # add label before speed (in, out, etc...).
+my $o_weather = undef;    # output "weathermap" data for NagVis
 
 # Performance data options
 my $o_perf  = undef;      # Output performance data
@@ -257,6 +258,8 @@ 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)
+-W, --weather
+   Output data for "weathermap" lines in NagVis with performance data
 -c, --critical=input,output[,error in,error out,discard in,discard out]
    critical level for input / output bandwidth (0 for no critical)
      unit depends on B,M,G,u options
@@ -353,7 +356,9 @@ sub check_options {
         'delta:i'       => \$o_delta,
         'D'             => \$o_dormant,
         'dormant'       => \$o_dormant,
-        'down'          => \$o_down
+        'down'          => \$o_down,
+        'W'             => \$o_weather,
+        'weather'       => \$o_weather
     );
     if (defined($o_help))    { help();      exit $ERRORS{"UNKNOWN"} }
     if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"} }
@@ -418,6 +423,11 @@ sub check_options {
         print_usage();
         exit $ERRORS{"UNKNOWN"};
     }
+    if (defined($o_weather) && !defined($o_perf)) {
+        print "Cannot output weathermap line data without -f option!\n";
+        print_usage();
+        exit $ERRORS{"UNKNOWN"};
+    }
     if (defined($o_perfr) && defined($o_perfp)) {
         print "-Y and -y options are exclusives\n";
         print_usage();
@@ -963,7 +973,11 @@ for (my $i = 0; $i < $num_int; $i++) {
             $perf_out .= "'" . $descr[$i] . "_out_discard'=" . $$result{ $oid_perf_outdisc[$i] } . "c ";
         }
         if (defined($o_perfs)) {
-            $perf_out .= "'" . $descr[$i] . "_speed_bps'=" . $speed_real;
+            $perf_out .= "'" . $descr[$i] . "_speed_bps'=" . $speed_real . " ";
+        }
+        if (defined($o_weather) && $usable_data == 1) {
+            $perf_out .= "in=" . sprintf("%.0f", $checkperf_out_raw[0]) . ";;;0;" . sprintf("%.0f", $speed_real / 8) . " ";
+            $perf_out .= "out=" . sprintf("%.0f", $checkperf_out_raw[1]) . ";;;0;" . sprintf("%.0f", $speed_real / 8) . " ";
         }
     }
 }

check_snmp_int with subinterface return cannot get interface speed using highperf mib : UNKNOWN

Hi to all, i'm using check_snmp_int.pl plugin to get Traffic and status data about a PaloAlto Firewall (virtual appliance).
I've defined the command in icinga2 with -r and -2 parameters and all it's working good with normal interfaces like "ethernet1/1".
Monitoring the traffic on subinterfaces (VLANs) return "Cannot get interface speed using highperf mib : UNKNOWN" also launching via command line.
The vlans interfaces on Palo Alto are called [phyisical].vlan_id for example "ethernet1/2.2".
The OIDS seems ok and i can see the values via snmpwalk.
What can i try to do to solve the problem?

Use of uninitialized value $speed_real in concatenation (.) or string at check_snmp_int.pl line 976.

Hello,
thanks for maintaining the manubulon plugins!

I've go problems getting values for the interface speed:

./check_snmp_int.pl -2 -C public -H test.dwelle.de -n "Port-channel4"  -feS

Use of uninitialized value $speed_real in concatenation (.) or string at check_snmp_int.pl line 976.
Port-channel43:UP:1 UP: OK | 'Port-channel43_in_octet'=1267227190c 'Port-channel43_out_octet'=1689980575c 'Port-channel43_in_error'=0c 'Port-channel43_in_discard'=0c 'Port-channel43_out_error'=0c 'Port-channel43_out_discard'=0c 'Port-channel43_speed_bps'=

As you can see, there is no return value for the speed of the interface. I tried to find the error by myself, but not knowing perl I failed. The OIDs are correct and snmpwalk returns the expected values.

Interestingly the following kinda works, apart from the "No usable data on file" part:

./check_snmp_int.pl --down -fe -t 60 -g -2 -C public -H test.example.net -n "Port-channel4" -S -u -B -kq -w 80,80,50,50,1000,1000 -c 90,90,100,100,2000,2000

`Port-channel43:UP No usable data on file (14 rows) :(1 UP): UNKNOWN | 'Port-channel43_in_octet'=10238223103986c 'Port-channel43_out_octet'=58543290756809c 'Port-channel43_in_error'=0c 'Port-channel43_in_discard'=0c 'Port-channel43_out_error'=0c 'Port-channel43_out_discard'=0c 'Port-channel43_speed_bps'=20000000000`

Thanks for any help!

check_snmp_process.pl does not honour timeout (-t)

$TIMEOUT is statically defined as 15s.
The else at line 338 will never execute with the -t value ($o_timeout)

Since $o_timeout is defined as 5s by default in Globals I guess one could remove $TIMEOUT and just replace the block with

if (defined($o_timeout)) {
verb("Alarm at $o_timeout");
alarm($o_timeout);
}

Apply a programming style to the plugins

Hej,

this isn't exactly an issue/bug...

Programming style of the plugins is pretty random right now (indention, line length, placement of parentheses, brackets, etc.). This makes it difficult to contribute even small changes or bugfixes to the project.

I propose reformatting the plugins with Perltidy and placing the initially used options in a .perltidyrc in the plugins-directory. Potential contributors would only have to run perltidy again to make sure any changes comply with the standard.

Feel free to close this issue if you don't agree.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.