From 75687e089f5daf8d87d90a59f09dc3472ef7d473 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 29 Nov 2017 16:28:59 +0100 Subject: [PATCH] New upstream version 2.1.0 --- CHANGELOG.md | 59 + plugins/LICENSE => LICENSE | 0 README.md | 95 +- doc/01-About.md | 30 + doc/02-Installation.md | 56 + doc/03-Configuration.md | 104 ++ doc/04-Plugins.md | 891 ++++++++++++ plugins/Changelog | 109 -- plugins/INSTALL | 15 - plugins/README | 50 - plugins/check_snmp_boostedge.pl | 4 +- plugins/check_snmp_cpfw.pl | 2 +- plugins/check_snmp_css.pl | 4 +- plugins/check_snmp_css_main.pl | 4 +- plugins/check_snmp_env.pl | 4 +- plugins/check_snmp_int.pl | 46 +- plugins/check_snmp_linkproof_nhr.pl | 4 +- plugins/check_snmp_load.pl | 78 +- plugins/check_snmp_mem.pl | 4 +- plugins/check_snmp_nsbox.pl | 4 +- plugins/check_snmp_process.pl | 2 +- plugins/check_snmp_storage.pl | 2 +- plugins/check_snmp_vrrp.pl | 2 +- plugins/check_snmp_win.pl | 3 +- plugins/doc/faq.html | 256 ---- plugins/doc/index.html | 431 ------ plugins/doc/index_commands.html | 2038 --------------------------- plugins/doc/snmp_cpfw.html | 471 ------- plugins/doc/snmp_css.html | 381 ----- plugins/doc/snmp_env.html | 370 ----- plugins/doc/snmp_int.html | 673 --------- plugins/doc/snmp_load.html | 409 ------ plugins/doc/snmp_mem.html | 485 ------- plugins/doc/snmp_process.html | 377 ----- plugins/doc/snmp_storage.html | 1330 ----------------- plugins/doc/snmp_vrrp.html | 358 ----- plugins/doc/snmp_windows.html | 261 ---- 37 files changed, 1333 insertions(+), 8079 deletions(-) create mode 100644 CHANGELOG.md rename plugins/LICENSE => LICENSE (100%) create mode 100644 doc/01-About.md create mode 100644 doc/02-Installation.md create mode 100644 doc/03-Configuration.md create mode 100644 doc/04-Plugins.md delete mode 100644 plugins/Changelog delete mode 100644 plugins/INSTALL delete mode 100644 plugins/README delete mode 100755 plugins/doc/faq.html delete mode 100755 plugins/doc/index.html delete mode 100755 plugins/doc/index_commands.html delete mode 100755 plugins/doc/snmp_cpfw.html delete mode 100755 plugins/doc/snmp_css.html delete mode 100755 plugins/doc/snmp_env.html delete mode 100755 plugins/doc/snmp_int.html delete mode 100755 plugins/doc/snmp_load.html delete mode 100755 plugins/doc/snmp_mem.html delete mode 100755 plugins/doc/snmp_process.html delete mode 100755 plugins/doc/snmp_storage.html delete mode 100755 plugins/doc/snmp_vrrp.html delete mode 100755 plugins/doc/snmp_windows.html diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..223f5de --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,59 @@ +# Change Log + +## [2.1.0](https://github.com/dnsmichi/manubulon-snmp/tree/2.1.0) (2017-10-12) +[Full Changelog](https://github.com/dnsmichi/manubulon-snmp/compare/v2.0.0...2.1.0) + +**Implemented enhancements:** + +- Cisco SMB switch [\#30](https://github.com/dnsmichi/manubulon-snmp/issues/30) +- Allow output for NagVis "weathermap" lines [\#22](https://github.com/dnsmichi/manubulon-snmp/issues/22) +- Enhance and write better documentation [\#40](https://github.com/dnsmichi/manubulon-snmp/pull/40) ([dnsmichi](https://github.com/dnsmichi)) +- Escape dot in perfdata labels [\#39](https://github.com/dnsmichi/manubulon-snmp/pull/39) ([mj84](https://github.com/mj84)) +- \[\#30\] add support for cisco small business switches \(tested with SG500\) [\#31](https://github.com/dnsmichi/manubulon-snmp/pull/31) ([spali](https://github.com/spali)) +- Allow output for NagVis "weathermap" lines [\#26](https://github.com/dnsmichi/manubulon-snmp/pull/26) ([miken32](https://github.com/miken32)) +- Add SNMP v3 authentication dependencies and distro-specific Perl module packages [\#23](https://github.com/dnsmichi/manubulon-snmp/pull/23) ([virtualtam](https://github.com/virtualtam)) + +**Fixed bugs:** + +- check\_snmp\_load.pl =\> SNMPv3 do not use the -p \(port\) option [\#27](https://github.com/dnsmichi/manubulon-snmp/issues/27) +- Fix typos in documentation [\#29](https://github.com/dnsmichi/manubulon-snmp/pull/29) ([moepot](https://github.com/moepot)) +- The -p \(port\) option was forgotten in some cases [\#28](https://github.com/dnsmichi/manubulon-snmp/pull/28) ([Niflou](https://github.com/Niflou)) +- Fix check\_snmp\_int.pl temp file name [\#25](https://github.com/dnsmichi/manubulon-snmp/pull/25) ([waja](https://github.com/waja)) + +**Closed issues:** + +- Have waiting info always [\#4](https://github.com/dnsmichi/manubulon-snmp/issues/4) + +## [v2.0.0](https://github.com/dnsmichi/manubulon-snmp/tree/v2.0.0) (2016-11-25) +**Implemented enhancements:** + +- check\_snmp\_load.pl - Linux load multiple CPUs [\#6](https://github.com/dnsmichi/manubulon-snmp/issues/6) +- Ignore DOWN state and big snmp requests [\#19](https://github.com/dnsmichi/manubulon-snmp/pull/19) ([SteScho](https://github.com/SteScho)) + +**Fixed bugs:** + +- check\_snmp\_process.pl does not honour timeout \(-t\) [\#21](https://github.com/dnsmichi/manubulon-snmp/issues/21) + +**Closed issues:** + +- Apply a programming style to the plugins [\#20](https://github.com/dnsmichi/manubulon-snmp/issues/20) +- Get rid of utils.pm [\#10](https://github.com/dnsmichi/manubulon-snmp/issues/10) +- Net::SNMP version string no longer numeric in CentOS 7 [\#9](https://github.com/dnsmichi/manubulon-snmp/issues/9) +- fortigate 4.3 support for check\_snmp\_load [\#7](https://github.com/dnsmichi/manubulon-snmp/issues/7) + +**Merged pull requests:** + +- Not all Systems have connections [\#18](https://github.com/dnsmichi/manubulon-snmp/pull/18) ([SteScho](https://github.com/SteScho)) +- Add the -A/--use-ifalias option to do name lookup from ifAlias [\#17](https://github.com/dnsmichi/manubulon-snmp/pull/17) ([darksoul42](https://github.com/darksoul42)) +- pnp need perf-data with always same order [\#16](https://github.com/dnsmichi/manubulon-snmp/pull/16) ([SteScho](https://github.com/SteScho)) +- pnp need perf-data with always same order [\#15](https://github.com/dnsmichi/manubulon-snmp/pull/15) ([SteScho](https://github.com/SteScho)) +- Add -N/--use-ifname option to switch name lookup from ifDescr to ifName [\#14](https://github.com/dnsmichi/manubulon-snmp/pull/14) ([darksoul42](https://github.com/darksoul42)) +- Fix, check\_snmtp\_load output [\#12](https://github.com/dnsmichi/manubulon-snmp/pull/12) ([casvcasv](https://github.com/casvcasv)) +- making checks executable [\#8](https://github.com/dnsmichi/manubulon-snmp/pull/8) ([morgajel](https://github.com/morgajel)) +- Add Cisco Nexus Devices capability for load [\#3](https://github.com/dnsmichi/manubulon-snmp/pull/3) ([pasancario](https://github.com/pasancario)) +- Fix typo protcol vs. protocol [\#2](https://github.com/dnsmichi/manubulon-snmp/pull/2) ([waja](https://github.com/waja)) +- Fix error writing tmp file using plugin with remote unix system [\#1](https://github.com/dnsmichi/manubulon-snmp/pull/1) ([TheCry](https://github.com/TheCry)) + + + +\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* diff --git a/plugins/LICENSE b/LICENSE similarity index 100% rename from plugins/LICENSE rename to LICENSE diff --git a/README.md b/README.md index 6f04d77..6d132a8 100644 --- a/README.md +++ b/README.md @@ -1,56 +1,89 @@ # Manubulon SNMP Plugins -## General information +#### Table of Contents + +1. [About](#about) +2. [License](#license) +3. [Support](#support) +4. [Requirements](#requirements) +5. [Installation](#installation) +6. [Configuration](#configuration) +7. [FAQ](#faq) +8. [Thanks](#thanks) +9. [Contributing](#contributing) + +## About Manubulon SNMP plugins is a set of Icinga/Nagios plugins -to check hosts/devices using the SNMP protocol. Check -[http://nagios.manubulon.com](http://nagios.manubulon.com) for more details. +to check hosts/devices using the SNMP protocol. -This is a fork using a [cvs2git import](http://sourceforge.net/projects/nagios-snmp/develop) which includes community patches. +### Plugin Overview -The original project was last active in 2007 so this project -helps collect all patches and feature requests. +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 -Feel free to use & distribute it under the original license. +## License -## Requirements - -* perl in /usr/bin/perl -* Perl modules `Net::SNMP` and `Getopt::Long` (RHEL: `perl-Net-SNMP perl-Getopt-Long`) -* `icinga` user able to write files in /tmp/ directory - -Perl, default directory and temp files location can be changed using the install.sh script. - -`utils.pm` from `Monitoring::Plugin::Perl` is no longer required. - -## Documentation - -The original documentation and sourcecode is located at -[http://nagios.manubulon.com](http://nagios.manubulon.com). -A website copy was added underneath the `doc/` directory. +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 -You may create [GitHub issues](https://github.com/dnsmichi/manubulon-snmp) -as well. I do have a lot of things on my plate so best is to send in a tested (!) patch at the same time. +Join the [Icinga community channels](https://www.icinga.com/about/get-involved/) for questions. If you want to help maintain this project, just contact me on [twitter](https://twitter.com/dnsmichi) and I'll happily grant commit access. -You may head over to [monitoring-portal.org community](http://www.monitoring-portal.org) -for questions and feedback. +## Requirements -The original support tracker is still located on [sourceforge](https://sourceforge.net/p/nagios-snmp/feature-requests/). +* Perl in `/usr/bin/perl` +* Perl modules + [Net::SNMP](http://search.cpan.org/~dtown/Net-SNMP-v6.0.1/lib/Net/SNMP.pm) and + [Getopt::Long](http://search.cpan.org/~jv/Getopt-Long-2.49.1/lib/Getopt/Long.pm) +* `icinga` user able to write files in /tmp/ directory +* SNMP v3 authentication: Perl modules + [Crypt::DES](http://search.cpan.org/~dparis/Crypt-DES-2.07/DES.pm), + [Crypt::Rijndael](http://search.cpan.org/~leont/Crypt-Rijndael-1.13/Rijndael.pm) and + [Digest::HMAC](http://search.cpan.org/~gaas/Digest-HMAC-1.03/lib/Digest/HMAC.pm) -## Development +## Installation -Fork this repository on Github and send in a PR. +Detailed installation instructions can be found [here](doc/02-Installation.md). + +## Configuration + +Proceed [here](doc/03-Configuration.md) to get details on the configuration with Icinga 2, Icinga 1.x, etc. + +## FAQ + + +## Thanks + +Patrick Proy for creating and maintaining the original plugins. + +## 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 +``` +$ perltidy -b plugins/*.pl +``` This requires the `perltidy` module being installed. - diff --git a/doc/01-About.md b/doc/01-About.md new file mode 100644 index 0000000..f36c62e --- /dev/null +++ b/doc/01-About.md @@ -0,0 +1,30 @@ +# About Manubulon SNMP Plugins + +Manubulon SNMP plugins is a set of Icinga/Nagios plugins +to check hosts/devices using the SNMP protocol. + +Please find more insights in the following chapters: + +* [Installation](02-Installation.md) +* [Configuration](03-Configuration.md) +* [Plugins](04-Plugins.md) + + + +## History + +These plugins have been written by Patrick Proy several years ago. + +Many community members still use them, but development and patches +stopped. + +I've used these plugins in my previous job, and decided to fork them +into this repository. Many patches have been applied, and put into +official releases for packagers. + +This is reflected by moving each plugin into a v2.x version although +there are not so many changes. + +I don't have a test system/hardware nor do much with these plugins these days. +Still this repository allows community members to send in their patches +and discuss bugs and feature requests. diff --git a/doc/02-Installation.md b/doc/02-Installation.md new file mode 100644 index 0000000..171abfd --- /dev/null +++ b/doc/02-Installation.md @@ -0,0 +1,56 @@ +# Manubulon SNMP Plugins Installation + +The plugins rely on the `Net::SNMP` Perl library for fetching +data from SNMP enabled hosts. + +## Prerequisites + +### RHEL/CentOS EPEL Repository + +RHEL/CentOS requires the EPEL repository: + +``` +yum -y install epel-release +yum makecache +``` + +If you are using RHEL you need enable the `optional` repository and then install +the [EPEL rpm package](https://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F). + +## Perl Dependencies + +Debian/Ubuntu: + +``` +apt-get -y install libnet-snmp-perl libcrypt-des-perl libcrypt-rijndael-perl libdigest-hmac-perl +``` + +RHEL/CentOS/Fedora: + +``` +yum -y install perl-Net-SNMP perl-Getopt-Long perl-Crypt-DES perl-Crypt-Rijndael perl-Digest-HMAC +``` + +## Plugin Setup + +Debian/Ubuntu: + +``` +install -o root -g root -m750 plugins/*.pl /usr/lib/nagios/plugins/ +``` +RHEL/CentOS/Fedora: + +``` +install -o root -g root -m750 plugins/*.pl /usr/lib64/nagios/plugins/ +``` + +Proceed with inspecting the plugins `--help` parameter in [this chapter](04-Plugins.md). + +Next up: Integrate the plugins into your monitoring by adding [configuration](03-Configuration.md). + +## Advanced Hints + +Perl, default directory and temp files location can be changed using the install.sh script. + +`utils.pm` from `Monitoring::Plugin::Perl` is no longer required. + diff --git a/doc/03-Configuration.md b/doc/03-Configuration.md new file mode 100644 index 0000000..699e6ee --- /dev/null +++ b/doc/03-Configuration.md @@ -0,0 +1,104 @@ +# Manubulon SNMP Plugins Configuration + +Each plugin requires a command definition which defines the command line parameters +and arguments passed from service checks. + +* [Icinga 2](03-Configuration.md#manubulon-snmp-plugins-configuration-icinga-2) integration +* [Icinga 1.x/Naemon/Nagios](03-Configuration.md#manubulon-snmp-plugins-configuration-icinga-1) integration + +## Icinga 2 + +The Icinga 2 Template Library (ITL) already provides many [CheckCommand definitions](https://www.icinga.com/docs/icinga2/latest/doc/10-icinga-template-library/#plugin-check-commands-for-manubulon-snmp) +out of the box. This enables you to just use the CheckCommand object and focus +on your service apply rules. + +### Icinga 2: Best Practices + +Best practice is to store the credentials in a separate constant: + +``` +vim /etc/icinga2/constants.conf + +const ManubulonSnmpCommunity = "icingasnmpro" +``` + +Define a generic SNMP service template and set common attributes. + +``` +template Service "snmp-template" { + vars.snmp_community = ManubulonSnmpCommunity +} +``` +### Icinga 2: Apply Rules + + +Define service apply rules like this: + +``` +apply Service "snmp-memory" { + import "snmp-template" + check_command = "snmp-memory" + + vars.snmp_warn = "50,0" + vars.snmp_crit = "80,0" + + assign where "snmp" in host.groups +} + +apply Service "snmp-storage /var" { + import "snmp-template" + check_command = "snmp-storage" + + vars.snmp_warn = "50" + vars.snmp_crit = "80" + vars.snmp_storage_name = "/var" + + assign where "snmp" in host.groups +} + +apply Service "snmp-storage" { + import "snmp-template" + check_command = "snmp-storage" + + vars.snmp_warn = "50" + vars.snmp_crit = "80" + + assign where "snmp" in host.groups +} +``` + +### Icinga 2: Apply For Rules + +A more complex example using apply for rules is to store the +monitored storage disks on the host. This allows to generate +service objects in a more efficient way. + +``` +object Host "snmp-host" { + check_command = "hostalive" + + vars.snmp_storage["/"] = { + snmp_warn = "80" + snmp_crit = "90" + } + vars.snmp_storage["/var"] = { + snmp_warn = "60" + snmp_crit = "90" + } +} + +apply Service "snmp-storage-" for (storage_name => config in host.vars.snmp_storage) { + import "snmp-template" + + display_name = "Storage: " + storage_name + + vars += config + vars.snmp_storage_name = storage_name +} +``` + + +## Icinga 1.x/Naemon/Nagios + +You need to write a check command definition and use that in your service definitions. +Please refer to [this documentation](http://nagios.manubulon.com/index_commands.html). diff --git a/doc/04-Plugins.md b/doc/04-Plugins.md new file mode 100644 index 0000000..fb2ae8b --- /dev/null +++ b/doc/04-Plugins.md @@ -0,0 +1,891 @@ +# Manubulon SNMP Plugins + +## Plugin Overview + +Plugin | Description +----------------------------------------------------------------------|---------------------------------------- +[check_snmp_storage](04-Plugins.md#manubulon-snmp-plugins-storage) | Storage checks (disks, swap, memory, etc.) +[check_snmp_int](04-Plugins.md#manubulon-snmp-plugins-int) | Interface states, usage on hosts, switches, routers, etc. +[check_snmp_process](04-Plugins.md#manubulon-snmp-plugins-process) | Running processes, their number, used CPU and memory. +[check_snmp_load](04-Plugins.md#manubulon-snmp-plugins-load) | Load/CPU checks +[check_snmp_mem](04-Plugins.md#manubulon-snmp-plugins-mem) | Memory and swap usage +[check_snmp_env](04-Plugins.md#manubulon-snmp-plugins-env) | Environmental status of fan, temp, power supplies. +[check_snmp_vrrp](04-Plugins.md#manubulon-snmp-plugins-vrrp) | Interface state of a VRRP cluster +[check_snmp_cpfw](04-Plugins.md#manubulon-snmp-plugins-cpfw) | Checkpoint Firewall-1 status +[check_snmp_win](04-Plugins.md#manubulon-snmp-plugins-win) | Windows services +[check_snmp_css](04-Plugins.md#manubulon-snmp-plugins-css) | CSS service states +[check_snmp_nsbox](04-Plugins.md#manubulon-snmp-plugins-nsbox) | Nsbox VHost and diode status +[check_snmp_boostedge](04-Plugins.md#manubulon-snmp-plugins-hostedge) | Boostedge services +[check_snmp_linkproof_ndr](04-Plugins.md#manubulon-snmp-plugins-ndr) | Linkproof NHR + + +## check\_snmp\_storage + +``` +$ ./check_snmp_storage.pl --help + +SNMP Disk Monitor for Icinga/Nagios/Naemon/Shinken, Version 2.1.0 +(c)2004-2007 Patrick Proy + +Usage: check_snmp_storage [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] [-P ] -m [-q storagetype] -w -c [-t ] [-T pl|pu|bl|bu ] [-r -s -i -G] [-e] [-S 0|1[,1,]] [-o ] [-R <% reserved>] +By default, plugin will monitor %used on drives : +warn if %used > warn and critical if %used > crit +-v, --verbose + print extra debugging information (and lists all storages) +-h, --help + print this help message +-H, --hostname=HOST + name or IP address of host to check +-C, --community=COMMUNITY NAME + community name for the host's SNMP agent (implies SNMP v1) +-2, --v2c + Use snmp v2c +-l, --login=LOGIN ; -x, --passwd=PASSWD + Login and auth password for snmpv3 authentication + If no priv password exists, implies AuthNoPriv +-X, --privpass=PASSWD + Priv password for snmpv3 (AuthPriv protocol) +-L, --protocols=, + : Authentication protocol (md5|sha : default md5) + : Priv protocole (des|aes : default des) +-x, --passwd=PASSWD + Password for snmpv3 authentication +-p, --port=PORT + SNMP port (Default 161) +-P, --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 +-m, --name=NAME + Name in description OID (can be mounpoints '/home' or 'Swap Space'...) + This is treated as a regexp : -m /var will match /var , /var/log, /opt/var ... + Test it before, because there are known bugs (ex : trailling /) + No trailing slash for mountpoints ! +-q, --storagetype=[Other|Ram|VirtualMemory|FixedDisk|RemovableDisk|FloppyDisk + CompactDisk|RamDisk|FlashMemory|NetworkDisk] + Also check the storage type in addition of the name + It is possible to use regular expressions ( "FixedDisk|FloppyDisk" ) +-r, --noregexp + Do not use regexp to match NAME in description OID +-s, --sum + Add all storages that match NAME (used space and total space) + THEN make the tests. +-i, --index + Parse index table instead of description table to select storage +-e, --exclude + Select all storages except the one(s) selected by -m + No action on storage type selection +-T, --type=TYPE + pl : calculate percent left + pu : calculate percent used (Default) + bl : calculate MegaBytes left + bu : calculate MegaBytes used +-w, --warn=INTEGER + percent / MB of disk used to generate WARNING state + you can add the % sign +-c, --critical=INTEGER + percent / MB of disk used to generate CRITICAL state + you can add the % sign +-R, --reserved=INTEGER + % reserved blocks for superuser + For ext2/3 filesystems, it is 5% by default +-G, --gigabyte + output, warning & critical levels in gigabytes +-f, --perfparse, --perfdata + Performance data output +-S, --short=[,,] + : Make the output shorter : + 0 : only print the global result except the disk in warning or critical + ex: "< 80% : OK" + 1 : Don't print all info for every disk + ex : "/ : 66 %used (< 80) : OK" + : (optional) if = 1, put the OK/WARN/CRIT at the beginning + : take the first caracters or last if n<0 +-o, --octetlength=INTEGER + max-size of the SNMP message, usefull in case of Too Long responses. + Be carefull with network filters. Range 484 - 65535, default are + usually 1472,1452,1460 or 1440. +-t, --timeout=INTEGER + timeout for SNMP in seconds (Default: 5) +-V, --version + prints version number +Note : + with T=pu or T=bu : OK < warn < crit + with T=pl ot T=bl : crit < warn < OK + + If multiple storage are selected, the worse condition will be returned + i.e if one disk is critical, the return is critical + + example : + Browse storage list :