...
 
Commits (4)
Changelog
=========
0.2 (2017-12-12)
0.3 (2018-03-10)
----------------
- Add support for base oid
- Replace load test with more generic one
- New option to display strings
- Support oid with leading .
- Add support for loop values
- Add examples to help text
- Add icinga2 CheckCommand example
0.2 (2018-12-12)
----------------
- Add support for float values
......
......@@ -24,6 +24,12 @@ Installation
Just copy the file `check_snmp_multi.pl` to your Icinga or Nagios plugin directory.
Source
------
- [Latest source at git.dinotools.org](https://git.dinotools.org/monitoring/check_snmp_multi)
- [Mirror at github.com](https://github.com/DinoTools/monitoring-check_snmp_multi)
License
-------
......
......@@ -3,6 +3,7 @@ use strict;
use warnings FATAL => 'all';
use Net::SNMP;
use Pod::Text::Termcap;
use constant OK => 0;
use constant WARNING => 1;
......@@ -34,9 +35,60 @@ BEGIN {
}
}
my $parser = Pod::Text::Termcap->new (sentence => 0, width => 78);
my $extra_doc = <<'END_MESSAGE';
=head1 Examples
Get two strings with custom OID
=head2 Example 1
B<Command>:
./check_snmp_multi.pl -C community -H hostname --value="Get String=string:.1.2.3" --value="Get 2nd string=string:.1.2.4"
B<Output>:
check_snmp_multi OK - Get String: Test Get 2nd string: Test 2
=cut
=head2 Example 2
B<Command>:
./check_snmp_multi.pl -C community -H hostname --loop_start=1 --loop_stop=2 --loop_value="Version=string:.1.2.3.\$id" --loop_value="Hardware=string:.1.2.4.\$id"
B<Output>:
check_snmp_multi OK
Loop: 1
=======
* Version: 1.0
* Hardware: 0031
Loop: 2
=======
* Version: 1.0
* Hardware: 0199
=cut
END_MESSAGE
my $extra_doc_output;
$parser->output_string(\$extra_doc_output);
$parser->parse_string_document($extra_doc);
my $mp = Monitoring::Plugin->new(
shortname => "check_snmp_multi",
usage => ""
usage => "",
extra => $extra_doc_output
);
$mp->add_arg(
......
/** vim: set filetype=icinga2:
*
*/
object CheckCommand "check_snmp_multi" {
import "plugin-check-command"
import "ipv4-or-ipv6"
command = [ PluginDir + "/check_snmp_multi.pl" ]
arguments = {
"-H" = {
value = "$check_snmp_multi_address$"
description = "Hostname of the unit."
required = true
}
"-C" = {
value = "$check_snmp_multi_community$"
description = "SNMP community. Defaults to 'public' if omitted."
}
"--loop_start" = {
value = "$check_snmp_multi_loop_start$"
}
"--loop_stop" = {
value = "$check_snmp_multi_loop_stop$"
}
"--loop_value" = {
value = "$check_snmp_multi_loop_values$"
repeat_key = true
}
"--value" = {
value = "$check_snmp_multi_values$"
repeat_key = true
}
}
vars.check_snmp_multi_address = "$check_address$"
}