Imported Upstream version 1.1.1
This commit is contained in:
parent
05f86278bc
commit
e8c75af4e8
75
Changelog
Normal file
75
Changelog
Normal file
|
@ -0,0 +1,75 @@
|
|||
################################
|
||||
Release 1.1.1 / April 2007 :
|
||||
|
||||
Added documentation in doc/ directory : (html format).
|
||||
|
||||
Scripts, actual CVS version and changelog :
|
||||
check_snmp_mem.pl : 1.3
|
||||
check_snmp_vrrp.pl : 1.3
|
||||
check_snmp_linkproof_nhr.pl : 1.1
|
||||
check_snmp_process.pl : 1.5
|
||||
Makina Corpus contribs : snmpv3 enhancements, msg size parameter (-o)
|
||||
check_snmp_boostedge.pl : 1.2 (No major changes)
|
||||
check_snmp_nsbox.pl : 1.2 (No major changes)
|
||||
check_snmp_css_main.pl : 1.1
|
||||
check_snmp_cpfw.pl : 1.7
|
||||
Added active/backup detection with SecureXL
|
||||
Added SIG{ALRM} sub and small bug
|
||||
check_snmp_int.pl : 1.18
|
||||
Added bigint module to take care of 64 bits counters
|
||||
check usage of snmp v2c or v3 when you use 64 bit counters (-g)
|
||||
Added SIG{ALRM} sub
|
||||
Added warning and critical levels in performance output
|
||||
Added labels before in, out speed and errors (M. Berger contrib)
|
||||
Added highperf counters option (-g)
|
||||
Added SNMP packet length option (-o)
|
||||
Added warning/critical levels in Mbps, MBps, Gbps, GBps options (-M, -G)
|
||||
Added warning/critical levels in % of interface speed (-u)
|
||||
Added performance output interface speed option (-S)
|
||||
Added performance output in Bps or bps (-Y)
|
||||
Added performance output in % of interface speed (-y)
|
||||
Added port for snmpv3 (R. Leroy contrib)
|
||||
check_snmp_storage.pl : 1.6
|
||||
Makina Corpus contribs : snmpv3 port parameter, msg size parameter (-o)
|
||||
check_snmp_win.pl : 0.6
|
||||
check_snmp_css.pl : 1.3
|
||||
check_snmp_env.pl : 1.7
|
||||
Added SIG{ALRM} sub
|
||||
Added voltage & temp checks on Cisco
|
||||
Added Foundry checks
|
||||
check_snmp_load.pl : 1.9
|
||||
Added SIG{ALRM} sub and % sign in output
|
||||
Bug in performance output
|
||||
|
||||
################################
|
||||
Release 1.1 :
|
||||
|
||||
Added scripts :
|
||||
- check_snmp_css_main : to get all services name and OID one time, then check only one OID with check_snmp_css. Reduces css cpu.
|
||||
|
||||
Corrected bugs :
|
||||
- install.sh (Net::snmp detection)
|
||||
- corrected bugs in check_snmp_css
|
||||
- Added ironport checks in check_snmp_env
|
||||
- Added hpux in check_snmp_load
|
||||
- Bugs in check_snmp_int (specially for Windows).
|
||||
|
||||
Scripts and versions :
|
||||
check_snmp_mem.pl : 1.3
|
||||
check_snmp_vrrp.pl : 1.3
|
||||
check_snmp_linkproof_nhr.pl : 1.1
|
||||
check_snmp_process.pl : 1.4
|
||||
check_snmp_boostedge.pl : 1.1
|
||||
check_snmp_nsbox.pl : 1.1
|
||||
check_snmp_css_main.pl : 1.1
|
||||
check_snmp_cpfw.pl : 1.4
|
||||
check_snmp_int.pl : 1.10
|
||||
check_snmp_storage.pl : 1.5
|
||||
check_snmp_win.pl : 0.6
|
||||
check_snmp_css.pl : 1.3
|
||||
check_snmp_env.pl : 1.4
|
||||
check_snmp_load.pl : 1.9
|
||||
|
||||
################################
|
||||
Release 1.0 :
|
||||
Initial file release.
|
32
README
32
README
|
@ -1,46 +1,38 @@
|
|||
Nagios SNMP plugins 1.0 README
|
||||
Nagios SNMP plugins 1.1.1 README
|
||||
------------------------------
|
||||
|
||||
|
||||
Nagios SNMP plugins is a set of Nagios plugins to check hosts/devices using snmp protocol.
|
||||
http://www.manubulon.com/nagios for more details.
|
||||
http://nagios.manubulon.com for more details.
|
||||
|
||||
|
||||
Requirements:
|
||||
-------------
|
||||
- perl
|
||||
- perl in /usr/bin/perl
|
||||
- Net::SNMP and Getopt::Long
|
||||
- File utils.pm in Nagios plugin directory (default /usr/local/nagios/libexec)
|
||||
- Nagios user can write files in /tmp/ directory
|
||||
|
||||
Perl, default directory and temp files location can be changed using the install.sh script.
|
||||
|
||||
Installation:
|
||||
-------------
|
||||
|
||||
You can simply copy the files to the Nagios Plugin directory if it is in /usr/local/nagios/libexec.
|
||||
|
||||
You can also use the "install.sh" script provided in this directory to install the plugins.
|
||||
Type : "./install.sh" to install all the plugins or "./install.sh <plugin name>" for a specific one.
|
||||
|
||||
The script will check for dependencies and ask for Nagios and temp directories.
|
||||
It will modify the scripts dependding on these answers and install the scripts.
|
||||
|
||||
By default, the scripts will consider :
|
||||
- perl is in /usr/bin/perl
|
||||
- Net::SNMP and Getopt::Long
|
||||
- Nagios plugins (and file utils.pm) are in /usr/local/nagios/libexec
|
||||
- Temp files will be written in /tmp
|
||||
Read INSTALL file
|
||||
|
||||
Help and support:
|
||||
-----------------
|
||||
|
||||
Help files, examples and manual : http://www.manubulon.com/nagios/
|
||||
FAQ : http://www.manubulon.com/nagios/faq.html
|
||||
Mailling list, forum : https://sourceforge.net/projects/nagios-snmp/
|
||||
Help files, config examples and FAQ in the doc/ directory
|
||||
http://nagios.manubulon.com/
|
||||
FAQ : http://nagios.manubulon.com/faq.html
|
||||
Mailling list, forum : http://sourceforge.net/projects/nagios-snmp/
|
||||
|
||||
|
||||
Legal stuff:
|
||||
------------
|
||||
|
||||
Nagios SNMP plugins version 1.0, Copyright (C) 2004-2006 Patrick Proy (nagios at proy.org)
|
||||
Nagios SNMP plugins version 1.1.1, Copyright (C) 2004-2007 Patrick Proy (nagios at proy.org)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License version 2 as
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/perl -w
|
||||
############################## check_snmp_boostedge.pl #################
|
||||
# Version : 1.0
|
||||
# Date : 27 Aug 2006
|
||||
# Date : Jan 16 2007
|
||||
# Author : Patrick Proy ( patrick at proy.org)
|
||||
# Help : http://www.manubulon.com/nagios/
|
||||
# Licence : GPL - http://www.fsf.org/licenses/gpl.txt
|
||||
|
@ -86,15 +86,15 @@ sub set_status { # return worst status with this order : OK, unknwonw, warning,
|
|||
return $cur_status;
|
||||
}
|
||||
|
||||
sub is_pattern_valid { # Test for things like "<I\s*[^>" or "+5-i"
|
||||
my $pat = shift;
|
||||
if (!defined($pat)) { $pat=" ";} # Just to get rid of compilation time warnings
|
||||
return eval { "" =~ /$pat/; 1 } || 0;
|
||||
sub is_pattern_valid { # Test for things like "<I\s*[^>" or "+5-i"
|
||||
my $pat = shift;
|
||||
if (!defined($pat)) { $pat=" ";} # Just to get rid of compilation time warnings
|
||||
return eval { "" =~ /$pat/; 1 } || 0;
|
||||
}
|
||||
|
||||
sub help {
|
||||
print "\nSNMP Boostedge service monitor for Nagios version ",$Version,"\n";
|
||||
print "(c)2004-2006 Patrick Proy\n\n";
|
||||
print "GPL Licensen, (c)2006-2007 Patrick Proy\n\n";
|
||||
print_usage();
|
||||
print <<EOT;
|
||||
-v, --verbose
|
||||
|
@ -249,9 +249,9 @@ if (!defined($session)) {
|
|||
|
||||
# Get global status
|
||||
my @oidlist=($be_global_status);
|
||||
my $resultat = (Net::SNMP->VERSION < 4) ?
|
||||
$session->get_request(@oidlist)
|
||||
: $session->get_request(-varbindlist => \@oidlist);
|
||||
my $resultat = (Net::SNMP->VERSION < 4) ?
|
||||
$session->get_request(@oidlist)
|
||||
: $session->get_request(-varbindlist => \@oidlist);
|
||||
|
||||
if (!defined($resultat)) {
|
||||
printf("ERROR: Gloabal status table : %s.\n", $session->error);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#!/usr/bin/perl -w
|
||||
############################## check_snmp_cpfw ##############
|
||||
# Version : 1.0
|
||||
# Date : Aug 23 2006
|
||||
# Version : 1.2.1
|
||||
# Date : April 19 2007
|
||||
# Author : Patrick Proy (patrick at proy.org)
|
||||
# Help : http://www.manubulon.com/nagios/
|
||||
# Help : http://nagios.manubulon.com
|
||||
# Licence : GPL - http://www.fsf.org/licenses/gpl.txt
|
||||
# TODO :
|
||||
# - check sync method
|
||||
|
@ -41,15 +41,16 @@ my @svn_checks_oid = ($svn_status);
|
|||
###### HA data
|
||||
|
||||
my $ha_active = "1.3.6.1.4.1.2620.1.5.5.0"; # "yes"
|
||||
my $ha_state = "1.3.6.1.4.1.2620.1.5.6.0"; # "active"
|
||||
my $ha_state = "1.3.6.1.4.1.2620.1.5.6.0"; # "active" / "standby"
|
||||
my $ha_block_state = "1.3.6.1.4.1.2620.1.5.7.0"; #"OK" : ha blocking state
|
||||
my $ha_status = "1.3.6.1.4.1.2620.1.5.102.0"; # "OK" : ha status
|
||||
|
||||
my %ha_checks =( $ha_active,"yes",$ha_state,"active",$ha_block_state,"OK",$ha_status,"OK");
|
||||
my %ha_checks_stand =( $ha_active,"yes",$ha_state,"standby",$ha_block_state,"OK",$ha_status,"OK");
|
||||
my %ha_checks_n =( $ha_active,"HA active",$ha_state,"HA state",$ha_block_state,"HA block state",$ha_status,"ha_status");
|
||||
my @ha_checks_oid =( $ha_active,$ha_state,$ha_block_state,$ha_status);
|
||||
|
||||
my $ha_mode = "1.3.6.1.4.1.2620.1.5.11.0"; # "Sync only" : ha Working mode
|
||||
my $ha_mode = "1.3.6.1.4.1.2620.1.5.11.0"; # "Sync only"/"High Availability (Active Up)" : ha Working mode
|
||||
|
||||
my $ha_tables = "1.3.6.1.4.1.2620.1.5.13.1"; # ha status table
|
||||
my $ha_tables_index = ".1";
|
||||
|
@ -72,7 +73,7 @@ my @mgmt_checks_oid = ($mgmt_status,$mgmt_alive);
|
|||
|
||||
#################################### Globals ##############################""
|
||||
|
||||
my $Version='1.0';
|
||||
my $Version='1.2.1';
|
||||
|
||||
my $o_host = undef; # hostname
|
||||
my $o_community = undef; # community
|
||||
|
@ -105,7 +106,7 @@ my $o_privpass= undef; # priv password
|
|||
sub p_version { print "check_snmp_cpfw version : $Version\n"; }
|
||||
|
||||
sub print_usage {
|
||||
print "Usage: $0 [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>]) [-s] [-w [-p=pol_name] [-c=warn,crit]] [-m] [-a] [-f] [-p <port>] [-t <timeout>] [-V]\n";
|
||||
print "Usage: $0 [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>]) [-s] [-w [-p=pol_name] [-c=warn,crit]] [-m] [-a [standby] ] [-f] [-p <port>] [-t <timeout>] [-V]\n";
|
||||
}
|
||||
|
||||
sub isnnum { # Return true if arg is not a number
|
||||
|
@ -116,7 +117,7 @@ sub isnnum { # Return true if arg is not a number
|
|||
|
||||
sub help {
|
||||
print "\nSNMP Checkpoint FW-1 Monitor for Nagios version ",$Version,"\n";
|
||||
print "GPL Licence, (c)2004-2006 - Patrick Proy\n\n";
|
||||
print "GPL Licence, (c)2004-2007 - Patrick Proy\n\n";
|
||||
print_usage();
|
||||
print <<EOT;
|
||||
-v, --verbose
|
||||
|
@ -141,8 +142,9 @@ sub help {
|
|||
check for svn status
|
||||
-w, --fw
|
||||
check for fw status
|
||||
-a, --ha
|
||||
check for ha status
|
||||
-a, --ha[=standby]
|
||||
check for ha status and node in "active" state
|
||||
If using SecurePlatform and monitoring a standby unit, put "standby" too
|
||||
-m, --mgmt
|
||||
check for management status
|
||||
-p, --policy=POLICY_NAME
|
||||
|
@ -180,7 +182,7 @@ sub check_options {
|
|||
'V' => \$o_version, 'version' => \$o_version,
|
||||
's' => \$o_svn, 'svn' => \$o_svn,
|
||||
'w' => \$o_fw, 'fw' => \$o_fw,
|
||||
'a' => \$o_ha, 'ha' => \$o_ha,
|
||||
'a:s' => \$o_ha, 'ha:s' => \$o_ha,
|
||||
'm' => \$o_mgmt, 'mgmt' => \$o_mgmt,
|
||||
'p:s' => \$o_policy, 'policy:s' => \$o_policy,
|
||||
'c:s' => \$o_conn, 'connexions:s' => \$o_conn,
|
||||
|
@ -226,6 +228,9 @@ sub check_options {
|
|||
{ print "Nothing selected for perfparse !\n";print_usage(); exit $ERRORS{"UNKNOWN"}}
|
||||
if (!defined($o_fw) && !defined($o_ha) && !defined($o_mgmt) && !defined($o_svn))
|
||||
{ print "Must select a product to check !\n";print_usage(); exit $ERRORS{"UNKNOWN"}}
|
||||
if (defined ($o_ha) && ($o_ha ne "") && ($o_ha ne "standby"))
|
||||
{ print "-a option comes with 'standby' or nothing !\n";print_usage(); exit $ERRORS{"UNKNOWN"}}
|
||||
|
||||
}
|
||||
|
||||
########## MAIN #######
|
||||
|
@ -241,6 +246,11 @@ if (defined($TIMEOUT)) {
|
|||
alarm ($o_timeout+10);
|
||||
}
|
||||
|
||||
$SIG{'ALRM'} = sub {
|
||||
print "No answer from host\n";
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
};
|
||||
|
||||
# Connect to host
|
||||
my ($session,$error);
|
||||
if ( defined($o_login) && defined($o_passwd)) {
|
||||
|
@ -252,6 +262,7 @@ if ( defined($o_login) && defined($o_passwd)) {
|
|||
-hostname => $o_host,
|
||||
-version => '3',
|
||||
-username => $o_login,
|
||||
-port => $o_port,
|
||||
-authpassword => $o_passwd,
|
||||
-authprotocol => $o_authproto,
|
||||
-timeout => $o_timeout
|
||||
|
@ -262,6 +273,7 @@ if ( defined($o_login) && defined($o_passwd)) {
|
|||
-hostname => $o_host,
|
||||
-version => '3',
|
||||
-username => $o_login,
|
||||
-port => $o_port,
|
||||
-authpassword => $o_passwd,
|
||||
-authprotocol => $o_authproto,
|
||||
-privpassword => $o_privpass,
|
||||
|
@ -389,18 +401,18 @@ if (defined ($o_fw)) {
|
|||
|
||||
if (defined($o_policy)) {
|
||||
if ($$resultat{$policy_name} ne $o_policy) {
|
||||
$fw_state=2;
|
||||
$fw_print .= "Policy installed : $$resultat{$policy_name}";
|
||||
$fw_state=2;
|
||||
$fw_print .= "Policy installed : $$resultat{$policy_name}";
|
||||
}
|
||||
}
|
||||
|
||||
if (defined($o_conn)) {
|
||||
if ($$resultat{$connections} > $o_crit) {
|
||||
$fw_state=2;
|
||||
$fw_print .= "Connexions : ".$$resultat{$connections}." > ".$o_crit." ";
|
||||
$fw_state=2;
|
||||
$fw_print .= "Connexions : ".$$resultat{$connections}." > ".$o_crit." ";
|
||||
} else {
|
||||
if ($$resultat{$connections} > $o_warn) {
|
||||
$fw_state=1;
|
||||
if ($fw_state!=2) {$fw_state=1;}
|
||||
$fw_print .= "Connexions : ".$$resultat{$connections}." > ".$o_warn." ";
|
||||
}
|
||||
}
|
||||
|
@ -434,9 +446,16 @@ if (defined ($o_ha)) {
|
|||
if (defined($resultat)) {
|
||||
foreach $key ( keys %ha_checks) {
|
||||
verb("$ha_checks_n{$key} : $ha_checks{$key} / $$resultat{$key}");
|
||||
if ( $$resultat{$key} ne $ha_checks{$key} ) {
|
||||
$ha_print .= $ha_checks_n{$key} . ":" . $$resultat{$key} . " ";
|
||||
$ha_state_n=2;
|
||||
if ( $o_ha eq "standby" ) {
|
||||
if ( $$resultat{$key} ne $ha_checks_stand{$key} ) {
|
||||
$ha_print .= $ha_checks_n{$key} . ":" . $$resultat{$key} . " ";
|
||||
$ha_state_n=2;
|
||||
}
|
||||
} else {
|
||||
if ( $$resultat{$key} ne $ha_checks{$key} ) {
|
||||
$ha_print .= $ha_checks_n{$key} . ":" . $$resultat{$key} . " ";
|
||||
$ha_state_n=2;
|
||||
}
|
||||
}
|
||||
}
|
||||
#my $ha_mode = "1.3.6.1.4.1.2620.1.5.11.0"; # "Sync only" : ha Working mode
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/perl -w
|
||||
############################## check_snmp_env #################
|
||||
# Version : 1.1
|
||||
# Date : Jan 11 2007
|
||||
# Version : 1.2
|
||||
# Date : April 19 2007
|
||||
# Author : Patrick Proy ( patrick at proy.org)
|
||||
# Help : http://www.manubulon.com/nagios/
|
||||
# Licence : GPL - http://www.fsf.org/licenses/gpl.txt
|
||||
|
@ -77,13 +77,13 @@ my $ciscoPSTableState = $ciscoPSTable.".3"; #Status
|
|||
# ciscoEnvMonSupplySource INTEGER
|
||||
|
||||
# Nokia env mib
|
||||
my $nokia_temp_tbl="1.3.6.1.4.1.94.1.21.1.1.5";
|
||||
my $nokia_temp="1.3.6.1.4.1.94.1.21.1.1.5.0";
|
||||
my $nokia_fan_table="1.3.6.1.4.1.94.1.21.1.2";
|
||||
my $nokia_fan_status="1.3.6.1.4.1.94.1.21.1.2.1.1.2";
|
||||
my $nokia_ps_table="1.3.6.1.4.1.94.1.21.1.3";
|
||||
my $nokia_ps_temp="1.3.6.1.4.1.94.1.21.1.3.1.1.2";
|
||||
my $nokia_ps_status="1.3.6.1.4.1.94.1.21.1.3.1.1.3";
|
||||
my $nokia_temp_tbl= "1.3.6.1.4.1.94.1.21.1.1.5";
|
||||
my $nokia_temp= "1.3.6.1.4.1.94.1.21.1.1.5.0";
|
||||
my $nokia_fan_table= "1.3.6.1.4.1.94.1.21.1.2";
|
||||
my $nokia_fan_status= "1.3.6.1.4.1.94.1.21.1.2.1.1.2";
|
||||
my $nokia_ps_table= "1.3.6.1.4.1.94.1.21.1.3";
|
||||
my $nokia_ps_temp= "1.3.6.1.4.1.94.1.21.1.3.1.1.2";
|
||||
my $nokia_ps_status= "1.3.6.1.4.1.94.1.21.1.3.1.1.3";
|
||||
|
||||
# Bluecoat env mib
|
||||
my @bc_SensorCode=("","ok","unknown","not-installed","voltage-low-warning","voltage-low-critical",
|
||||
|
@ -131,9 +131,23 @@ my $iron_fan_table = "1.3.6.1.4.1.15497.1.1.1.10"; # fan table
|
|||
my $iron_fan_rpm = "1.3.6.1.4.1.15497.1.1.1.10.1.2"; # fan speed in RPM
|
||||
my $iron_fan_name = "1.3.6.1.4.1.15497.1.1.1.10.1.3"; # fan name
|
||||
|
||||
# Foundry BigIron Router Switch (FOUNDRY-SN-AGENT-MIB)
|
||||
|
||||
my $foundry_temp = "1.3.6.1.4.1.1991.1.1.1.1.18.0"; # Chassis temperature in Deg C *2
|
||||
my $foundry_temp_warn = "1.3.6.1.4.1.1991.1.1.1.1.19.0"; # Chassis warn temperature in Deg C *2
|
||||
my $foundry_temp_crit = "1.3.6.1.4.1.1991.1.1.1.1.20.0"; # Chassis warn temperature in Deg C *2
|
||||
my $foundry_ps_table = "1.3.6.1.4.1.1991.1.1.1.2.1"; # PS table
|
||||
my $foundry_ps_desc = "1.3.6.1.4.1.1991.1.1.1.2.1.1.2"; # PS desc
|
||||
my $foundry_ps_status = "1.3.6.1.4.1.1991.1.1.1.2.1.1.3"; # PS status
|
||||
my $foundry_fan_table = "1.3.6.1.4.1.1991.1.1.1.3.1"; # FAN table
|
||||
my $foundry_fan_desc = "1.3.6.1.4.1.1991.1.1.1.3.1.1.2"; # FAN desc
|
||||
my $foundry_fan_status = "1.3.6.1.4.1.1991.1.1.1.3.1.1.3"; # FAN status
|
||||
|
||||
my @foundry_status = (3,0,2); # oper status : 1:other, 2: Normal, 3: Failure
|
||||
|
||||
# Globals
|
||||
|
||||
my $Version='1.1';
|
||||
my $Version='1.2';
|
||||
|
||||
my $o_host = undef; # hostname
|
||||
my $o_community = undef; # community
|
||||
|
@ -146,7 +160,7 @@ my $o_perf= undef; # Output performance data
|
|||
my $o_version2= undef; # use snmp v2c
|
||||
# check type
|
||||
my $o_check_type= "cisco"; # default Cisco
|
||||
my @valid_types =("cisco","nokia","bc","iron");
|
||||
my @valid_types =("cisco","nokia","bc","iron","foundry");
|
||||
my $o_temp= undef; # max temp
|
||||
my $o_fan= undef; # min fan speed
|
||||
|
||||
|
@ -163,7 +177,7 @@ my $o_privpass= undef; # priv password
|
|||
sub p_version { print "check_snmp_env version : $Version\n"; }
|
||||
|
||||
sub print_usage {
|
||||
print "Usage: $0 [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>]) [-p <port>] -T (cisco|nokia|lp|iron) [-F <rpm>] [-c <celcius>] [-f] [-t <timeout>] [-V]\n";
|
||||
print "Usage: $0 [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>]) [-p <port>] -T (cisco|nokia|bc|iron|foundry) [-F <rpm>] [-c <celcius>] [-f] [-t <timeout>] [-V]\n";
|
||||
}
|
||||
|
||||
sub isnnum { # Return true if arg is not a number
|
||||
|
@ -206,13 +220,14 @@ sub help {
|
|||
<privproto> : Priv protocole (des|aes : default des)
|
||||
-P, --port=PORT
|
||||
SNMP port (Default 161)
|
||||
-T, --type=cisco|nokia|bc
|
||||
-T, --type=cisco|nokia|bc|iron|foundry
|
||||
Environemental check :
|
||||
cisco : voltage,temp,fan,power supply status
|
||||
will try to check everything present
|
||||
nokia : fan and power supply
|
||||
bc : fans, power supply, voltage, disks
|
||||
iron : fans, power supply, temp
|
||||
foundry : power supply, temp
|
||||
-F, --fan=<rpm>
|
||||
Minimum fan rpm value
|
||||
-c, --celcius=<celcius>
|
||||
|
@ -291,6 +306,11 @@ if (defined($TIMEOUT)) {
|
|||
alarm ($o_timeout+10);
|
||||
}
|
||||
|
||||
$SIG{'ALRM'} = sub {
|
||||
print "No answer from host\n";
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
};
|
||||
|
||||
# Connect to host
|
||||
my ($session,$error);
|
||||
if ( defined($o_login) && defined($o_passwd)) {
|
||||
|
@ -394,8 +414,49 @@ if ( ($voltexist ==0) && ($tempexist ==0) && ($fanexist ==0) && ($psexist ==0) )
|
|||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
|
||||
my $perf_output="";
|
||||
# Get the data
|
||||
my ($i,$cur_status)=(undef,undef);
|
||||
|
||||
my $volt_global=0;
|
||||
my %volt_status;
|
||||
if ($fanexist !=0) {
|
||||
for ($i=0;$i < $voltexist; $i++) {
|
||||
$cur_status=$$resultat{$ciscoVoltageTableState. "." . $voltindex[$i]};
|
||||
verb ($$resultat{$ciscoVoltageTableDesc .".".$voltindex[$i]});
|
||||
verb ($cur_status);
|
||||
if (!defined ($cur_status)) { ### Error TODO
|
||||
$volt_global=1;
|
||||
}
|
||||
$perf_output.=" '".$$resultat{$ciscoVoltageTableDesc .".".$voltindex[$i]}."'=" ;
|
||||
$perf_output.=$$resultat{$ciscoVoltageTableValue."." . $voltindex[$i]};
|
||||
if ($Nagios_state[$CiscoEnvMonNagios{$cur_status}] ne "OK") {
|
||||
$volt_global= 1;
|
||||
$volt_status{$$resultat{$ciscoVoltageTableDesc .".".$voltindex[$i]}}=$cur_status;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
my $temp_global=0;
|
||||
my %temp_status;
|
||||
if ($tempexist !=0) {
|
||||
for ($i=0;$i < $tempexist; $i++) {
|
||||
$cur_status=$$resultat{$ciscoTempTableState . "." . $tempindex[$i]};
|
||||
verb ($$resultat{$ciscoTempTableDesc .".".$tempindex[$i]});
|
||||
verb ($cur_status);
|
||||
if (!defined ($cur_status)) { ### Error TODO
|
||||
$temp_global=1;
|
||||
}
|
||||
$perf_output.=" '".$$resultat{$ciscoTempTableDesc .".".$tempindex[$i]}."'=" ;
|
||||
$perf_output.=$$resultat{$ciscoTempTableValue."." . $tempindex[$i]};
|
||||
if ($Nagios_state[$CiscoEnvMonNagios{$cur_status}] ne "OK") {
|
||||
$temp_global= 1;
|
||||
$temp_status{$$resultat{$ciscoTempTableDesc .".".$tempindex[$i]}}=$cur_status;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
my $fan_global=0;
|
||||
my %fan_status;
|
||||
|
@ -407,7 +468,7 @@ if ($fanexist !=0) {
|
|||
if (!defined ($cur_status)) { ### Error TODO
|
||||
$fan_global=1;
|
||||
}
|
||||
if ($CiscoEnvMonNagios{$cur_status} ne "OK") {
|
||||
if ($Nagios_state[$CiscoEnvMonNagios{$cur_status}] ne "OK") {
|
||||
$fan_global= 1;
|
||||
$fan_status{$$resultat{$ciscoFanTableDesc .".".$fanindex[$i]}}=$cur_status;
|
||||
}
|
||||
|
@ -422,7 +483,7 @@ if ($psexist !=0) {
|
|||
if (!defined ($cur_status)) { ### Error TODO
|
||||
$fan_global=1;
|
||||
}
|
||||
if ($CiscoEnvMonNagios{$cur_status} ne "OK") {
|
||||
if ($Nagios_state[$CiscoEnvMonNagios{$cur_status}] ne "OK") {
|
||||
$ps_global= 1;
|
||||
$ps_status{$$resultat{$ciscoPSTableDesc .".".$psindex[$i]}}=$cur_status;
|
||||
}
|
||||
|
@ -431,9 +492,11 @@ if ($psexist !=0) {
|
|||
|
||||
my $global_state=0;
|
||||
my $output="";
|
||||
|
||||
if ($fanexist !=0) {
|
||||
if ($fan_global ==0) {
|
||||
$output .= $fanexist." Fan OK";
|
||||
$global_state=1 if ($global_state==0);
|
||||
} else {
|
||||
foreach (keys %fan_status) {
|
||||
$output .= "Fan " . $_ . ":" . $CiscoEnvMonState {$fan_status{$_}} ." ";
|
||||
|
@ -444,10 +507,11 @@ if ($fanexist !=0) {
|
|||
}
|
||||
}
|
||||
|
||||
$output .= "," if ($output ne "");
|
||||
if ($psexist !=0) {
|
||||
$output .= ", " if ($output ne "");
|
||||
if ($ps_global ==0) {
|
||||
$output .= $psexist." ps OK";
|
||||
$global_state=1 if ($global_state==0);
|
||||
} else {
|
||||
foreach (keys %ps_status) {
|
||||
$output .= "ps " . $_ . ":" . $CiscoEnvMonState {$ps_status{$_}} ." ";
|
||||
|
@ -458,6 +522,37 @@ if ($psexist !=0) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($voltexist !=0) {
|
||||
$output .= ", " if ($output ne "");
|
||||
if ($volt_global ==0) {
|
||||
$output .= $voltexist." volt OK";
|
||||
$global_state=1 if ($global_state==0);
|
||||
} else {
|
||||
foreach (keys %volt_status) {
|
||||
$output .= "volt " . $_ . ":" . $CiscoEnvMonState {$volt_status{$_}} ." ";
|
||||
if ($global_state < $CiscoEnvMonNagios{$volt_status{$_}} ) {
|
||||
$global_state = $CiscoEnvMonNagios{$volt_status{$_}} ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($tempexist !=0) {
|
||||
$output .= ", " if ($output ne "");
|
||||
if ($temp_global ==0) {
|
||||
$output .= $tempexist." temp OK";
|
||||
$global_state=1 if ($global_state==0);
|
||||
} else {
|
||||
foreach (keys %temp_status) {
|
||||
$output .= "temp " . $_ . ":" . $CiscoEnvMonState {$temp_status{$_}} ." ";
|
||||
if ($global_state < $CiscoEnvMonNagios{$temp_status{$_}} ) {
|
||||
$global_state = $CiscoEnvMonNagios{$temp_status{$_}} ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#print $output," : ",$Nagios_state[$global_state]," | ",$perf_output,"\n";
|
||||
print $output," : ",$Nagios_state[$global_state],"\n";
|
||||
$exit_val=$ERRORS{$Nagios_state[$global_state]};
|
||||
|
||||
|
@ -814,3 +909,98 @@ if ($global_status==2) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
########### Foundry env checks ##############
|
||||
|
||||
if ($o_check_type eq "foundry") {
|
||||
|
||||
verb("Checking foundry env");
|
||||
|
||||
my $global_status=0; # status to UNKNOWN
|
||||
my $output="";
|
||||
|
||||
# Get temperature
|
||||
|
||||
my @foundry_temp_oid=($foundry_temp,$foundry_temp_warn,$foundry_temp_crit);
|
||||
|
||||
my $result_temp = $session->get_request(
|
||||
Varbindlist => \@foundry_temp_oid
|
||||
);
|
||||
|
||||
my $temp_found=0;
|
||||
if (defined($result_temp)) {
|
||||
$temp_found=1;
|
||||
#Temp found
|
||||
$output = "Temp : " . $$result_temp{$foundry_temp} / 2;
|
||||
if ($$result_temp{$foundry_temp} > $$result_temp{$foundry_temp_crit}) { # Temp above critical
|
||||
$output.= " > ". $$result_temp{$foundry_temp_crit} / 2 . " : CRITICAL";
|
||||
$global_status=3;
|
||||
} elsif ( $$result_temp{$foundry_temp} > $$result_temp{$foundry_temp_warn}) { # Temp above warning
|
||||
$output.= " > ". $$result_temp{$foundry_temp_warn} / 2 . " : WARNING";
|
||||
$global_status=2;
|
||||
} else {
|
||||
$output.= " < ". $$result_temp{$foundry_temp_warn} / 2 . " : OK";
|
||||
$global_status=1;
|
||||
}
|
||||
}
|
||||
|
||||
# Get PS table (TODO : Bug in FAN table, see with Foundry).
|
||||
|
||||
my $result_ps = (Net::SNMP->VERSION < 4) ?
|
||||
$session->get_table($foundry_ps_table)
|
||||
: $session->get_table(Baseoid => $foundry_ps_table);
|
||||
|
||||
my $ps_num=0;
|
||||
if (defined($result_ps)) {
|
||||
$output .=", " if defined($output);
|
||||
foreach my $key ( keys %$result_ps) {
|
||||
verb("OID : $key, Desc : $$result_ps{$key}");
|
||||
if ($$result_ps{$key} =~ /$foundry_ps_desc/) {
|
||||
$ps_num++;
|
||||
my @oid_list = split (/\./,$key);
|
||||
my $index_ps = pop (@oid_list);
|
||||
$index_ps= $foundry_ps_status . "." . $index_ps;
|
||||
if (defined ($$result_ps{$index_ps})) {
|
||||
if ($$result_ps{$index_ps} == 3) {
|
||||
$output.="PS ".$$result_ps{$key}." : FAILURE";
|
||||
$global_status=3;
|
||||
} elsif ($$result_ps{$index_ps} == 2) {
|
||||
$global_status=1 if ($global_status==0);
|
||||
} else {
|
||||
$output.= "ps ".$$result_ps{$key}." : OTHER";
|
||||
}
|
||||
} else {
|
||||
$output.= "ps ".$$result_ps{$key}." : UNDEFINED STATUS";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$session->close;
|
||||
|
||||
if (($ps_num+$temp_found) == 0) {
|
||||
print "No data found : UNKNOWN\n";
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
|
||||
if ($global_status==1) {
|
||||
print $output." : all OK\n";
|
||||
exit $ERRORS{"OK"};
|
||||
}
|
||||
|
||||
if ($global_status==2) {
|
||||
print $output." : WARNING\n";
|
||||
exit $ERRORS{"WARNING"};
|
||||
}
|
||||
|
||||
if ($global_status==3) {
|
||||
print $output." : CRITICAL\n";
|
||||
exit $ERRORS{"CRITICAL"};
|
||||
}
|
||||
|
||||
print $output." : UNKNOWN\n";
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
|
||||
}
|
||||
|
||||
exit (3);
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#!/usr/bin/perl -w
|
||||
############################## check_snmp_int ##############
|
||||
# Version : 1.4.3
|
||||
# Date : Dec 11 2006
|
||||
# Version : 1.4.6
|
||||
# Date : April 23 2007
|
||||
# Author : Patrick Proy ( patrick at proy.org )
|
||||
# Help : http://www.manubulon.com/nagios/
|
||||
# Help : http://nagios.manubulon.com
|
||||
# Licence : GPL - http://www.fsf.org/licenses/gpl.txt
|
||||
# Contrib : J. Jungmann, S. Probst
|
||||
# Contrib : J. Jungmann, S. Probst, R. Leroy, M. Berger
|
||||
# TODO :
|
||||
# Check isdn "dormant" state
|
||||
# Maybe put base directory for performance as an option
|
||||
|
@ -35,10 +35,13 @@ my $index_table = '1.3.6.1.2.1.2.2.1.1';
|
|||
my $descr_table = '1.3.6.1.2.1.2.2.1.2';
|
||||
my $oper_table = '1.3.6.1.2.1.2.2.1.8.';
|
||||
my $admin_table = '1.3.6.1.2.1.2.2.1.7.';
|
||||
my $speed_table = '1.3.6.1.2.1.2.2.1.5.';
|
||||
my $in_octet_table = '1.3.6.1.2.1.2.2.1.10.';
|
||||
my $in_octet_table_64 = '1.3.6.1.2.1.31.1.1.1.6.';
|
||||
my $in_error_table = '1.3.6.1.2.1.2.2.1.14.';
|
||||
my $in_discard_table = '1.3.6.1.2.1.2.2.1.13.';
|
||||
my $out_octet_table = '1.3.6.1.2.1.2.2.1.16.';
|
||||
my $out_octet_table_64 = '1.3.6.1.2.1.31.1.1.1.10.';
|
||||
my $out_error_table = '1.3.6.1.2.1.2.2.1.20.';
|
||||
my $out_discard_table = '1.3.6.1.2.1.2.2.1.19.';
|
||||
|
||||
|
@ -46,11 +49,10 @@ my %status=(1=>'UP',2=>'DOWN',3=>'TESTING',4=>'UNKNOWN',5=>'DORMANT',6=>'NotPres
|
|||
|
||||
# Globals
|
||||
|
||||
my $Version='1.4.3';
|
||||
my $Version='1.4.6';
|
||||
|
||||
# Standard options
|
||||
my $o_host = undef; # hostname
|
||||
my $o_community = undef; # community
|
||||
my $o_version2 = undef; #use snmp v2c
|
||||
my $o_port = 161; # port
|
||||
my $o_descr = undef; # description filter
|
||||
my $o_help= undef; # wan't some help ?
|
||||
|
@ -59,8 +61,15 @@ my $o_inverse= undef; # Critical when up
|
|||
my $o_verb= undef; # verbose mode
|
||||
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...).
|
||||
# Performance data options
|
||||
my $o_perf= undef; # Output performance data
|
||||
my $o_perfe= undef; # Output discard/error also in perf data
|
||||
my $o_perfs= undef; # include speed in performance output (-S)
|
||||
my $o_perfp= undef; # output performance data in % of max speed (-y)
|
||||
my $o_perfr= undef; # output performance data in bits/s or Bytes/s (-Y)
|
||||
# Speed/error checks
|
||||
my $o_checkperf= undef; # checks in/out/err/disc values
|
||||
my $o_delta= 300; # delta of time of perfcheck (default 5min)
|
||||
my $o_ext_checkperf= undef; # extended perf checks (+error+discard)
|
||||
|
@ -69,10 +78,17 @@ my $o_crit_opt= undef; # critical options
|
|||
my $o_kbits= undef; # Warn and critical in Kbits instead of KBytes
|
||||
my @o_warn= undef; # warning levels of perfcheck
|
||||
my @o_crit= undef; # critical levels of perfcheck
|
||||
my $o_short= undef; # set maximum of n chars to be displayed
|
||||
my $o_highperf= undef; # Use 64 bits counters
|
||||
my $o_meg= undef; # output in MBytes or Mbits (-M)
|
||||
my $o_gig= undef; # output in GBytes or Gbits (-G)
|
||||
my $o_prct= undef; # output in % of max speed (-u)
|
||||
|
||||
my $o_timeout= undef; # Timeout (Default 5)
|
||||
# SNMPv3 specific
|
||||
# SNMP Message size parameter (Makina Corpus contrib)
|
||||
my $o_octetlength=undef;
|
||||
# Login options specific
|
||||
my $o_community = undef; # community
|
||||
my $o_version2 = undef; #use snmp v2c
|
||||
my $o_login= undef; # Login for snmpv3
|
||||
my $o_passwd= undef; # Pass for snmpv3
|
||||
my $v3protocols=undef; # V3 protocol list.
|
||||
|
@ -80,6 +96,10 @@ my $o_authproto='md5'; # Auth protocol
|
|||
my $o_privproto='des'; # Priv protocol
|
||||
my $o_privpass= undef; # priv password
|
||||
|
||||
# Readable names for counters (M. Berger contrib)
|
||||
my @countername = ( "in=" , "out=" , "errors-in=" , "errors-out=" , "discard-in=" , "discard-out=" );
|
||||
my $checkperf_out_desc;
|
||||
|
||||
# functions
|
||||
|
||||
sub read_file {
|
||||
|
@ -132,7 +152,7 @@ sub write_file {
|
|||
sub p_version { print "check_snmp_int version : $Version\n"; }
|
||||
|
||||
sub print_usage {
|
||||
print "Usage: $0 [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>) [-p <port>] -n <name in desc_oid> [-i] [-a] [-r] [-f[e]] [-k[qB] -w<warn levels> -c<crit levels> -d<delta>] [-t <timeout>] [-s] [-V]\n";
|
||||
print "Usage: $0 [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>) [-p <port>] -n <name in desc_oid> [-i] [-a] [-r] [-f[eSyY]] [-k[qBMGu] -g -w<warn levels> -c<crit levels> -d<delta>] [-o <octet_length>] [-t <timeout>] [-s] --label [-V]\n";
|
||||
}
|
||||
|
||||
sub isnnum { # Return true if arg is not a number
|
||||
|
@ -143,7 +163,7 @@ sub isnnum { # Return true if arg is not a number
|
|||
|
||||
sub help {
|
||||
print "\nSNMP Network Interface Monitor for Nagios version ",$Version,"\n";
|
||||
print "GPL licence, (c)2004-2006 Patrick Proy\n\n";
|
||||
print "GPL licence, (c)2004-2007 Patrick Proy\n\n";
|
||||
print_usage();
|
||||
print <<EOT;
|
||||
-v, --verbose
|
||||
|
@ -169,28 +189,49 @@ sub help {
|
|||
Name in description OID (eth0, ppp0 ...).
|
||||
This is treated as a regexp : -n eth will match eth0,eth1,...
|
||||
Test it before, because there are known bugs (ex : trailling /)
|
||||
-r, --noregexp
|
||||
Do not use regexp to match NAME in description OID
|
||||
-i, --inverse
|
||||
Make critical when up
|
||||
-a, --admin
|
||||
Use administrative status instead of operational
|
||||
-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.
|
||||
-f, --perfparse
|
||||
Perfparse compatible output (no output when interface is down).
|
||||
-e, --error
|
||||
Add error & discard to Perfparse output
|
||||
-r, --noregexp
|
||||
Do not use regexp to match NAME in description OID
|
||||
-k, --perfcheck ; -q, --extperfcheck
|
||||
-S, --intspeed
|
||||
Include speed in performance output in bits/s
|
||||
-y, --perfprct ; -Y, --perfspeed
|
||||
-y : output performance data in % of max speed
|
||||
-Y : output performance data in bits/s or Bytes/s (depending on -B)
|
||||
-k, --perfcheck ; -q, --extperfcheck
|
||||
-k check the input/ouput bandwidth of the interface
|
||||
-q also check the error and discard input/output
|
||||
--label
|
||||
Add label before speed in output : in=, out=, errors-out=, etc...
|
||||
-g, --64bits
|
||||
Use 64 bits counters instead of the standard counters
|
||||
when checking bandwidth & performance data.
|
||||
You must use snmp v2c or v3 to get 64 bits counters.
|
||||
-d, --delta=seconds
|
||||
make an average of <delta> seconds (default 300=5min)
|
||||
-B, --kbits
|
||||
Make the warning and critical levels in KBits/s instead of KBytes/s
|
||||
Make the warning and critical levels in K|M|G Bits/s instead of K|M|G Bytes/s
|
||||
-G, --giga ; -M, --mega ; -u, --prct
|
||||
-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]
|
||||
warning level for input / output bandwidth in KBytes/s (0 for no warning)
|
||||
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]
|
||||
critical level for input / output bandwidth in KBytes/s (0 for no critical)
|
||||
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)
|
||||
-s, --short=int
|
||||
Make the output shorter : only the first <n> chars of the interface(s)
|
||||
|
@ -234,6 +275,15 @@ sub check_options {
|
|||
'c:s' => \$o_crit_opt, 'critical:s' => \$o_crit_opt,
|
||||
'B' => \$o_kbits, 'kbits' => \$o_kbits,
|
||||
's:i' => \$o_short, 'short:i' => \$o_short,
|
||||
'g' => \$o_highperf, '64bits' => \$o_highperf,
|
||||
'S' => \$o_perfs, 'intspeed' => \$o_perfs,
|
||||
'y' => \$o_perfp, 'perfprct' => \$o_perfp,
|
||||
'Y' => \$o_perfr, 'perfspeed' => \$o_perfr,
|
||||
'M' => \$o_meg, 'mega' => \$o_meg,
|
||||
'G' => \$o_gig, 'giga' => \$o_gig,
|
||||
'u' => \$o_prct, 'prct' => \$o_prct,
|
||||
'o:i' => \$o_octetlength, 'octetlength:i' => \$o_octetlength,
|
||||
'label' => \$o_label,
|
||||
'd:i' => \$o_delta, 'delta:i' => \$o_delta
|
||||
);
|
||||
if (defined ($o_help) ) { help(); exit $ERRORS{"UNKNOWN"}};
|
||||
|
@ -256,9 +306,22 @@ sub check_options {
|
|||
if (defined($o_timeout) && (isnnum($o_timeout) || ($o_timeout < 2) || ($o_timeout > 60)))
|
||||
{ print "Timeout must be >1 and <60 !\n"; print_usage(); exit $ERRORS{"UNKNOWN"}}
|
||||
if (!defined($o_timeout)) {$o_timeout=5;}
|
||||
# Check snmpv2c or v3 with 64 bit counters
|
||||
if ( defined ($o_highperf) && (!defined($o_version2) && defined($o_community)))
|
||||
{ print "Can't get 64 bit counters with snmp version 1\n"; print_usage(); exit $ERRORS{"UNKNOWN"}}
|
||||
if (defined ($o_highperf)) {
|
||||
if (eval "require bigint") {
|
||||
use bigint;
|
||||
} else { print "Need bigint module for 64 bit counters\n"; print_usage(); exit $ERRORS{"UNKNOWN"}}
|
||||
}
|
||||
|
||||
# check if -e without -f
|
||||
if ( defined($o_perfe) && !defined($o_perf))
|
||||
{ print "Cannot output error without -f option!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}}
|
||||
{ print "Cannot output error 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(); exit $ERRORS{"UNKNOWN"}}
|
||||
if ((defined ($o_perfr) || defined($o_perfp) ) && !defined($o_checkperf)) {
|
||||
print "Cannot put -Y or -y options without perf check option (-k) \n"; print_usage(); exit $ERRORS{"UNKNOWN"}}
|
||||
if (defined ($o_short)) {
|
||||
#TODO maybe some basic tests ? caracters return empty string
|
||||
}
|
||||
|
@ -283,7 +346,14 @@ sub check_options {
|
|||
print "Warning must be < Critical level \n"; print_usage(); exit $ERRORS{"UNKNOWN"}
|
||||
}
|
||||
}
|
||||
if ((defined ($o_meg) && defined($o_gig) ) || (defined ($o_meg) && defined($o_prct) )|| (defined ($o_gig) && defined($o_prct) )) {
|
||||
print "-M -G and -u options are exclusives\n"; print_usage(); exit $ERRORS{"UNKNOWN"}
|
||||
}
|
||||
}
|
||||
#### octet length checks
|
||||
if (defined ($o_octetlength) && (isnnum($o_octetlength) || $o_octetlength > 65535 || $o_octetlength < 484 )) {
|
||||
print "octet lenght must be < 65535 and > 484\n";print_usage(); exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
}
|
||||
|
||||
########## MAIN #######
|
||||
|
@ -299,6 +369,11 @@ if (defined($TIMEOUT)) {
|
|||
alarm ($o_timeout+10);
|
||||
}
|
||||
|
||||
$SIG{'ALRM'} = sub {
|
||||
print "No answer from host\n";
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
};
|
||||
|
||||
# Connect to host
|
||||
my ($session,$error);
|
||||
if ( defined($o_login) && defined($o_passwd)) {
|
||||
|
@ -308,6 +383,7 @@ if ( defined($o_login) && defined($o_passwd)) {
|
|||
($session, $error) = Net::SNMP->session(
|
||||
-hostname => $o_host,
|
||||
-version => '3',
|
||||
-port => $o_port,
|
||||
-username => $o_login,
|
||||
-authpassword => $o_passwd,
|
||||
-authprotocol => $o_authproto,
|
||||
|
@ -319,6 +395,7 @@ if ( defined($o_login) && defined($o_passwd)) {
|
|||
-hostname => $o_host,
|
||||
-version => '3',
|
||||
-username => $o_login,
|
||||
-port => $o_port,
|
||||
-authpassword => $o_passwd,
|
||||
-authprotocol => $o_authproto,
|
||||
-privpassword => $o_privpass,
|
||||
|
@ -353,6 +430,20 @@ if (!defined($session)) {
|
|||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
|
||||
if (defined($o_octetlength)) {
|
||||
my $oct_resultat=undef;
|
||||
my $oct_test= $session->max_msg_size();
|
||||
verb(" actual max octets:: $oct_test");
|
||||
$oct_resultat = $session->max_msg_size($o_octetlength);
|
||||
if (!defined($oct_resultat)) {
|
||||
printf("ERROR: Session settings : %s.\n", $session->error);
|
||||
$session->close;
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
$oct_test= $session->max_msg_size();
|
||||
verb(" new max octets:: $oct_test");
|
||||
}
|
||||
|
||||
# Get desctiption table
|
||||
my $resultat = $session->get_table(
|
||||
Baseoid => $descr_table
|
||||
|
@ -368,8 +459,16 @@ my @oids = undef;
|
|||
my @descr = undef;
|
||||
my (@oid_perf,@oid_perf_outoct,@oid_perf_inoct,@oid_perf_inerr,@oid_perf_outerr,@oid_perf_indisc,@oid_perf_outdisc)=
|
||||
(undef,undef,undef,undef,undef,undef,undef);
|
||||
my @oid_speed=undef;
|
||||
my $num_int = 0;
|
||||
|
||||
# Change to 64 bit counters if option is set :
|
||||
if (defined($o_highperf)) {
|
||||
$out_octet_table=$out_octet_table_64;
|
||||
$in_octet_table=$in_octet_table_64;
|
||||
}
|
||||
|
||||
|
||||
# Select interface by regexp of exact match
|
||||
# and put the oid to query in an array
|
||||
|
||||
|
@ -395,6 +494,7 @@ foreach my $key ( keys %$resultat) {
|
|||
if (defined($o_perf) || defined($o_checkperf)) {
|
||||
$oid_perf_inoct[$num_int]= $in_octet_table . $tindex[$num_int];
|
||||
$oid_perf_outoct[$num_int]= $out_octet_table . $tindex[$num_int];
|
||||
$oid_speed[$num_int]=$speed_table . $tindex[$num_int];
|
||||
if (defined($o_ext_checkperf) || defined($o_perfe)) {
|
||||
$oid_perf_indisc[$num_int]= $in_discard_table . $tindex[$num_int];
|
||||
$oid_perf_outdisc[$num_int]= $out_discard_table . $tindex[$num_int];
|
||||
|
@ -419,7 +519,7 @@ if (!defined($result)) { printf("ERROR: Status table : %s.\n", $session->error);
|
|||
}
|
||||
# Get the perf value if -f (performance) option defined or -k (check bandwidth)
|
||||
if (defined($o_perf)||defined($o_checkperf)) {
|
||||
@oid_perf=(@oid_perf_outoct,@oid_perf_inoct,@oid_perf_inerr,@oid_perf_outerr,@oid_perf_indisc,@oid_perf_outdisc);
|
||||
@oid_perf=(@oid_perf_outoct,@oid_perf_inoct,@oid_perf_inerr,@oid_perf_outerr,@oid_perf_indisc,@oid_perf_outdisc,@oid_speed);
|
||||
$resultf = $session->get_request(
|
||||
Varbindlist => \@oid_perf
|
||||
);
|
||||
|
@ -433,6 +533,7 @@ $session->close;
|
|||
|
||||
my $num_ok=0;
|
||||
my @checkperf_out=undef;
|
||||
my @checkperf_out_raw=undef;
|
||||
### Bandwidth test variables
|
||||
my $temp_file_name;
|
||||
my ($return,@file_values)=(undef,undef);
|
||||
|
@ -442,6 +543,7 @@ my $timenow=time;
|
|||
my $trigger=$timenow - ($o_delta - ($o_delta/10));
|
||||
my $trigger_low=$timenow - 3*$o_delta;
|
||||
my ($old_value,$old_time)=undef;
|
||||
my $speed_unit=undef;
|
||||
|
||||
# define the OK value depending on -i option
|
||||
my $ok_val= defined ($o_inverse) ? 2 : 1;
|
||||
|
@ -452,7 +554,7 @@ my ($print_out,$perf_out)=(undef,undef);
|
|||
for (my $i=0;$i < $num_int; $i++) {
|
||||
$print_out.=", " if (defined($print_out));
|
||||
$perf_out .= " " if (defined ($perf_out)) ;
|
||||
|
||||
my $usable_data=1;
|
||||
# Get the status of the current interface
|
||||
my $int_status= defined ($o_admin) ? $$result{$admin_table . $tindex[$i]}
|
||||
: $$result{ $oper_table . $tindex[$i] };
|
||||
|
@ -468,22 +570,59 @@ for (my $i=0;$i < $num_int; $i++) {
|
|||
$n_rows = shift(@ret_array);
|
||||
if ($n_rows != 0) { @file_values = @ret_array };
|
||||
verb ("File read returns : $return with $n_rows rows");
|
||||
verb ("Interface speed : $$resultf{$oid_speed[$i]}");
|
||||
#make the checks if the file is OK
|
||||
if ($return ==0) {
|
||||
my $j=$n_rows-1;
|
||||
@checkperf_out=undef;
|
||||
@checkperf_out_raw=undef;
|
||||
do {
|
||||
if ($file_values[$j][0] < $trigger) {
|
||||
if ($file_values[$j][0] > $trigger_low) {
|
||||
# check if the counter is back to 0 after 2^32.
|
||||
my $overfl = ($$resultf{$oid_perf_inoct[$i]} >= $file_values[$j][1] ) ? 0 : 4294967296;
|
||||
my $speed_metric = (defined($o_kbits))? 128 : 1024;
|
||||
$checkperf_out[0] = ( ($overfl + $$resultf{$oid_perf_inoct[$i]} - $file_values[$j][1])/
|
||||
($timenow - $file_values[$j][0] ))/$speed_metric;
|
||||
# Define the speed metric ( K | M | G ) (Bits|Bytes) or %
|
||||
my $speed_metric=undef;
|
||||
if (defined($o_prct)) { # in % of speed
|
||||
# Speed is in bits/s, calculated speed is in Bytes/s
|
||||
$speed_metric=$$resultf{$oid_speed[$i]}/800;
|
||||
$speed_unit="%";
|
||||
} else {
|
||||
if (defined($o_kbits)) { # metric in bits
|
||||
if (defined($o_meg)) { # in Mbit/s = 1000000 bit/s
|
||||
$speed_metric=125000; # (1000/8) * 1000
|
||||
$speed_unit="Mbps";
|
||||
} elsif (defined($o_gig)) { # in Gbit/s = 1000000000 bit/s
|
||||
$speed_metric=125000000; # (1000/8) * 1000 * 1000
|
||||
$speed_unit="Gbps";
|
||||
} else { # in Kbits
|
||||
$speed_metric=125; # ( 1000/8 )
|
||||
$speed_unit="Kbps";
|
||||
}
|
||||
} else { # metric in byte
|
||||
if (defined($o_meg)) { # in Mbits
|
||||
$speed_metric=1048576; # 1024^2
|
||||
$speed_unit="MBps";
|
||||
} elsif (defined($o_gig)) { # in Mbits
|
||||
$speed_metric=1073741824; # 1024^3
|
||||
$speed_unit="GBps";
|
||||
} else {
|
||||
$speed_metric=1024; # 1024^3
|
||||
$speed_unit="KBps";
|
||||
}
|
||||
}
|
||||
}
|
||||
# check if the counter is back to 0 after 2^32 / 2^64.
|
||||
# First set the modulus depending on highperf counters or not
|
||||
my $overfl_mod = defined ($o_highperf) ? 18446744073709551616 : 4294967296;
|
||||
# Check counter (s)
|
||||
my $overfl = ($$resultf{$oid_perf_inoct[$i]} >= $file_values[$j][1] ) ? 0 : $overfl_mod;
|
||||
$checkperf_out_raw[0] = ( ($overfl + $$resultf{$oid_perf_inoct[$i]} - $file_values[$j][1])/
|
||||
($timenow - $file_values[$j][0] ));
|
||||
$checkperf_out[0] = $checkperf_out_raw[0] / $speed_metric;
|
||||
|
||||
$overfl = ($$resultf{$oid_perf_outoct[$i]} >= $file_values[$j][2] ) ? 0 : 4294967296;
|
||||
$checkperf_out[1] = ( ($overfl + $$resultf{$oid_perf_outoct[$i]} - $file_values[$j][2])/
|
||||
($timenow - $file_values[$j][0] ))/$speed_metric;
|
||||
$overfl = ($$resultf{$oid_perf_outoct[$i]} >= $file_values[$j][2] ) ? 0 : $overfl_mod;
|
||||
$checkperf_out_raw[1] = ( ($overfl + $$resultf{$oid_perf_outoct[$i]} - $file_values[$j][2])/
|
||||
($timenow - $file_values[$j][0] ));
|
||||
$checkperf_out[1] = $checkperf_out_raw[1] / $speed_metric;
|
||||
|
||||
if (defined($o_ext_checkperf)) {
|
||||
$checkperf_out[2] = ( ($$resultf{$oid_perf_inerr[$i]} - $file_values[$j][3])/
|
||||
|
@ -532,21 +671,25 @@ for (my $i=0;$i < $num_int; $i++) {
|
|||
# check 2 or 6 values depending on ext_check_perf
|
||||
my $num_checkperf=(defined($o_ext_checkperf))?6:2;
|
||||
for (my $l=0;$l < $num_checkperf;$l++) {
|
||||
# Set labels if needed
|
||||
$checkperf_out_desc= (defined($o_label)) ? $countername[$l] : "";
|
||||
verb("Interface $i, check $l : $checkperf_out[$l]");
|
||||
if ($l!=0) {$print_out.="/";}
|
||||
if (($o_crit[$l]!=0) && ($checkperf_out[$l]>$o_crit[$l])) {
|
||||
$final_status=2;
|
||||
$print_out.= sprintf("CRIT : %.1f",$checkperf_out[$l]);
|
||||
$print_out.= sprintf("CRIT %s%.1f",$checkperf_out_desc,$checkperf_out[$l]);
|
||||
} elsif (($o_warn[$l]!=0) && ($checkperf_out[$l]>$o_warn[$l])) {
|
||||
$final_status=($final_status==2)?2:1;
|
||||
$print_out.= sprintf("WARN : %.1f",$checkperf_out[$l]);
|
||||
} else {
|
||||
$print_out.= sprintf("%.1f",$checkperf_out[$l]);
|
||||
}
|
||||
}
|
||||
$final_status=($final_status==2)?2:1;
|
||||
$print_out.= sprintf("WARN %s%.1f",$checkperf_out_desc,$checkperf_out[$l]);
|
||||
} else {
|
||||
$print_out.= sprintf("%s%.1f",$checkperf_out_desc,$checkperf_out[$l]);
|
||||
}
|
||||
if ( $l==0 || $l == 1) { $print_out.= $speed_unit; }
|
||||
}
|
||||
$print_out .= ")";
|
||||
} else { # Return unknown when no data
|
||||
$print_out.= " No usable data on file (".$n_rows." rows) ";
|
||||
$final_status=3;
|
||||
$final_status=3;$usable_data=0;
|
||||
}
|
||||
} else {
|
||||
if (defined ($o_short)) {
|
||||
|
@ -564,14 +707,59 @@ for (my $i=0;$i < $num_int; $i++) {
|
|||
$num_ok++;
|
||||
}
|
||||
if (( $int_status == 1 ) && defined ($o_perf)) {
|
||||
$perf_out .= "'" . $descr[$i] ."_in_octet'=". $$resultf{$oid_perf_inoct[$i]} ."c ";
|
||||
$perf_out .= "'" . $descr[$i] ."_out_octet'=". $$resultf{$oid_perf_outoct[$i]} ."c";
|
||||
if (defined ($o_perfp)) { # output in % of speed
|
||||
if ($usable_data==1) {
|
||||
$perf_out .= "'" . $descr[$i] ."_in_prct'=";
|
||||
$perf_out .= sprintf("%.0f",$checkperf_out_raw[0] * 800 / $$resultf{$oid_speed[$i]}) ."%;";
|
||||
$perf_out .= ($o_warn[0]!=0) ? $o_warn[0] . ";" : ";";
|
||||
$perf_out .= ($o_crit[0]!=0) ? $o_crit[0] . ";" : ";";
|
||||
$perf_out .= "0;100 ";
|
||||
$perf_out .= "'" . $descr[$i] ."_out_prct'=";
|
||||
$perf_out .= sprintf("%.0f",$checkperf_out_raw[1] * 800 / $$resultf{$oid_speed[$i]}) ."%;";
|
||||
$perf_out .= ($o_warn[1]!=0) ? $o_warn[1] . ";" : ";";
|
||||
$perf_out .= ($o_crit[1]!=0) ? $o_crit[1] . ";" : ";";
|
||||
$perf_out .= "0;100 ";
|
||||
}
|
||||
} elsif (defined ($o_perfr)) { # output in bites or Bytes /s
|
||||
if ($usable_data==1) {
|
||||
if (defined($o_kbits)) { # bps
|
||||
# put warning and critical levels into bps or Bps
|
||||
my $warn_factor = (defined($o_meg)) ? 1000000 : (defined($o_gig)) ? 1000000000 : 1000;
|
||||
$perf_out .= "'" . $descr[$i] ."_in_bps'=";
|
||||
$perf_out .= sprintf("%.0f",$checkperf_out_raw[0] * 8) .";";
|
||||
$perf_out .= ($o_warn[0]!=0) ? $o_warn[0]*$warn_factor . ";" : ";";
|
||||
$perf_out .= ($o_crit[0]!=0) ? $o_crit[0]*$warn_factor . ";" : ";";
|
||||
$perf_out .= "0;". $$resultf{$oid_speed[$i]} ." ";
|
||||
$perf_out .= "'" . $descr[$i] ."_out_bps'=";
|
||||
$perf_out .= sprintf("%.0f",$checkperf_out_raw[1] * 8) .";";
|
||||
$perf_out .= ($o_warn[1]!=0) ? $o_warn[1]*$warn_factor . ";" : ";";
|
||||
$perf_out .= ($o_crit[1]!=0) ? $o_crit[1]*$warn_factor . ";" : ";";
|
||||
$perf_out .= "0;". $$resultf{$oid_speed[$i]} ." ";
|
||||
} else { # Bps
|
||||
my $warn_factor = (defined($o_meg)) ? 1048576 : (defined($o_gig)) ? 1073741824 : 1024;
|
||||
$perf_out .= "'" . $descr[$i] ."_in_Bps'=" . sprintf("%.0f",$checkperf_out_raw[0]) .";";
|
||||
$perf_out .= ($o_warn[0]!=0) ? $o_warn[0]*$warn_factor . ";" : ";";
|
||||
$perf_out .= ($o_crit[0]!=0) ? $o_crit[0]*$warn_factor . ";" : ";";
|
||||
$perf_out .= "0;". $$resultf{$oid_speed[$i]} ." ";
|
||||
$perf_out .= "'" . $descr[$i] ."_out_Bps'=" . sprintf("%.0f",$checkperf_out_raw[1]) .";" ;
|
||||
$perf_out .= ($o_warn[1]!=0) ? $o_warn[1]*$warn_factor . ";" : ";";
|
||||
$perf_out .= ($o_crit[1]!=0) ? $o_crit[1]*$warn_factor . ";" : ";";
|
||||
$perf_out .= "0;". $$resultf{$oid_speed[$i]} ." ";
|
||||
}
|
||||
}
|
||||
} else { # output in octet counter
|
||||
$perf_out .= "'" . $descr[$i] ."_in_octet'=". $$resultf{$oid_perf_inoct[$i]} ."c ";
|
||||
$perf_out .= "'" . $descr[$i] ."_out_octet'=". $$resultf{$oid_perf_outoct[$i]} ."c";
|
||||
}
|
||||
if (defined ($o_perfe)) {
|
||||
$perf_out .= " '" . $descr[$i] ."_in_error'=". $$resultf{$oid_perf_inerr[$i]} ."c ";
|
||||
$perf_out .= "'" . $descr[$i] ."_in_discard'=". $$resultf{$oid_perf_indisc[$i]} ."c ";
|
||||
$perf_out .= "'" . $descr[$i] ."_out_error'=". $$resultf{$oid_perf_outerr[$i]} ."c ";
|
||||
$perf_out .= "'" . $descr[$i] ."_out_discard'=". $$resultf{$oid_perf_outdisc[$i]} ."c";
|
||||
}
|
||||
if (defined ($o_perfs)) {
|
||||
$perf_out .= " '" . $descr[$i] ."_speed_bps'=".$$resultf{$oid_speed[$i]};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -597,7 +785,7 @@ if ($num_ok == $num_int) {
|
|||
exit $ERRORS{"CRITICAL"};
|
||||
} else {
|
||||
print $print_out,":(", $num_ok, " UP): UNKNOWN";
|
||||
if (defined ($o_perf)) { print " | ",$perf_out; }
|
||||
if (defined ($perf_out)) { print " | ",$perf_out; }
|
||||
print "\n";
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
|
@ -606,7 +794,7 @@ if ($num_ok == $num_int) {
|
|||
# else print the not OK interface number and exit (return is always critical if at least one int is down).
|
||||
|
||||
print $print_out,": ", $num_int-$num_ok, " int NOK : CRITICAL";
|
||||
if (defined ($o_perf) && defined ($perf_out)) { print " | ",$perf_out; }
|
||||
if (defined ($perf_out)) { print " | ",$perf_out; }
|
||||
print "\n";
|
||||
exit $ERRORS{"CRITICAL"};
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/perl -w
|
||||
############################## check_snmp_load #################
|
||||
# Version : 1.3.1
|
||||
# Date : 8 Sept 2006
|
||||
# Version : 1.3.2
|
||||
# Date : Jan 16 2007
|
||||
# Author : Patrick Proy ( patrick at proy.org)
|
||||
# Help : http://www.manubulon.com/nagios/
|
||||
# Licence : GPL - http://www.fsf.org/licenses/gpl.txt
|
||||
|
@ -94,7 +94,7 @@ my %cpu_oid = ("netsc",$ns_cpu_idle,"as400",$as400_cpu,"bc",$bluecoat_cpu,"nokia
|
|||
|
||||
# Globals
|
||||
|
||||
my $Version='1.3.1';
|
||||
my $Version='1.3.2';
|
||||
|
||||
my $o_host = undef; # hostname
|
||||
my $o_community = undef; # community
|
||||
|
@ -136,7 +136,7 @@ sub isnnum { # Return true if arg is not a number
|
|||
|
||||
sub help {
|
||||
print "\nSNMP Load & CPU Monitor for Nagios version ",$Version,"\n";
|
||||
print "GPL licence, (c)2004-2006 Patrick Proy\n\n";
|
||||
print "GPL licence, (c)2004-2007 Patrick Proy\n\n";
|
||||
print_usage();
|
||||
print <<EOT;
|
||||
-v, --verbose
|
||||
|
@ -283,6 +283,11 @@ if (defined($TIMEOUT)) {
|
|||
alarm ($o_timeout+10);
|
||||
}
|
||||
|
||||
$SIG{'ALRM'} = sub {
|
||||
print "No answer from host\n";
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
};
|
||||
|
||||
# Connect to host
|
||||
my ($session,$error);
|
||||
if ( defined($o_login) && defined($o_passwd)) {
|
||||
|
@ -450,8 +455,8 @@ for (my $i=0;$i<3;$i++) {
|
|||
}
|
||||
print " OK" if ($exit_val eq $ERRORS{"OK"});
|
||||
if (defined($o_perf)) {
|
||||
print " | load_5_sec=$load[0]%;$o_warnL[0];$o_critL[0],";
|
||||
print "load_1_min=$load[1]%;$o_warnL[1];$o_critL[1],";
|
||||
print " | load_5_sec=$load[0]%;$o_warnL[0];$o_critL[0] ";
|
||||
print "load_1_min=$load[1]%;$o_warnL[1];$o_critL[1] ";
|
||||
print "load_5_min=$load[2]%;$o_warnL[2];$o_critL[2]\n";
|
||||
} else {
|
||||
print "\n";
|
||||
|
@ -505,8 +510,8 @@ for (my $i=0;$i<3;$i++) {
|
|||
}
|
||||
print " OK" if ($exit_val eq $ERRORS{"OK"});
|
||||
if (defined($o_perf)) {
|
||||
print " | load_5_sec=$load[0]%;$o_warnL[0];$o_critL[0],";
|
||||
print "load_1_min=$load[1]%;$o_warnL[1];$o_critL[1],";
|
||||
print " | load_5_sec=$load[0]%;$o_warnL[0];$o_critL[0] ";
|
||||
print "load_1_min=$load[1]%;$o_warnL[1];$o_critL[1] ";
|
||||
print "load_5_min=$load[2]%;$o_warnL[2];$o_critL[2]\n";
|
||||
} else {
|
||||
print "\n";
|
||||
|
@ -560,8 +565,8 @@ for (my $i=0;$i<3;$i++) {
|
|||
}
|
||||
print " OK" if ($exit_val eq $ERRORS{"OK"});
|
||||
if (defined($o_perf)) {
|
||||
print " | cpu_5_sec=$load[0]%;$o_warnL[0];$o_critL[0],";
|
||||
print "cpu_1_min=$load[1]%;$o_warnL[1];$o_critL[1],";
|
||||
print " | cpu_5_sec=$load[0]%;$o_warnL[0];$o_critL[0] ";
|
||||
print "cpu_1_min=$load[1]%;$o_warnL[1];$o_critL[1] ";
|
||||
print "cpu_5_min=$load[2]%;$o_warnL[2];$o_critL[2]\n";
|
||||
} else {
|
||||
print "\n";
|
||||
|
@ -665,8 +670,8 @@ for (my $i=0;$i<3;$i++) {
|
|||
}
|
||||
print " OK" if ($exit_val eq $ERRORS{"OK"});
|
||||
if (defined($o_perf)) {
|
||||
print " | load_1_min=$load[0]%;$o_warnL[0];$o_critL[0],";
|
||||
print "load_5_min=$load[1]%;$o_warnL[1];$o_critL[1],";
|
||||
print " | load_1_min=$load[0]%;$o_warnL[0];$o_critL[0] ";
|
||||
print "load_5_min=$load[1]%;$o_warnL[1];$o_critL[1] ";
|
||||
print "load_15_min=$load[2]%;$o_warnL[2];$o_critL[2]\n";
|
||||
} else {
|
||||
print "\n";
|
||||
|
@ -706,19 +711,19 @@ if ($ncpu==0) {
|
|||
$cpu_used /= $ncpu;
|
||||
|
||||
print "$ncpu CPU, ", $ncpu==1 ? "load" : "average load";
|
||||
printf(" %.1f",$cpu_used);
|
||||
printf(" %.1f%%",$cpu_used);
|
||||
$exit_val=$ERRORS{"OK"};
|
||||
|
||||
if ($cpu_used > $o_crit) {
|
||||
print " > $o_crit : CRITICAL";
|
||||
print " > $o_crit% : CRITICAL";
|
||||
$exit_val=$ERRORS{"CRITICAL"};
|
||||
} else {
|
||||
if ($cpu_used > $o_warn) {
|
||||
print " > $o_warn : WARNING";
|
||||
print " > $o_warn% : WARNING";
|
||||
$exit_val=$ERRORS{"WARNING"};
|
||||
}
|
||||
}
|
||||
print " < $o_warn : OK" if ($exit_val eq $ERRORS{"OK"});
|
||||
print " < $o_warn% : OK" if ($exit_val eq $ERRORS{"OK"});
|
||||
(defined($o_perf)) ?
|
||||
print " | cpu_prct_used=$cpu_used%;$o_warn;$o_crit\n"
|
||||
: print "\n";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/perl -w
|
||||
############################## check_snmp_nsbox #################
|
||||
# Version : 1.0
|
||||
# Date : 27 aug 2006
|
||||
# Date : Jan 16 2007
|
||||
# Author : Patrick Proy ( patrick at proy.org)
|
||||
# Help : http://www.manubulon.com/nagios/
|
||||
# Licence : GPL - http://www.fsf.org/licenses/gpl.txt
|
||||
|
@ -88,10 +88,10 @@ sub set_status { # return worst status with this order : OK, unknwonw, warning,
|
|||
return $cur_status;
|
||||
}
|
||||
|
||||
sub is_pattern_valid { # Test for things like "<I\s*[^>" or "+5-i"
|
||||
my $pat = shift;
|
||||
if (!defined($pat)) { $pat=" ";} # Just to get rid of compilation time warnings
|
||||
return eval { "" =~ /$pat/; 1 } || 0;
|
||||
sub is_pattern_valid { # Test for things like "<I\s*[^>" or "+5-i"
|
||||
my $pat = shift;
|
||||
if (!defined($pat)) { $pat=" ";} # Just to get rid of compilation time warnings
|
||||
return eval { "" =~ /$pat/; 1 } || 0;
|
||||
}
|
||||
|
||||
sub help {
|
||||
|
@ -265,9 +265,9 @@ if (!defined($session)) {
|
|||
|
||||
########### check global status ##############
|
||||
my @oidlist=($ns_service_status);
|
||||
my $resultat = (Net::SNMP->VERSION < 4) ?
|
||||
$session->get_request(@oidlist)
|
||||
: $session->get_request(-varbindlist => \@oidlist);
|
||||
my $resultat = (Net::SNMP->VERSION < 4) ?
|
||||
$session->get_request(@oidlist)
|
||||
: $session->get_request(-varbindlist => \@oidlist);
|
||||
|
||||
if (!defined($resultat) || ($$resultat{$ns_service_status} eq "noSuchObject")) {
|
||||
printf("ERROR: Global status oid not found : %s.\n", $session->error);
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#!/usr/bin/perl -w
|
||||
############################## check_snmp_process ##############
|
||||
# Version : 1.3
|
||||
# Date : Sept 4 2006
|
||||
# Version : 1.4
|
||||
# Date : March 12 2007
|
||||
# Author : Patrick Proy (patrick at proy.org)
|
||||
# Help : http://www.manubulon.com/nagios/
|
||||
# Help : http://nagios.manubulon.com
|
||||
# Licence : GPL - http://www.fsf.org/licenses/gpl.txt
|
||||
# Contrib : Makina Corpus
|
||||
# TODO : put $o_delta as an option
|
||||
# Contrib :
|
||||
###############################################################
|
||||
|
@ -38,7 +39,7 @@ my $proc_run_state = '1.3.6.1.2.1.25.4.2.1.7';
|
|||
|
||||
# Globals
|
||||
|
||||
my $Version='1.3.1';
|
||||
my $Version='1.4';
|
||||
|
||||
my $o_host = undef; # hostname
|
||||
my $o_community =undef; # community
|
||||
|
@ -60,6 +61,12 @@ my $o_timeout= 5; # Default 5s Timeout
|
|||
# SNMP V3 specific
|
||||
my $o_login= undef; # snmp v3 login
|
||||
my $o_passwd= undef; # snmp v3 passwd
|
||||
my $v3protocols=undef; # V3 protocol list.
|
||||
my $o_authproto='md5'; # Auth protocol
|
||||
my $o_privproto='des'; # Priv protocol
|
||||
my $o_privpass= undef; # priv password
|
||||
# SNMP Message size parameter (Makina Corpus contrib)
|
||||
my $o_octetlength=undef;
|
||||
# Memory & CPU
|
||||
my $o_mem= undef; # checks memory (max)
|
||||
my @o_memL= undef; # warn and crit level for mem
|
||||
|
@ -73,7 +80,7 @@ my $o_delta= $delta_of_time_to_make_average; # delta time for CPU check
|
|||
sub p_version { print "check_snmp_process version : $Version\n"; }
|
||||
|
||||
sub print_usage {
|
||||
print "Usage: $0 [-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%> ] [-t <timeout>] [-f ] [-r] [-V] [-g]\n";
|
||||
print "Usage: $0 [-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%> ] [-t <timeout>] [-o <octet_length>] [-f ] [-r] [-V] [-g]\n";
|
||||
}
|
||||
|
||||
sub isnotnum { # Return true if arg is not a number
|
||||
|
@ -148,12 +155,15 @@ sub help {
|
|||
name or IP address of host to check
|
||||
-C, --community=COMMUNITY NAME
|
||||
community name for the host's SNMP agent (implies SNMP v1 or v2c with option)
|
||||
-2, --v2c
|
||||
Use snmp v2c
|
||||
-l, --login=LOGIN
|
||||
Login for snmpv3 authentication (implies v3 protocol with MD5)
|
||||
-x, --passwd=PASSWD
|
||||
Password for snmpv3 authentication
|
||||
-l, --login=LOGIN ; -x, --passwd=PASSWD, -2, --v2c
|
||||
Login and auth password for snmpv3 authentication
|
||||
If no priv password exists, implies AuthNoPriv
|
||||
-2 : use snmp v2c
|
||||
-X, --privpass=PASSWD
|
||||
Priv password for snmpv3 (AuthPriv protocol)
|
||||
-L, --protocols=<authproto>,<privproto>
|
||||
<authproto> : Authentication protocol (md5|sha : default md5)
|
||||
<privproto> : Priv protocole (des|aes : default des)
|
||||
-p, --port=PORT
|
||||
SNMP port (Default 161)
|
||||
-n, --name=NAME
|
||||
|
@ -187,6 +197,10 @@ Notes on warning and critical :
|
|||
In some cases, it is necessary to get all data at once because
|
||||
process die very frequently.
|
||||
This option eats bandwidth an cpu (for remote host) at breakfast.
|
||||
-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
|
||||
|
@ -205,7 +219,6 @@ EOT
|
|||
sub verb { my $t=shift; print $t,"\n" if defined($o_verb) ; }
|
||||
|
||||
sub check_options {
|
||||
my $compat_o_cpu_sum;
|
||||
Getopt::Long::Configure ("bundling");
|
||||
GetOptions(
|
||||
'v' => \$o_verb, 'verbose' => \$o_verb,
|
||||
|
@ -215,7 +228,9 @@ sub check_options {
|
|||
'C:s' => \$o_community, 'community:s' => \$o_community,
|
||||
'l:s' => \$o_login, 'login:s' => \$o_login,
|
||||
'x:s' => \$o_passwd, 'passwd:s' => \$o_passwd,
|
||||
'c:s' => \$o_crit, 'critical:s' => \$o_crit,
|
||||
'X:s' => \$o_privpass, 'privpass:s' => \$o_privpass,
|
||||
'L:s' => \$v3protocols, 'protocols:s' => \$v3protocols,
|
||||
'c:s' => \$o_crit, 'critical:s' => \$o_crit,
|
||||
'w:s' => \$o_warn, 'warn:s' => \$o_warn,
|
||||
't:i' => \$o_timeout, 'timeout:i' => \$o_timeout,
|
||||
'n:s' => \$o_descr, 'name:s' => \$o_descr,
|
||||
|
@ -225,10 +240,8 @@ sub check_options {
|
|||
'a' => \$o_mem_avg, 'average' => \$o_mem_avg,
|
||||
'u:s' => \$o_cpu, 'cpu' => \$o_cpu,
|
||||
'2' => \$o_version2, 'v2c' => \$o_version2,
|
||||
'o:i' => \$o_octetlength, 'octetlength:i' => \$o_octetlength,
|
||||
'g' => \$o_get_all, 'getall' => \$o_get_all,
|
||||
#### To be compatible with version 1.2, will be removed... ####
|
||||
's' => \$compat_o_cpu_sum, 'cpusum' => \$compat_o_cpu_sum,
|
||||
##########
|
||||
'V' => \$o_version, 'version' => \$o_version
|
||||
);
|
||||
if (defined ($o_help)) { help(); exit $ERRORS{"UNKNOWN"}};
|
||||
|
@ -236,6 +249,19 @@ sub check_options {
|
|||
# check snmp information
|
||||
if ( !defined($o_community) && (!defined($o_login) || !defined($o_passwd)) )
|
||||
{ print "Put snmp login info!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}}
|
||||
if ((defined($o_login) || defined($o_passwd)) && (defined($o_community) || defined($o_version2)) )
|
||||
{ print "Can't mix snmp v1,2c,3 protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}}
|
||||
if (defined ($v3protocols)) {
|
||||
if (!defined($o_login)) { print "Put snmp V3 login info with protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}}
|
||||
my @v3proto=split(/,/,$v3protocols);
|
||||
if ((defined ($v3proto[0])) && ($v3proto[0] ne "")) {$o_authproto=$v3proto[0]; } # Auth protocol
|
||||
if (defined ($v3proto[1])) {$o_privproto=$v3proto[1]; } # Priv protocol
|
||||
if ((defined ($v3proto[1])) && (!defined($o_privpass))) {
|
||||
print "Put snmp V3 priv login info with priv protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}}
|
||||
}
|
||||
if (defined($o_timeout) && (isnotnum($o_timeout) || ($o_timeout < 2) || ($o_timeout > 60)))
|
||||
{ print "Timeout must be >1 and <60 !\n"; print_usage(); exit $ERRORS{"UNKNOWN"}}
|
||||
if (!defined($o_timeout)) {$o_timeout=5;}
|
||||
# Check compulsory attributes
|
||||
if ( ! defined($o_descr) || ! defined($o_host) ) { print_usage(); exit $ERRORS{"UNKNOWN"}};
|
||||
@o_warnL=split(/,/,$o_warn);
|
||||
|
@ -277,7 +303,10 @@ sub check_options {
|
|||
if ($o_cpuL[0]>$o_cpuL[1])
|
||||
{print "Warning must be <= Critical for cpu!\n";print_usage(); exit $ERRORS{"UNKNOWN"}};
|
||||
}
|
||||
|
||||
#### octet length checks
|
||||
if (defined ($o_octetlength) && (isnotnum($o_octetlength) || $o_octetlength > 65535 || $o_octetlength < 484 )) {
|
||||
print "octet lenght must be < 65535 and > 484\n";print_usage(); exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
}
|
||||
|
||||
########## MAIN #######
|
||||
|
@ -297,16 +326,31 @@ if (defined($TIMEOUT)) {
|
|||
my ($session,$error);
|
||||
if ( defined($o_login) && defined($o_passwd)) {
|
||||
# SNMPv3 login
|
||||
verb("SNMPv3 login");
|
||||
($session, $error) = Net::SNMP->session(
|
||||
-hostname => $o_host,
|
||||
-version => '3',
|
||||
-username => $o_login,
|
||||
-authpassword => $o_passwd,
|
||||
-authprotocol => 'md5',
|
||||
-privpassword => $o_passwd,
|
||||
if (!defined ($o_privpass)) {
|
||||
verb("SNMPv3 AuthNoPriv login : $o_login, $o_authproto");
|
||||
($session, $error) = Net::SNMP->session(
|
||||
-hostname => $o_host,
|
||||
-version => '3',
|
||||
-port => $o_port,
|
||||
-username => $o_login,
|
||||
-authpassword => $o_passwd,
|
||||
-authprotocol => $o_authproto,
|
||||
-timeout => $o_timeout
|
||||
);
|
||||
);
|
||||
} else {
|
||||
verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto");
|
||||
($session, $error) = Net::SNMP->session(
|
||||
-hostname => $o_host,
|
||||
-version => '3',
|
||||
-username => $o_login,
|
||||
-port => $o_port,
|
||||
-authpassword => $o_passwd,
|
||||
-authprotocol => $o_authproto,
|
||||
-privpassword => $o_privpass,
|
||||
-privprotocol => $o_privproto,
|
||||
-timeout => $o_timeout
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if (defined ($o_version2)) {
|
||||
# SNMPv2 Login
|
||||
|
@ -333,6 +377,20 @@ if (!defined($session)) {
|
|||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
|
||||
if (defined($o_octetlength)) {
|
||||
my $oct_resultat=undef;
|
||||
my $oct_test= $session->max_msg_size();
|
||||
verb(" actual max octets:: $oct_test");
|
||||
$oct_resultat = $session->max_msg_size($o_octetlength);
|
||||
if (!defined($oct_resultat)) {
|
||||
printf("ERROR: Session settings : %s.\n", $session->error);
|
||||
$session->close;
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
$oct_test= $session->max_msg_size();
|
||||
verb(" new max octets:: $oct_test");
|
||||
}
|
||||
|
||||
# Look for process in name or path name table
|
||||
my $resultat=undef;
|
||||
my %result_cons=();
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#!/usr/bin/perl -w
|
||||
############################## check_snmp_storage ##############
|
||||
# Version : 1.3.1
|
||||
# Date : Jan 11 2007
|
||||
# Version : 1.3.2
|
||||
# Date : March 12 2007
|
||||
# Author : Patrick Proy ( patrick at proy.org)
|
||||
# Help : http://www.manubulon.com/nagios/
|
||||
# Help : http://nagios.manubulon.com
|
||||
# Licence : GPL - http://www.fsf.org/licenses/gpl.txt
|
||||
# TODO :
|
||||
# Contribs : Dimo Velev
|
||||
# Contribs : Dimo Velev, Makina Corpus
|
||||
#################################################################
|
||||
#
|
||||
# help : ./check_snmp_storage -h
|
||||
|
@ -57,7 +57,7 @@ $hrStorage{"1.3.6.1.2.1.25.2.1.10"} = 'NetworkDisk';
|
|||
# Globals
|
||||
|
||||
my $Name='check_snmp_storage';
|
||||
my $Version='1.3';
|
||||
my $Version='1.3.2';
|
||||
|
||||
my $o_host = undef; # hostname
|
||||
my $o_community = undef; # community
|
||||
|
@ -87,13 +87,15 @@ my $v3protocols=undef; # V3 protocol list.
|
|||
my $o_authproto='md5'; # Auth protocol
|
||||
my $o_privproto='des'; # Priv protocol
|
||||
my $o_privpass= undef; # priv password
|
||||
# SNMP Message size parameter (Makina Corpus contrib)
|
||||
my $o_octetlength=undef;
|
||||
|
||||
# functions
|
||||
|
||||
sub p_version { print "$Name version : $Version\n"; }
|
||||
|
||||
sub print_usage {
|
||||
print "Usage: $Name [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>]) [-p <port>] -m <name in desc_oid> [-q storagetype] -w <warn_level> -c <crit_level> [-t <timeout>] [-T pl|pu|bl|bu ] [-r] [-s] [-i] [-e] [-S 0|1[,1,<car>]]\n";
|
||||
print "Usage: $Name [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>]) [-p <port>] -m <name in desc_oid> [-q storagetype] -w <warn_level> -c <crit_level> [-t <timeout>] [-T pl|pu|bl|bu ] [-r] [-s] [-i] [-e] [-S 0|1[,1,<car>]] [-o <octet_length>]\n";
|
||||
}
|
||||
|
||||
sub round ($$) {
|
||||
|
@ -187,6 +189,10 @@ warn if %used > warn and critical if %used > crit
|
|||
ex : "/ : 66 %used (< 80) : OK"
|
||||
<where>: (optional) if = 1, put the OK/WARN/CRIT at the beginning
|
||||
<cut>: take the <n> first caracters or <n> 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
|
||||
|
@ -238,6 +244,7 @@ sub check_options {
|
|||
'V' => \$o_version, 'version' => \$o_version,
|
||||
'q:s' => \$o_storagetype, 'storagetype:s'=> \$o_storagetype,
|
||||
'S:s' => \$o_short, 'short:s' => \$o_short,
|
||||
'o:i' => \$o_octetlength, 'octetlength:i' => \$o_octetlength,
|
||||
'f' => \$o_perf, 'perfparse' => \$o_perf
|
||||
);
|
||||
if (defined($o_help) ) { help(); exit $ERRORS{"UNKNOWN"}};
|
||||
|
@ -295,6 +302,10 @@ sub check_options {
|
|||
if (defined ($o_shortL[2]) && isnnum($o_shortL[2]))
|
||||
{print "-S last option must be an integer\n";print_usage(); exit $ERRORS{"UNKNOWN"};}
|
||||
}
|
||||
#### octet length checks
|
||||
if (defined ($o_octetlength) && (isnnum($o_octetlength) || $o_octetlength > 65535 || $o_octetlength < 484 )) {
|
||||
print "octet lenght must be < 65535 and > 484\n";print_usage(); exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
}
|
||||
|
||||
########## MAIN #######
|
||||
|
@ -323,6 +334,7 @@ if ( defined($o_login) && defined($o_passwd)) {
|
|||
-username => $o_login,
|
||||
-authpassword => $o_passwd,
|
||||
-authprotocol => $o_authproto,
|
||||
-port => $o_port,
|
||||
-timeout => $o_timeout
|
||||
);
|
||||
} else {
|
||||
|
@ -335,6 +347,7 @@ if ( defined($o_login) && defined($o_passwd)) {
|
|||
-authprotocol => $o_authproto,
|
||||
-privpassword => $o_privpass,
|
||||
-privprotocol => $o_privproto,
|
||||
-port => $o_port,
|
||||
-timeout => $o_timeout
|
||||
);
|
||||
}
|
||||
|
@ -366,6 +379,20 @@ if (!defined($session)) {
|
|||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
|
||||
if (defined($o_octetlength)) {
|
||||
my $oct_resultat=undef;
|
||||
my $oct_test= $session->max_msg_size();
|
||||
verb(" actual max octets:: $oct_test");
|
||||
$oct_resultat = $session->max_msg_size($o_octetlength);
|
||||
if (!defined($oct_resultat)) {
|
||||
printf("ERROR: Session settings : %s.\n", $session->error);
|
||||
$session->close;
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
$oct_test= $session->max_msg_size();
|
||||
verb(" new max octets:: $oct_test");
|
||||
}
|
||||
|
||||
my $resultat=undef;
|
||||
my $stype=undef;
|
||||
# Get rid of UTF8 translation in case of accentuated caracters (thanks to Dimo Velev).
|
||||
|
|
245
doc/faq.html
Executable file
245
doc/faq.html
Executable file
|
@ -0,0 +1,245 @@
|
|||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Nagios plugins</TITLE>
|
||||
<META NAME="Keywords" CONTENT="nagios,plugins,perl,snmp,proy">
|
||||
<STYLE type="text/css">
|
||||
<!--
|
||||
.Default { font-family: verdana,arial,serif; font-size: 10pt; }
|
||||
.ProgramTitle { font-family: verdana,arial,serif; font-size: 18pt; font-weight: bold;}
|
||||
.Copyright { font-family: verdana,arial,serif; font-size: 10pt;}
|
||||
.Email { font-family: verdana,arial,serif; font-size: 10pt;}
|
||||
.NewsItem { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
.NewsItemOdd { font-family: verdana,arial,serif; font-size: 8pt; background-color: #DBDBDB;}
|
||||
.NewsItemEven { font-family: verdana,arial,serif; font-size: 8pt; background-color: #C4C2C2;}
|
||||
.NewsItemUrgent { font-family: verdana,arial,serif; font-size: 8pt; background-color: #ccff99;}
|
||||
.NewsItemDate { font-family: verdana,arial,serif; font-size: 8pt; font-weight: bold; }
|
||||
.SectionTitle { font-family: verdana,arial,serif; font-size: 9pt; font-weight: bold; text-decoration: underline;}
|
||||
.SectionBody { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
.ModificationDate { font-family: verdana,arial,serif; font-size: 7pt; }
|
||||
.Disclaimer { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
A.SideNavBarItem { font-family: verdana,arial,serif; background-color : black; color: #e7e7e7; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
A.SideNavBarItem:Hover { font-family: verdana,arial,serif; background-color : black; color: #ccff33; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
A.SideNavBarHotItem { font-family: verdana,arial,serif; background-color : black; color: #ffcc66; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
A.SideNavBarHotItem:Hover { font-family: verdana,arial,serif; background-color : black; color: #ccff33; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
-->
|
||||
</STYLE>
|
||||
</HEAD>
|
||||
|
||||
<body background="img/sideback.jpg" bgcolor="#FFFFFF" text="black" class="Default">
|
||||
|
||||
<!-- background="img/sideback.jpg" -->
|
||||
|
||||
<table border="0" height="1477">
|
||||
|
||||
<tr>
|
||||
|
||||
<td valign=top>
|
||||
|
||||
<!-- Begin Side Bar -->
|
||||
|
||||
<table border="0" width="125" valign=top>
|
||||
<tr>
|
||||
<td><a href="http://nagios.manubulon.com/" class="SideNavBarItem" >Home</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><BR>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- End Side Bar -->
|
||||
|
||||
</td>
|
||||
|
||||
<td valign=top>
|
||||
|
||||
<table border="0" valign=top height="1452">
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="ProgramTitle"> FAQ</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
|
||||
<p class="NewsItemDate"> </p>
|
||||
|
||||
<p class="SectionTitle"> Last update : Jan 11 2007</p>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td valign="top">
|
||||
|
||||
<p class="SectionTitle"> </p>
|
||||
<p class="SectionTitle"><b>FIRST, </b>look at the web page associated
|
||||
with every script.</p>
|
||||
<p class="SectionBody"><b>Running the scripts :</b></p>
|
||||
<p class="SectionBody">- <a href="#FAQ1">The scripts outputs "Can't
|
||||
locate Net/SNMP.pm in @INC....."</a></p>
|
||||
<p class="SectionBody">-<a href="#FAQ2"> How do I install Net::SNMP
|
||||
perl module</a></p>
|
||||
<p class="SectionBody">- <a href="#FAQ3">What are the supported platforms
|
||||
to run the scripts on ?</a></p>
|
||||
<p class="SectionBody">- <a href="#FAQ4">How do I get help on the
|
||||
options ?</a></p>
|
||||
<p class="SectionBody">- <a href="#FAQ5">Return code of X is out of
|
||||
bounds</a></p>
|
||||
<p class="SectionBody">- <a href="#FAQ6">Are these plugins compatible
|
||||
with Nagios 2.0 ?</a></p>
|
||||
<p class="SectionBody">- <a href="#FAQ7"> ERROR: XXXXXX : Expected
|
||||
OBJECT IDENTIFIER in dotted notation. </a></p>
|
||||
<p class="SectionBody">- <a href="#FAQ8">"No Output" using
|
||||
Nagios 2</a></p>
|
||||
<p class="SectionBody">- <a href="#FAQ9">Getting : "ERROR: Size
|
||||
table :Message size exceeded buffer maxMsgSize"</a></p>
|
||||
<p class="SectionBody"><b>Misc<br>
|
||||
</b></p>
|
||||
<p class="SectionBody">- <a href="#FAQM3">Are these scripts secure
|
||||
?</a></p>
|
||||
<p class="SectionBody">- <a href="#FAQM1">How can I get help ? Is
|
||||
there a mailling list ? a forum ?</a></p>
|
||||
<p class="SectionBody">- <a href="#FAQM2">Can I donate to help this
|
||||
project ?</a></p>
|
||||
<hr>
|
||||
<p class="SectionTitle"><a name="FAQ1"></a>The scripts outputs "Can't
|
||||
locate Net/SNMP.pm in @INC....."</p>
|
||||
<p class="SectionBody">You don't have Net::SNMP installed, see below</p>
|
||||
<p class="SectionTitle"><a name="FAQ2"></a>How do I install Net::SNMP
|
||||
perl module ?</p>
|
||||
<p class="SectionBody">There are 2 ways of doing this </p>
|
||||
<p class="SectionBody"><b>1) By CPAN (best)</b></p>
|
||||
<p class="SectionBody">on command line, as root : <br>
|
||||
<br>
|
||||
[your_host]# <b>perl -MCPAN -e shell</b><br>
|
||||
cpan shell -- CPAN exploration and modules installation (v1.76)<br>
|
||||
ReadLine support enabled<br>
|
||||
cpan> <b>install Net::SNMP</b><br>
|
||||
</p>
|
||||
<p class="SectionBody">If it's the first time you run CPAN, it will
|
||||
probably ask you some (simple) questions.</p>
|
||||
<p class="SectionBody">CPAN will also ask you to satisfy some dependencies
|
||||
(Crypt::DES, Digest::MD5, etc..).</p>
|
||||
<p class="SectionBody"><b>2) "By hand"</b><br>
|
||||
</p>
|
||||
<p class="SectionBody">Get the folowings modules (tar.gz format) on
|
||||
<a href="http://www.cpan.org">www.cpan.org</a></p>
|
||||
<p class="SectionBody">- Crypt::DES<br>
|
||||
- Digest::MD5<br>
|
||||
- Digest::SHA1<br>
|
||||
- Digest::HMAC<br>
|
||||
- Net::SNMP<br>
|
||||
<br>
|
||||
for each one (you must install Net::SNMP at the end) : <br>
|
||||
<b>tar zxf <module>.tar.gz<br>
|
||||
cd <module><br>
|
||||
perl Makefile.pl<br>
|
||||
make test<br>
|
||||
make install</b></p>
|
||||
<p class="SectionTitle"><a name="FAQ3"></a>What are the supported
|
||||
platforms to run the scripts on ?</p>
|
||||
<p class="SectionBody">Most Linux, maybe some unixes and maybe Cygwin.<br>
|
||||
Actually anything you can run perl on.<br>
|
||||
If you can install the latest Net::SNMP module, then the perl version
|
||||
should be OK.</p>
|
||||
<p class="SectionTitle"><a name="FAQ4"></a>How do I get help on the
|
||||
options ?</p>
|
||||
<p class="SectionBody">Just run <b><script> -h </b>on the command
|
||||
line.<br>
|
||||
<br>
|
||||
</p>
|
||||
<p class="SectionTitle"><a name="FAQ5"></a>Return code of X is out
|
||||
of bounds</p>
|
||||
<p class="SectionBody">Have a look at : <a href="http://www.nagios.org/faqs/viewfaq.php?faq_id=17">http://www.nagios.org/faqs/viewfaq.php?faq_id=17</a></p>
|
||||
<p class="SectionBody">In case of return code 127, try putting perl
|
||||
in the command line definition : </p>
|
||||
<p class="SectionBody"> define command{<br>
|
||||
command_name check_disk<br>
|
||||
command_line <b>/usr/bin/perl</b> $USER1$/check_snmp_storage.pl
|
||||
-C $ARG1$ [........]<br>
|
||||
}<br>
|
||||
</p>
|
||||
<p class="SectionTitle"><a name="FAQ6"></a>Are these plugins compatible
|
||||
with Nagios 2.0 ?</p>
|
||||
<p class="SectionBody">Yes.</p>
|
||||
<p class="SectionTitle"><a name="FAQ7"></a>ERROR: XXXXXX : Expected OBJECT IDENTIFIER in dotted notation.
|
||||
</p>
|
||||
<p class="SectionBody">Upgrade your Net::SNMP module version (5 is good, 4 maybe OK, 3 gives this error) <br>
|
||||
This happens with Debian Woody (Net::SNMP version 3.6).<br>
|
||||
I have special patches if you can't upgrade : contact me.</p>
|
||||
<p class="SectionTitle"><a name="FAQ8"></a>"No Output" using
|
||||
Nagios 2</p>
|
||||
<p class="SectionBody">It's a "bug" of embeded perl. It
|
||||
has been corrected in latest Nagios releases.</p>
|
||||
<p class="SectionBody">You can :<br>
|
||||
</p>
|
||||
<p class="SectionBody">- Add a patch if your nagios release is old.
|
||||
Here is a patch made by Gavin Carr for the p1.pl file to correct
|
||||
this (it should be in nagios CVS shortly). <a href="http://nagios.manubulon.com/p1-print.pl.patch">http://nagios.manubulon.com/p1-print.pl.patch</a>
|
||||
</p>
|
||||
<p class="SectionBody">- Upgrade Nagios.<br>
|
||||
<br>
|
||||
- add "/usr/bin/perl" before the script command so Nagios
|
||||
won't use embeded perl. </p>
|
||||
<p class="SectionTitle"><a name="FAQ9"></a>Getting : "ERROR:
|
||||
Size table :Message size exceeded buffer maxMsgSize"</p>
|
||||
<p class="SectionBody">Your snmp table is too big.</p>
|
||||
<p class="SectionBody">Some of my scripts (check_snmp_storage and
|
||||
check_snmp_process) now have an option (-o) to set this directly
|
||||
on command line (thx to Makina Corpus for the patch).</p>
|
||||
<p class="SectionBody">In other scripts, try adding :</p>
|
||||
<p class="SectionBody"> $session->max_msg_size(5000);<br>
|
||||
</p>
|
||||
<p class="SectionBody">After the session has been initialized. </p>
|
||||
<p class="SectionTitle"><br>
|
||||
<a name="FAQM3"></a>Are these scripts secure ?</p>
|
||||
<p class="SectionBody">Not at all ! You must secure the Nagios server.<br>
|
||||
Nobody else than the nagios user should be allowed to even think
|
||||
about running these scripts.<br>
|
||||
</p>
|
||||
<p class="SectionTitle"><a name="FAQM1"></a>How can I get help ? Is
|
||||
there a mailling list ? a forum ?</p>
|
||||
<p class="SectionBody">Go to the sourceforge project page for all this : <a href=http://sourceforge.net/projects/nagios-snmp/>Nagios-snmp</a>
|
||||
<p class="SectionBody"><a name="FAQM2"></a><span class="SectionTitle">Can
|
||||
I donate to help this project ?</span></p>
|
||||
<p class="SectionBody">Of course you can, I just haven't got any idea
|
||||
of how, so just send a postcard to my son (Jolan) with a nice drawing (or buy a cookie to your son/daughter/nephew/grand-ma...).<br>
|
||||
You can get my postal address on my resume (<a href="http://www.manubulon.com/cvpproy.htm">www.manubulon.com/cvpproy.htm</a>).<br>
|
||||
He will answer you when he knows how to write (in several years).</p>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p class="SectionBody">This project is also hosted by : <br>
|
||||
|
||||
<A href="http://sourceforge.net/projects/nagios-snmp/"> <IMG src="http://sourceforge.net/sflogo.php?group_id=134917&type=5" width="210" height="62" border="0" alt="SourceForge.net Logo" /></A>
|
||||
</p></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<p> </p>
|
||||
|
||||
</BODY>
|
||||
|
||||
</HTML>
|
||||
|
338
doc/index.html
Executable file
338
doc/index.html
Executable file
|
@ -0,0 +1,338 @@
|
|||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Nagios plugins</TITLE>
|
||||
<META NAME="Keywords" CONTENT="nagios,plugins,perl,snmp,proy">
|
||||
<STYLE type="text/css">
|
||||
<!--
|
||||
.Default { font-family: verdana,arial,serif; font-size: 10pt; }
|
||||
.ProgramTitle { font-family: verdana,arial,serif; font-size: 18pt; font-weight: bold;}
|
||||
.Copyright { font-family: verdana,arial,serif; font-size: 10pt;}
|
||||
.Email { font-family: verdana,arial,serif; font-size: 10pt;}
|
||||
.NewsItem { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
.NewsItemOdd { font-family: verdana,arial,serif; font-size: 8pt; background-color: #DBDBDB;}
|
||||
.NewsItemEven { font-family: verdana,arial,serif; font-size: 8pt; background-color: #C4C2C2;}
|
||||
.NewsItemUrgent { font-family: verdana,arial,serif; font-size: 8pt; background-color: #ccff99;}
|
||||
.NewsItemDate { font-family: verdana,arial,serif; font-size: 8pt; font-weight: bold; }
|
||||
.SectionTitle { font-family: verdana,arial,serif; font-size: 9pt; font-weight: bold; text-decoration: underline;}
|
||||
.SectionBody { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
.ModificationDate { font-family: verdana,arial,serif; font-size: 7pt; }
|
||||
.Disclaimer { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
A.SideNavBarItem { font-family: verdana,arial,serif; background-color : black; color: #e7e7e7; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
A.SideNavBarItem:Hover { font-family: verdana,arial,serif; background-color : black; color: #ccff33; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
A.SideNavBarHotItem { font-family: verdana,arial,serif; background-color : black; color: #ffcc66; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
A.SideNavBarHotItem:Hover { font-family: verdana,arial,serif; background-color : black; color: #ccff33; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
-->
|
||||
</STYLE>
|
||||
</HEAD>
|
||||
<body background="img/sideback.jpg" bgcolor="#FFFFFF" text="black" class="Default">
|
||||
<table width="100%" border="0">
|
||||
<tr>
|
||||
<td valign=top>
|
||||
<table width="100%" border="0" valign=top>
|
||||
<tr>
|
||||
<td class="ProgramTitle"> SNMP plugins for Nagios</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p class="SectionTitle" align="right">Last update : April 19 2007</p>
|
||||
<p class="SectionTitle" align="left">About </p>
|
||||
<p class="SectionBody">The general idea of these scripts is to check
|
||||
as many things as possible with snmp (how do you install NRPE on
|
||||
Cisco or AS/400 ?) : disks, memory, load, interface, running procsses,
|
||||
etc...<br>
|
||||
</p>
|
||||
<p class="SectionBody">The other idea is to select disks, interfaces,
|
||||
process using regular expressions <br>
|
||||
<br>
|
||||
- it is possible to test more than one disk/int/process in one Nagios
|
||||
check (ex : eth* instead of eth0,eth1,eth2,...)<br>
|
||||
<br>
|
||||
- you only have to provide a unique part of the name to select a
|
||||
disk/int/process (ex : "C:" instead of "C:\ Label:
|
||||
Serial Number xxxxxxx" makes it easy to use on multiple Windows
|
||||
hosts). </p>
|
||||
<p class="SectionBody">Most of these scripts can make performance
|
||||
outputs. </p>
|
||||
<p class="SectionBody">Enjoy and give me feedback !<br>
|
||||
<br>
|
||||
All code here is under GPL licence. <br>
|
||||
</p>
|
||||
<p class="SectionTitle"> If you want to be informed when I release
|
||||
new versions, <br>
|
||||
or if you have some advices, feedback, questions, go to the project's
|
||||
sourceforge page : <a href="http://sourceforge.net/projects/nagios-snmp">nagios-snmp</a></p>
|
||||
<p class="SectionBody">Please send me your feedback : <br>
|
||||
- Test with embeded Perl<br>
|
||||
- Test on various systems<br>
|
||||
- Bugs, advices, comments, RFE, etc...<br>
|
||||
Thank you !</p>
|
||||
<p class="SectionBody">Run the scripts with '-h' to get help.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<p class="SectionTitle"> </p>
|
||||
<p class="SectionTitle">Requirements</p>
|
||||
<p class="SectionBody"> - Perl in /usr/bin/perl - if not run 'perl
|
||||
script' or change the path in the scripts first line <br>
|
||||
- Net::SNMP<br>
|
||||
- file 'utils.pm' in diretory /usr/local/nagios/libexec or change
|
||||
the line "use libs /usr/local/nagios/libexec/" in the scripts<br>
|
||||
</p>
|
||||
<p class="SectionBody"><a href="index_commands.html" class="SectionTitle">Configurations
|
||||
examples</a></p>
|
||||
<p class="SectionTitle">Plugins<br>
|
||||
</p>
|
||||
<table border="1" cellspacing="5">
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top>
|
||||
<p><a href="snmp_storage.html">check_snmp_storage</a><br>
|
||||
<br>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td class="SectionBody">
|
||||
<p>This scripts checks by snmp (1,2c,3) disks, memory, swap,
|
||||
everthing in hrStorage table. <br>
|
||||
Disk selection can be done by perl regexp on description,
|
||||
index or type to select one or multiple storages.<br>
|
||||
<br>
|
||||
Vérifie par snmp v1 ou v3 (merci à V. Carpentier)
|
||||
l'occupation des disques, mais aussi de la swap, de la mémoire,
|
||||
etc.. tout ce qui est disponible en snmp par la table hrStorage.<br>
|
||||
Les disques sont sélectionnables par expression régulière
|
||||
compatible Perl</p>
|
||||
<p><a href="snmp_storage.html">Details</a></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top>
|
||||
<p><a href="snmp_int.html">check_snmp_int</a><br>
|
||||
<br>
|
||||
</p>
|
||||
</td>
|
||||
<td class="SectionBody">
|
||||
<p>Checks by snmp (1,2c,3) interface state and usage. Interfaces
|
||||
can be selected by regexp.<br>
|
||||
It is possible to check the input/output bandwidth and error
|
||||
rate of the interface.<br>
|
||||
<br>
|
||||
Vérifie par snmp v1 ou v3 l'état des interfaces
|
||||
d'un hôte.<br>
|
||||
Ce script permet d'utiliser des expressions régulières
|
||||
pour sélectionner les interfaces : ex 'eth' va vérifier
|
||||
eth0, eth1, ...<br>
|
||||
Il permet également de lister toutes les interfaces
|
||||
disponibles sur la machine cible (option -v). </p>
|
||||
<p><a href="snmp_int.html">Details</a></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top>
|
||||
<p><a href="snmp_process.html">check_snmp_process</a></p>
|
||||
<p><a href="check_snmp_process.pl"><br>
|
||||
</a></p>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td class="SectionBody">
|
||||
<p>Checks by snmp (1,2c,3) the number (can be 1) of processes
|
||||
matching a perl regexp.<br>
|
||||
The script can also check memory and cpu usage of processes.</p>
|
||||
<p>Vérifie par snmp v1 ou v3 (idem) le nombre de process
|
||||
sur un hôte.<br>
|
||||
Ce script permet d'utiliser des expressions régulières
|
||||
pour sélectionner les process.<br>
|
||||
Il est également possible de vérifier l'utilisation
|
||||
mémoire et CPU de la machine.<br>
|
||||
Il permet également de lister touts les process disponibles
|
||||
sur la machine cible (option -v). </p>
|
||||
<p><a href="snmp_load.html">Details</a></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top>
|
||||
<p><a href="snmp_load.html">check_snmp_load</a></p>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td class="SectionBody">
|
||||
<p>Checks by snmp (1,2c,3) cpu or average load. <br>
|
||||
Works on Linux, Windows, Cisco, AS400, HP Procurve, LinkProof,
|
||||
Blucoat, Nokia, Fortinet, Netscreen,HP-UX.</p>
|
||||
<p> Vérifie par snmp (1,2c,3) la charge ou l'ocupation
|
||||
CPU.<br>
|
||||
</p>
|
||||
<p><a href="snmp_load.html">Details.</a></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top>
|
||||
<p><a href="snmp_mem.html">check_snmp_mem</a></p>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td class="SectionBody">
|
||||
<p>Checks by snmp (1,2c,3) : <br>
|
||||
- Memory and swap usage on Linux/Net-snmp<br>
|
||||
- Memory usage on cisco routers or Pix<br>
|
||||
- Memory usage on HP Procurve switchs<br>
|
||||
For memory check on other OS (Windows, AS400) see the description
|
||||
page </p>
|
||||
<p>Vérifcation de <br>
|
||||
- l'utilisation mémoire et swap sur Linux/Net-snmp<br>
|
||||
- l'utilisation mémoire sur Cisco (routeurs et Pix).<br>
|
||||
- l'utilisation mémoire sur Switch Hp Procurve.<br>
|
||||
Pour d'autres SE (Windows, AS400), aller à la page
|
||||
de description.</p>
|
||||
<p><a href="snmp_mem.html">Détail</a></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top>
|
||||
<p><a href="snmp_vrrp.html">check_snmp_vrrp</a></p>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td class="SectionBody">
|
||||
<p>Checks the vrrp state of all the interface of a host. You
|
||||
can specify if they must be master or backup.<br>
|
||||
Supported platforms : Nokia IP (vrrp & clustering), Linkproof,
|
||||
Alteon.</p>
|
||||
<p>Verifie l'état vrrp des interfaces d'un host.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top>
|
||||
<p><a href="snmp_cpfw.html">check_snmp_cpfw</a></p>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td class="SectionBody">
|
||||
<p>Checks the state of Checkpoint Firewall-1 modules (SVN, HA,
|
||||
FW, MGMT) and active connexions (tested on NG).<br>
|
||||
Snmp extensions must be activated</p>
|
||||
<p>Vérifie l'état des modules Checkpoint Fw-1
|
||||
(HA, SVN, MGMT, FW) et les connexions actives. Testé
|
||||
sur NG-AI R55.<br>
|
||||
L'extension SNMP doit être activée sur les modules.</p>
|
||||
<p><a href="snmp_cpfw.html">Détail</a></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top>
|
||||
<p><a href="snmp_windows.html">check_snmp_win</a></p>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td class="SectionBody">
|
||||
<p>Checks windows services state with snmp.</p>
|
||||
<p>Véifie l'état de services Windows par snmp.</p>
|
||||
<p><a href="snmp_windows.html">Détail</a></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="SectionBody">
|
||||
<p><a href="snmp_css.html" class="NewsItemDate">check_snmp_css</a></p>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td class="SectionBody">Checks css services state</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="SectionBody">
|
||||
<p><a href="snmp_env.html" class="NewsItemDate">check_snmp_env</a></p>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td class="SectionBody">Checks environemental status (fan, temp,
|
||||
power supply) on Cisco, Nokia, Bluecoat, IronPort, Foundry.</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p class="SectionTitle">Compatibility matrix : </p>
|
||||
<table width="100%" border="2" class="SectionBody" cellspacing="3">
|
||||
<tr>
|
||||
<td class="SectionTitle">System</td>
|
||||
<td class="SectionTitle">check_snmp_storage</td>
|
||||
<td class="SectionTitle">check_snmp_int</td>
|
||||
<td class="SectionTitle">check_snmp_process</td>
|
||||
<td class="SectionTitle">check_snmp_mem</td>
|
||||
<td class="SectionTitle">check_snmp_load</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Linux</td>
|
||||
<td>
|
||||
<p>OK : <br>
|
||||
- '/home', '/var'<br>
|
||||
- 'Swap', 'Real Memory'<br>
|
||||
</p>
|
||||
</td>
|
||||
<td>OK : <br>
|
||||
- 'eth' <br>
|
||||
- 'ppp'</td>
|
||||
<td>OK</td>
|
||||
<td>OK (mem & swap)</td>
|
||||
<td>
|
||||
<p>OK</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Windows</td>
|
||||
<td>
|
||||
<p>OK :<br>
|
||||
- '^[CDE]:'</p>
|
||||
</td>
|
||||
<td>OK</td>
|
||||
<td>OK</td>
|
||||
<td>
|
||||
<p>NO<br>
|
||||
See check_snmp_storage for virtual mem</p>
|
||||
</td>
|
||||
<td>OK</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Cisco/HP switch</td>
|
||||
<td>N/A</td>
|
||||
<td>OK :<br>
|
||||
- 'Giga' : all gigabits<br>
|
||||
- 'Fast.*0.1[1234]' : checks FastEternet0/11 to 0/14.</td>
|
||||
<td>N/A</td>
|
||||
<td>OK</td>
|
||||
<td>OK</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>AS400</td>
|
||||
<td>OK :<br>
|
||||
- '-m RAM -s' to get all RAM<br>
|
||||
- 'System ASP' : Disk<br>
|
||||
</td>
|
||||
<td>OK </td>
|
||||
<td>OK</td>
|
||||
<td>
|
||||
<p>NO<br>
|
||||
See check_snmp_storage</p>
|
||||
</td>
|
||||
<td>OK</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>LinkProof</td>
|
||||
<td>N/A</td>
|
||||
<td>OK</td>
|
||||
<td>N/A</td>
|
||||
<td>N/A</td>
|
||||
<td>OK</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<hr>
|
||||
<p class="SectionBody">This project is hosted on : <br>
|
||||
<A href="http://sourceforge.net/projects/nagios-snmp"> <IMG src="http://sourceforge.net/sflogo.php?group_id=134917&type=5" width="210" height="62" border="0" alt="SourceForge.net Logo" /></A>
|
||||
</p>
|
||||
<p class="SectionBody"> Nagios and the Nagios logo are registered
|
||||
trademarks of Ethan Galstad.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</BODY>
|
||||
</HTML>
|
2038
doc/index_commands.html
Executable file
2038
doc/index_commands.html
Executable file
File diff suppressed because it is too large
Load diff
471
doc/snmp_cpfw.html
Executable file
471
doc/snmp_cpfw.html
Executable file
|
@ -0,0 +1,471 @@
|
|||
|
||||
|
||||
<HTML>
|
||||
|
||||
<HEAD>
|
||||
|
||||
<TITLE>Nagios plugins</TITLE>
|
||||
|
||||
<META NAME="Keywords" CONTENT="nagios,plugins,perl,snmp,proy">
|
||||
|
||||
<STYLE type="text/css">
|
||||
|
||||
<!--
|
||||
|
||||
.Default { font-family: verdana,arial,serif; font-size: 10pt; }
|
||||
|
||||
.ProgramTitle { font-family: verdana,arial,serif; font-size: 18pt; font-weight: bold;}
|
||||
|
||||
.Copyright { font-family: verdana,arial,serif; font-size: 10pt;}
|
||||
|
||||
.Email { font-family: verdana,arial,serif; font-size: 10pt;}
|
||||
|
||||
.NewsItem { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
|
||||
.NewsItemOdd { font-family: verdana,arial,serif; font-size: 8pt; background-color: #DBDBDB;}
|
||||
|
||||
.NewsItemEven { font-family: verdana,arial,serif; font-size: 8pt; background-color: #C4C2C2;}
|
||||
|
||||
.NewsItemUrgent { font-family: verdana,arial,serif; font-size: 8pt; background-color: #ccff99;}
|
||||
|
||||
.NewsItemDate { font-family: verdana,arial,serif; font-size: 8pt; font-weight: bold; }
|
||||
|
||||
.SectionTitle { font-family: verdana,arial,serif; font-size: 9pt; font-weight: bold; text-decoration: underline;}
|
||||
|
||||
.SectionBody { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
|
||||
.ModificationDate { font-family: verdana,arial,serif; font-size: 7pt; }
|
||||
|
||||
.Disclaimer { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
|
||||
A.SideNavBarItem { font-family: verdana,arial,serif; background-color : black; color: #e7e7e7; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
|
||||
A.SideNavBarItem:Hover { font-family: verdana,arial,serif; background-color : black; color: #ccff33; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
|
||||
A.SideNavBarHotItem { font-family: verdana,arial,serif; background-color : black; color: #ffcc66; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
|
||||
A.SideNavBarHotItem:Hover { font-family: verdana,arial,serif; background-color : black; color: #ccff33; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
|
||||
-->
|
||||
|
||||
</STYLE>
|
||||
|
||||
</HEAD>
|
||||
|
||||
<body background="img/sideback.jpg" bgcolor="#FFFFFF" text="black" class="Default">
|
||||
|
||||
<!-- background="img/sideback.jpg" -->
|
||||
|
||||
<table border="0">
|
||||
|
||||
<tr>
|
||||
|
||||
<td valign=top>
|
||||
|
||||
<!-- Begin Side Bar -->
|
||||
|
||||
<table border="0" width="125" valign=top>
|
||||
|
||||
<tr>
|
||||
|
||||
<td><a href="http://nagios.manubulon.com/" class="SideNavBarItem" >Home</a></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td><BR>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td> </td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<!-- End Side Bar -->
|
||||
|
||||
</td>
|
||||
|
||||
<td valign=top>
|
||||
|
||||
<table border="0" valign=top>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="ProgramTitle"> Snmp Checkpoint FW-1 check</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
|
||||
<p class="NewsItemDate">Script : check_snmp_cpfw.pl</p>
|
||||
|
||||
<p class="SectionTitle"> Last update : April 19 2007</p>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td valign="top">
|
||||
|
||||
<p class="SectionTitle">Description : </p>
|
||||
|
||||
<p class="SectionBody">Checks by snmp v1, v2c or v3 some modules of
|
||||
Checkpoint FW-1 filtering or management module :</p>
|
||||
|
||||
<p class="SectionBody">You can choose to check 1, 2, 3 or all 4 modules.
|
||||
|
||||
Each module will be checked independently and critical state will
|
||||
|
||||
be returned if one of them is not OK.</p>
|
||||
|
||||
<p class="SectionBody">- Firewall (on filtering firewall) : </p>
|
||||
|
||||
<p class="SectionBody">Checks policy state : must be installed<br>
|
||||
|
||||
Can check installed policy name : you mut provide the exact name
|
||||
|
||||
of the policy (-p = <policy name>)<br>
|
||||
|
||||
Can check connections : warning and maximum levels must be provided
|
||||
|
||||
( -c=<warn>,<crit>)</p>
|
||||
|
||||
<p class="SectionBody">- SVN</p>
|
||||
|
||||
<p class="SectionBody">Checks the svan status code (must be "OK")
|
||||
|
||||
of SVN</p>
|
||||
|
||||
<p class="SectionBody">- Management</p>
|
||||
|
||||
<p class="SectionBody">Checks the management state ("active")
|
||||
|
||||
and if management is alive.</p>
|
||||
|
||||
<p class="SectionBody">- High availability</p>
|
||||
|
||||
<p class="SectionBody">Checks the HA state : <br>
|
||||
- "active" on IPSO & master on SPLAT (default)<br>
|
||||
- "standby" on SPLAT<br>
|
||||
Use check_snmp_vrrp.pl for checks on active/standby or IPSO clusters
|
||||
on IPSO<br>
|
||||
Check the blocking state ("OK")<br>
|
||||
Checks the state of all HA softs, usually : Synchronization,Filter,
|
||||
cphad and fwd.</p>
|
||||
<p class="SectionBody"><span class="SectionTitle">SNMP Login</span><br>
|
||||
</p>
|
||||
<p class="SectionBody">See <a href="index_info.html">snmp info page</a></p>
|
||||
|
||||
<p class="SectionTitle">Requirements :</p>
|
||||
|
||||
<p class="SectionBody">- On the Checkpoint Firewall : SNMP extentions
|
||||
|
||||
must be active</p>
|
||||
|
||||
<p class="SectionBody">- Perl in /usr/bin/perl - or just run 'perl
|
||||
|
||||
script' <br>
|
||||
|
||||
- Net::SNMP<br>
|
||||
|
||||
- file 'utils.pm' in plugin diretory (/usr/local/nagios/libexec)</p>
|
||||
|
||||
<p class="SectionBody"><a href="index_commands.html" class="SectionTitle">Configurations
|
||||
|
||||
examples</a><br>
|
||||
|
||||
</p>
|
||||
|
||||
<p class="SectionBody"><a href="check_snmp_cpfw.pl" class="SectionTitle">Dowload
|
||||
lastest version : 1.2.1</a></p>
|
||||
|
||||
<p class="NewsItemDate"><span class="SectionTitle">Changelog</span>
|
||||
: On CVS repository on sourceforge : <a href="http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/">http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/</a>.</p>
|
||||
|
||||
<p class="SectionTitle">Examples :</p>
|
||||
|
||||
<p class="SectionBody"><br>
|
||||
|
||||
All examples below are considering the script is local directory.
|
||||
|
||||
Host to be checked is 127.0.0.1 with snmp community "public".</p>
|
||||
|
||||
<table border="1" cellspacing="5">
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="NewsItemDate" valign = top width="282">
|
||||
|
||||
<p>Get help
|
||||
|
||||
</td>
|
||||
|
||||
<td class="SectionBody" width="387">
|
||||
|
||||
<p>./check_snmp_cpfw.pl <b>-h</b></p>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="NewsItemDate" valign = top width="282">snmpv3 login</td>
|
||||
|
||||
<td class="SectionBody" width="387">./check_snmp_cpfw.pl -H 127.0.0.1
|
||||
|
||||
<b>-l login -x passwd .....</b></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="NewsItemDate" valign = top width="282">
|
||||
|
||||
<p>Check firewall / HA / SVN - for a HA filtering module -
|
||||
|
||||
</td>
|
||||
|
||||
<td class="SectionBody" width="387">
|
||||
|
||||
<p>./check_snmp_cpfw.pl -H 127.0.0.1 -C public <b>-swa</b></p>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="NewsItemDate" valign = top width="282">
|
||||
|
||||
<p align="right">Result example :
|
||||
|
||||
</td>
|
||||
|
||||
<td class="SectionBody" width="387">
|
||||
|
||||
<p>FW : OK / SVN : OK / HA : OK / CPFW Status : OK</p>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="NewsItemDate" valign = top width="282">
|
||||
|
||||
<p>Check SVN/Mgmt - for a management -
|
||||
|
||||
</td>
|
||||
|
||||
<td class="SectionBody" width="387">
|
||||
|
||||
<p>./check_snmp_cpfw.pl -H 127.0.0.1 -C public <b>-sm</b></p>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="NewsItemDate" valign = top width="282">
|
||||
|
||||
<div align="right">Result example : </div>
|
||||
|
||||
</td>
|
||||
|
||||
<td class="SectionBody" width="387">SVN : OK / MGMT : OK / CPFW
|
||||
|
||||
Status : OK</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="NewsItemDate" valign = top width="282">Check policy
|
||||
|
||||
name </td>
|
||||
|
||||
<td class="SectionBody" width="387">./check_snmp_cpfw.pl -H 127.0.0.1
|
||||
|
||||
-C public <b>-w -p prod</b></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="NewsItemDate" valign = top width="282">
|
||||
|
||||
<p align="right">Result example : </p>
|
||||
|
||||
</td>
|
||||
|
||||
<td class="SectionBody" width="387">FW : OK / CPFW Status : OK</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="NewsItemDate" valign = top width="282">
|
||||
|
||||
<div align="right">Same with another policy installed : </div>
|
||||
|
||||
</td>
|
||||
|
||||
<td class="SectionBody" width="387">FW : Policy installed : Standard
|
||||
|
||||
/ CPFW Status : CRITICAL</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="NewsItemDate" valign = top width="282">Check number
|
||||
|
||||
of active connection with performance data output</td>
|
||||
|
||||
<td class="SectionBody" width="387">./check_snmp_cpfw.pl -H 127.0.0.1
|
||||
|
||||
-C public <b>-w -c 1000,5000 -f</b></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="NewsItemDate" valign = top width="282">
|
||||
|
||||
<div align="right">Result example : </div>
|
||||
|
||||
</td>
|
||||
|
||||
<td class="SectionBody" width="387">FW : OK / CPFW Status : OK
|
||||
|
||||
| fw_connexions=340</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<p class="SectionBody"> </p>
|
||||
|
||||
<p class="NewsItemDate">Output of check_snmp_cpfw.pl -h</p>
|
||||
|
||||
<table border="1" cellspacing="5">
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="SectionBody" valign = top>
|
||||
<p class="SectionBody">SNMP Checkpoint FW-1 Monitor for Nagios
|
||||
version 1.2.1<br>
|
||||
GPL Licence, (c)2004-2007 - Patrick Proy
|
||||
<p>Usage: ./check_snmp_cpfw.pl [-v] -H <host> -C <snmp_community>
|
||||
[-2] | (-l login -x passwd [-X pass -L <authp>,<privp>])
|
||||
[-s] [-w [-p=pol_name] [-c=warn,crit]] [-m] [-a [standby]
|
||||
] [-f] [-p <port>] [-t <timeout>] [-V]<br>
|
||||
-v, --verbose<br>
|
||||
print extra debugging information (including interface list
|
||||
on the system)<br>
|
||||
-h, --help<br>
|
||||
print this help message<br>
|
||||
-H, --hostname=HOST<br>
|
||||
name or IP address of host to check<br>
|
||||
-C, --community=COMMUNITY NAME<br>
|
||||
community name for the host's SNMP agent (implies v1 protocol)<br>
|
||||
2, --v2c<br>
|
||||
Use snmp v2c<br>
|
||||
-l, --login=LOGIN ; -x, --passwd=PASSWD<br>
|
||||
Login and auth password for snmpv3 authentication <br>
|
||||
If no priv password exists, implies AuthNoPriv <br>
|
||||
-X, --privpass=PASSWD<br>
|
||||
Priv password for snmpv3 (AuthPriv protocol)<br>
|
||||
-L, --protocols=<authproto>,<privproto><br>
|
||||
<authproto> : Authentication protocol (md5|sha : default
|
||||
md5)<br>
|
||||
<privproto> : Priv protocole (des|aes : default des)
|
||||
<br>
|
||||
-s, --svn<br>
|
||||
check for svn status<br>
|
||||
-w, --fw<br>
|
||||
check for fw status<br>
|
||||
-a, --ha[=standby]<br>
|
||||
check for ha status and node in "active" state<br>
|
||||
If using SecurePlatform and monitoring a standby unit, put
|
||||
"standby" too<br>
|
||||
-m, --mgmt<br>
|
||||
check for management status<br>
|
||||
-p, --policy=POLICY_NAME<br>
|
||||
check if installed policy is POLICY_NAME (must have -w)<br>
|
||||
-c, --connexions=WARN,CRIT<br>
|
||||
check warn and critical number of connexions (must have -w)<br>
|
||||
-f, --perfparse<br>
|
||||
perfparse output (only works with -c)<br>
|
||||
-P, --port=PORT<br>
|
||||
SNMP port (Default 161)<br>
|
||||
-t, --timeout=INTEGER<br>
|
||||
timeout for SNMP (Default: Nagios default) <br>
|
||||
-V, --version<br>
|
||||
prints version number<br>
|
||||
</p>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
|
||||
<p class="SectionBody">This project is hosted on : <br>
|
||||
|
||||
<A href="http://sourceforge.net/projects/nagios-snmp"> <IMG src="http://sourceforge.net/sflogo.php?group_id=134917&type=5" width="210" height="62" border="0" alt="SourceForge.net Logo" /></A>
|
||||
|
||||
</p>
|
||||
|
||||
<p class="SectionBody"> Nagios and the Nagios logo are registered
|
||||
|
||||
trademarks of Ethan Galstad.</p>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
</HTML>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
381
doc/snmp_css.html
Executable file
381
doc/snmp_css.html
Executable file
|
@ -0,0 +1,381 @@
|
|||
<HTML>
|
||||
|
||||
<HEAD>
|
||||
|
||||
<TITLE>Nagios plugins</TITLE>
|
||||
|
||||
<META NAME="Keywords" CONTENT="nagios,plugins,perl,snmp,proy">
|
||||
|
||||
<STYLE type="text/css">
|
||||
|
||||
<!--
|
||||
|
||||
.Default { font-family: verdana,arial,serif; font-size: 10pt; }
|
||||
|
||||
.ProgramTitle { font-family: verdana,arial,serif; font-size: 18pt; font-weight: bold;}
|
||||
|
||||
.Copyright { font-family: verdana,arial,serif; font-size: 10pt;}
|
||||
|
||||
.Email { font-family: verdana,arial,serif; font-size: 10pt;}
|
||||
|
||||
.NewsItem { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
|
||||
.NewsItemOdd { font-family: verdana,arial,serif; font-size: 8pt; background-color: #DBDBDB;}
|
||||
|
||||
.NewsItemEven { font-family: verdana,arial,serif; font-size: 8pt; background-color: #C4C2C2;}
|
||||
|
||||
.NewsItemUrgent { font-family: verdana,arial,serif; font-size: 8pt; background-color: #ccff99;}
|
||||
|
||||
.NewsItemDate { font-family: verdana,arial,serif; font-size: 8pt; font-weight: bold; }
|
||||
|
||||
.SectionTitle { font-family: verdana,arial,serif; font-size: 9pt; font-weight: bold; text-decoration: underline;}
|
||||
|
||||
.SectionBody { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
|
||||
.ModificationDate { font-family: verdana,arial,serif; font-size: 7pt; }
|
||||
|
||||
.Disclaimer { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
|
||||
A.SideNavBarItem { font-family: verdana,arial,serif; background-color : black; color: #e7e7e7; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
|
||||
A.SideNavBarItem:Hover { font-family: verdana,arial,serif; background-color : black; color: #ccff33; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
|
||||
A.SideNavBarHotItem { font-family: verdana,arial,serif; background-color : black; color: #ffcc66; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
|
||||
A.SideNavBarHotItem:Hover { font-family: verdana,arial,serif; background-color : black; color: #ccff33; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
|
||||
-->
|
||||
|
||||
</STYLE>
|
||||
|
||||
</HEAD>
|
||||
|
||||
<body background="img/sideback.jpg" bgcolor="#FFFFFF" text="black" class="Default">
|
||||
|
||||
<!-- background="img/sideback.jpg" -->
|
||||
|
||||
<table border="0">
|
||||
|
||||
<tr>
|
||||
|
||||
<td valign=top>
|
||||
|
||||
<!-- Begin Side Bar -->
|
||||
|
||||
<table border="0" width="125" valign=top>
|
||||
|
||||
<tr>
|
||||
|
||||
<td><a href="http://nagios.manubulon.com/" class="SideNavBarItem" >Home</a></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td><BR>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td> </td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<!-- End Side Bar -->
|
||||
|
||||
</td>
|
||||
|
||||
<td valign=top>
|
||||
|
||||
<table border="0" valign=top>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="ProgramTitle"> Snmp CSS check</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
|
||||
<p class="NewsItemDate">Script : check_snmp_css.pl / check_snmp_css_main.pl</p>
|
||||
|
||||
<p class="SectionTitle"> Last update : Jan 22 2007</p>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td valign="top">
|
||||
|
||||
<p class="SectionTitle">Description : </p>
|
||||
|
||||
<p class="SectionBody">Checks by snmp v1, v2c or v3 CSS services state</p>
|
||||
<p class="SectionBody"><span class="SectionTitle">SNMP Login</span><br>
|
||||
|
||||
</p>
|
||||
|
||||
<p class="SectionBody">See <a href="index_info.html">snmp info page</a></p>
|
||||
|
||||
<p class="SectionTitle">Requirements :</p>
|
||||
|
||||
<p class="SectionBody"> - Perl in /usr/bin/perl - or just run 'perl
|
||||
script' <br>
|
||||
- Net::SNMP<br>
|
||||
- file 'utils.pm' in plugin diretory (/usr/local/nagios/libexec)<br>
|
||||
</p>
|
||||
<p class="SectionTitle">Checks </p>
|
||||
<p class="SectionBody">This scripts checks status of the CSS services.</p>
|
||||
<p class="SectionBody"><b class="SectionTitle">Select service(s)</b><br>
|
||||
You select services you wan't to check with -n using regular expressions</p>
|
||||
<p class="SectionBody"><b class="SectionTitle">Put thresholds</b><br>
|
||||
You select the warning and critical levels for : <num>,<resp>,<conn>
|
||||
<br>
|
||||
num : minimum number of active & alive service <br>
|
||||
resp : average response time in ms<br>
|
||||
conn : number of connexions </p>
|
||||
<p class="SectionBody">You can choose not to put 1, 2 or 3 numbers.
|
||||
<br>
|
||||
If you set "-w 3" only the number of active services will
|
||||
be checked.<br>
|
||||
If you set "-w 3,200" only the number of active services
|
||||
and response time will be checked.<br>
|
||||
<br>
|
||||
For no warnings, put -1 (ex : -w5,-1,3). <br>
|
||||
When using negative numbers, dont put space after "-w"
|
||||
: "-w -1,100,6" will not work, "-w-1,100,6"
|
||||
will work.</p>
|
||||
<p class="SectionBody"><b class="SectionTitle">-d option and check_snmp_css_main.pl</b></p>
|
||||
<p class="SectionBody">This option is set to make the script read
|
||||
the index from a file instead of on the CSS.</p>
|
||||
<p class="SectionBody">The reason of this option is :<br>
|
||||
- when you have a lot (> 50) services on the CSS <br>
|
||||
- you want to check 10 service group consisting of 5 services every
|
||||
2 minutes.</p>
|
||||
<p class="SectionBody">If you use check_snmp_css, then it will read
|
||||
the index (50 oids) + checks 5 oids = 55 OID every 12 seconds in
|
||||
average. This will heavily load the CSS.<br>
|
||||
This is why I wrote check_snmp_css_main.pl. This script will get
|
||||
the index of the CSS every 10 minutes for example (could be more)
|
||||
as the index won't change often.<br>
|
||||
Then the check_snmp_css will only have to check for the 5 oids every
|
||||
12 seconds, which will reduce by about 10 the amount of snmp queries
|
||||
!</p>
|
||||
<p class="SectionBody">How to use it :</p>
|
||||
<p class="SectionBody">Create a service with long inter-delay check
|
||||
executing : </p>
|
||||
<p class="SectionBody">check_snmp_css_main.pl -H <host> <snmp
|
||||
logins> -2 -d /var/tmp<br>
|
||||
<b>-2 </b>if for using snmpv2c (better to get a lot of data)<br>
|
||||
<b>-d /var/tmp </b>is to put the temp file to a special directory
|
||||
(default is /tmp).</p>
|
||||
<p class="SectionBody">A file named : <b>Nagios_CSS_<IP Address></b>
|
||||
will be created</p>
|
||||
<p class="SectionBody">Then you can use your check_snmp_css.pl script
|
||||
just as before but adding the '<b>-d</b>' option with the temp directory
|
||||
if not /tmp.</p>
|
||||
<p class="SectionBody">If the Nagios_CSS_<IP> file is not created
|
||||
when the check_snmp_css script runs, it will then return unknown
|
||||
status.<br>
|
||||
If the check_snmp_css_main.pl cannot read index, a warning will
|
||||
be returned but the old index file will remain.</p>
|
||||
<p class="SectionBody">A lockfile is created bye check_snmp_css_main.pl
|
||||
when it writes it's file. The check_snmp_css script will wait until
|
||||
the lock file is removed to read the index file. <br>
|
||||
The lock file is named : <b>Nagios_CSS_<IP Address>.lock<br>
|
||||
</b>The lock file format is simple: every line is in format <b>
|
||||
<br>
|
||||
<OID>:<Service name></b> </p>
|
||||
<p class="SectionBody"> </p>
|
||||
<p class="SectionBody"><a href="check_snmp_css.pl" class="SectionTitle">Dowload
|
||||
lastest version of check_snmp_css.pl : 1.0</a></p>
|
||||
<p class="SectionBody"><a href="check_snmp_css_main.pl" class="SectionTitle">Dowload
|
||||
lastest version of check_snmp_css_main.pl : 1.0</a></p>
|
||||
|
||||
<p class="SectionBody"><a href="index_commands.html" class="SectionTitle">Configurations
|
||||
|
||||
examples</a></p>
|
||||
|
||||
<p class="NewsItemDate"><span class="SectionTitle">Changelog</span>
|
||||
: On CVS repository on sourceforge : <a href="http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/">http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/</a>.</p>
|
||||
|
||||
<p class="SectionTitle">Examples :</p>
|
||||
|
||||
<p class="SectionBody"><br>
|
||||
|
||||
All examples below are considering the script is local directory.
|
||||
|
||||
Host to be checked is 127.0.0.1 with snmp community "public".</p>
|
||||
|
||||
<table border="1" cellspacing="5">
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="154">
|
||||
<p>Get help
|
||||
</td>
|
||||
<td class="SectionBody" width="420">
|
||||
<p>./check_snmp_css.pl <b>-h</b></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="154">Verbose output</td>
|
||||
<td class="SectionBody" width="420">./check_snmp_css.pl -H <IP>
|
||||
-C <com> <b>-v</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="154">snmpv3 login</td>
|
||||
<td class="SectionBody" width="420">./check_snmp_css.pl -H 127.0.0.1
|
||||
-l login -x passwd<b></b></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p class="NewsItemDate">Output of check_snmp_css.pl -h </p>
|
||||
|
||||
<table border="1" cellspacing="5" width="100">
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
<pre>
|
||||
SNMP Cisco CSS monitor for Nagios version 1.0
|
||||
(c)2004-2006 Patrick Proy
|
||||
|
||||
Usage: ./check_snmp_css.pl [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>])
|
||||
-n <name> [-d directory] [-w <num>,<resp>,<conn> -c <num>,<resp>,<conn>] [-p <port>] [-f] [-t <timeout>] [-V]
|
||||
-v, --verbose
|
||||
print extra debugging information
|
||||
-h, --help
|
||||
print this help message
|
||||
-H, --hostname=HOST
|
||||
name or IP address of host to check
|
||||
-n, --name=<name>
|
||||
regexp to select service
|
||||
-w, --warning=<num>,<resp>,<conn>
|
||||
Optional. Warning level for
|
||||
- minimum number of active & alive service
|
||||
- average response time
|
||||
- number of connexions
|
||||
For no warnings, put -1 (ex : -w5,-1,3).
|
||||
When using negative numbers, dont put space after "-w"
|
||||
-d, --dir=<directory to put file>
|
||||
Directory where the temp file with index, created by check_snmp_css_main.pl, can be found
|
||||
If no directory is set, /tmp will be used
|
||||
-c, --critical=<num>,resp>,<conn>
|
||||
Optional. Critical levels (-1 for no critical levels)
|
||||
See warning levels.
|
||||
-C, --community=COMMUNITY NAME
|
||||
community name for the host's SNMP agent (implies v1 protocol)
|
||||
-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=<authproto>,<privproto>
|
||||
<authproto> : Authentication protocol (md5|sha : default md5)
|
||||
<privproto> : Priv protocole (des|aes : default des)
|
||||
-P, --port=PORT
|
||||
SNMP port (Default 161)
|
||||
-f, --perfparse
|
||||
Perfparse compatible output
|
||||
-t, --timeout=INTEGER
|
||||
timeout for SNMP in seconds (Default: 5)
|
||||
-V, --version
|
||||
prints version number
|
||||
</pre>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<p class="NewsItemDate">Output of check_snmp_css_main.pl -h </p>
|
||||
<table border="1" cellspacing="5" width="100">
|
||||
<tr>
|
||||
<td>
|
||||
<pre>
|
||||
SNMP Cisco CSS monitor MAIN script for Nagios version 1.0
|
||||
GPL Licence, (c)2004-2006 Patrick Proy
|
||||
|
||||
Usage: ./check_snmp_css_main.pl [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>])
|
||||
[-d directory] [-p <port>] [-t <timeout>] [-V]
|
||||
-v, --verbose
|
||||
print extra debugging information
|
||||
-h, --help
|
||||
print this help message
|
||||
-H, --hostname=HOST
|
||||
name or IP address of host to check
|
||||
-d, --dir=<directory to put file>
|
||||
Directory where temp file with index is written
|
||||
-C, --community=COMMUNITY NAME
|
||||
community name for the host's SNMP agent (implies v1 protocol)
|
||||
-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=<authproto>,<privproto>
|
||||
<authproto> : Authentication protocol (md5|sha : default md5)
|
||||
<privproto> : Priv protocole (des|aes : default des)
|
||||
-P, --port=PORT
|
||||
SNMP port (Default 161)
|
||||
-t, --timeout=INTEGER
|
||||
timeout for SNMP in seconds (Default: 5)
|
||||
-V, --version
|
||||
prints version number
|
||||
</pre>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
|
||||
<p class="SectionBody">This project is hosted on : <br>
|
||||
|
||||
<A href="http://sourceforge.net/projects/nagios-snmp"> <IMG src="http://sourceforge.net/sflogo.php?group_id=134917&type=5" width="210" height="62" border="0" alt="SourceForge.net Logo" /></A>
|
||||
|
||||
</p>
|
||||
|
||||
<p class="SectionBody"> Nagios and the Nagios logo are registered
|
||||
|
||||
trademarks of Ethan Galstad.</p>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
</HTML>
|
||||
|
||||
|
||||
|
370
doc/snmp_env.html
Executable file
370
doc/snmp_env.html
Executable file
|
@ -0,0 +1,370 @@
|
|||
<HTML>
|
||||
|
||||
<HEAD>
|
||||
|
||||
<TITLE>Nagios plugins</TITLE>
|
||||
|
||||
<META NAME="Keywords" CONTENT="nagios,plugins,perl,snmp,proy">
|
||||
|
||||
<STYLE type="text/css">
|
||||
|
||||
<!--
|
||||
|
||||
.Default { font-family: verdana,arial,serif; font-size: 10pt; }
|
||||
|
||||
.ProgramTitle { font-family: verdana,arial,serif; font-size: 18pt; font-weight: bold;}
|
||||
|
||||
.Copyright { font-family: verdana,arial,serif; font-size: 10pt;}
|
||||
|
||||
.Email { font-family: verdana,arial,serif; font-size: 10pt;}
|
||||
|
||||
.NewsItem { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
|
||||
.NewsItemOdd { font-family: verdana,arial,serif; font-size: 8pt; background-color: #DBDBDB;}
|
||||
|
||||
.NewsItemEven { font-family: verdana,arial,serif; font-size: 8pt; background-color: #C4C2C2;}
|
||||
|
||||
.NewsItemUrgent { font-family: verdana,arial,serif; font-size: 8pt; background-color: #ccff99;}
|
||||
|
||||
.NewsItemDate { font-family: verdana,arial,serif; font-size: 8pt; font-weight: bold; }
|
||||
|
||||
.SectionTitle { font-family: verdana,arial,serif; font-size: 9pt; font-weight: bold; text-decoration: underline;}
|
||||
|
||||
.SectionBody { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
|
||||
.ModificationDate { font-family: verdana,arial,serif; font-size: 7pt; }
|
||||
|
||||
.Disclaimer { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
|
||||
A.SideNavBarItem { font-family: verdana,arial,serif; background-color : black; color: #e7e7e7; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
|
||||
A.SideNavBarItem:Hover { font-family: verdana,arial,serif; background-color : black; color: #ccff33; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
|
||||
A.SideNavBarHotItem { font-family: verdana,arial,serif; background-color : black; color: #ffcc66; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
|
||||
A.SideNavBarHotItem:Hover { font-family: verdana,arial,serif; background-color : black; color: #ccff33; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
|
||||
-->
|
||||
|
||||
</STYLE>
|
||||
|
||||
</HEAD>
|
||||
|
||||
<body background="img/sideback.jpg" bgcolor="#FFFFFF" text="black" class="Default">
|
||||
|
||||
<!-- background="img/sideback.jpg" -->
|
||||
|
||||
<table border="0">
|
||||
|
||||
<tr>
|
||||
|
||||
<td valign=top>
|
||||
|
||||
<!-- Begin Side Bar -->
|
||||
|
||||
<table border="0" width="125" valign=top>
|
||||
|
||||
<tr>
|
||||
|
||||
<td><a href="http://nagios.manubulon.com/" class="SideNavBarItem" >Home</a></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td><BR>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td> </td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<!-- End Side Bar -->
|
||||
|
||||
</td>
|
||||
|
||||
<td valign=top>
|
||||
|
||||
<table border="0" valign=top>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="ProgramTitle"> Snmp env check</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
|
||||
<p class="NewsItemDate">Script : check_snmp_env.pl</p>
|
||||
|
||||
<p class="SectionTitle"> Last update : April 19 2007</p>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td valign="top">
|
||||
|
||||
<p class="SectionTitle">Description : </p>
|
||||
|
||||
<p class="SectionBody">Checks by snmp v1, v2c or v3 environemental
|
||||
parameters such as fan, power supply, temperature</p>
|
||||
<p class="SectionBody"><span class="SectionTitle">SNMP Login</span><br>
|
||||
|
||||
</p>
|
||||
|
||||
<p class="SectionBody">See <a href="index_info.html">snmp info page</a></p>
|
||||
|
||||
<p class="SectionTitle">Requirements :</p>
|
||||
|
||||
<p class="SectionBody"> - Perl in /usr/bin/perl - or just run 'perl
|
||||
script' <br>
|
||||
- Net::SNMP<br>
|
||||
- file 'utils.pm' in plugin diretory (/usr/local/nagios/libexec)<br>
|
||||
</p>
|
||||
<p class="SectionTitle">Checks </p>
|
||||
<p class="SectionBody">The script will make the following checks depending
|
||||
on host type.<br>
|
||||
Either the threshold is directly set by the hardware manufacturer,
|
||||
or you must set them with an option.</p>
|
||||
<p class="SectionBody">This table shows what the script CAN check,
|
||||
depending on hardware version the sensors might not be there.<br>
|
||||
The script will return "UNKNOWN" if no sensors can be
|
||||
found. </p>
|
||||
<p class="SectionBody">If no option is specified in this table, it
|
||||
means the script uses the threshold of the snmp table.</p>
|
||||
<table width="100%" border="1">
|
||||
<tr>
|
||||
<td class="SectionTitle">Host type</td>
|
||||
<td class="SectionTitle">Option</td>
|
||||
<td class="SectionTitle">Power supply</td>
|
||||
<td class="SectionTitle">Fan</td>
|
||||
<td class="SectionTitle">Voltage</td>
|
||||
<td class="SectionTitle">Temperature</td>
|
||||
<td class="SectionTitle">Disks</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="SectionBody">Cisco</td>
|
||||
<td class="SectionBody">cisco</td>
|
||||
<td class="SectionBody">Yes</td>
|
||||
<td class="SectionBody">Yes</td>
|
||||
<td class="SectionBody">No (working on it)</td>
|
||||
<td class="SectionBody">No (working on it)</td>
|
||||
<td class="SectionBody">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="SectionBody">Nokia Ipso</td>
|
||||
<td class="SectionBody">nokia</td>
|
||||
<td class="SectionBody">Yes</td>
|
||||
<td class="SectionBody">Yes</td>
|
||||
<td class="SectionBody">No.</td>
|
||||
<td class="SectionBody">Yes</td>
|
||||
<td class="SectionBody">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="SectionBody">Bluecoat</td>
|
||||
<td class="SectionBody">bc</td>
|
||||
<td class="SectionBody">Yes</td>
|
||||
<td class="SectionBody">Yes</td>
|
||||
<td class="SectionBody">Yes</td>
|
||||
<td class="SectionBody">Yes</td>
|
||||
<td class="SectionBody">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="SectionBody">IronPort</td>
|
||||
<td class="SectionBody">iron</td>
|
||||
<td class="SectionBody">Yes</td>
|
||||
<td class="SectionBody">Yes, option '-F' in RPM</td>
|
||||
<td class="SectionBody">No</td>
|
||||
<td class="SectionBody">Yes, option '-c' in Celcius</td>
|
||||
<td class="SectionBody">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="SectionBody">Foundry</td>
|
||||
<td class="SectionBody">Foundry</td>
|
||||
<td class="SectionBody">Yes</td>
|
||||
<td class="SectionBody">No (bug in snmp agent)</td>
|
||||
<td class="SectionBody">No</td>
|
||||
<td class="SectionBody">Yes</td>
|
||||
<td class="SectionBody">No</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p class="SectionBody">Note : Bluecoat provides an "other"
|
||||
sensor which is tested also. But I never saw a Bluecoat reporting
|
||||
it.</p>
|
||||
<p class="SectionBody"> </p>
|
||||
|
||||
<p class="SectionBody"><a href="check_snmp_env.pl" class="SectionTitle">Dowload
|
||||
lastest version : 1.2</a></p>
|
||||
|
||||
<p class="SectionBody"><a href="index_commands.html" class="SectionTitle">Configurations
|
||||
|
||||
examples</a></p>
|
||||
|
||||
<p class="NewsItemDate"><span class="SectionTitle">Changelog</span>
|
||||
: On CVS repository on sourceforge : <a href="http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/">http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/</a>.</p>
|
||||
|
||||
<p class="SectionTitle">Examples :</p>
|
||||
|
||||
<p class="SectionBody"><br>
|
||||
|
||||
All examples below are considering the script is local directory.
|
||||
|
||||
Host to be checked is 127.0.0.1 with snmp community "public".</p>
|
||||
|
||||
<table border="1" cellspacing="5">
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="154">
|
||||
<p>Get help
|
||||
</td>
|
||||
<td class="SectionBody" width="420">
|
||||
<p>./check_snmp_env.pl <b>-h</b></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="154">Verbose output</td>
|
||||
<td class="SectionBody" width="420">./check_snmp_env.pl -H <IP>
|
||||
-C <com> <b>-v</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="154">snmpv3 login</td>
|
||||
<td class="SectionBody" width="420">./check_snmp_env.pl -H 127.0.0.1
|
||||
-l login -x passwd<b></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="154">
|
||||
<p>Check Cisco for all sensors
|
||||
</td>
|
||||
<td class="SectionBody" width="420">
|
||||
<p class="SectionBody">./check_snmp_env.pl -H 127.0.0.1 -C public
|
||||
<b>-T cisco</b></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="154">Check Nokia
|
||||
for all sensors</td>
|
||||
<td class="SectionBody" width="420">./check_snmp_env.pl -H 127.0.0.1
|
||||
-C public <b>-T nokia</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="154">checks ironport
|
||||
fans RPM > 1500 and temp < 70 deg celcius</td>
|
||||
<td class="SectionBody" width="420">./check_snmp_env.pl -H 127.0.0.1
|
||||
-C public <b>-T iron -F 1500 -c 70</b></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p class="NewsItemDate">Output of check_snmp_env.pl -h </p>
|
||||
|
||||
<table border="1" cellspacing="5">
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="SectionBody" valign = top>
|
||||
<p class="SectionBody"> <br>
|
||||
SNMP environmental Monitor for Nagios version 1.2<br>
|
||||
GPL Licence, (c)2006-2007 Patrick Proy
|
||||
<p>Usage: ./check_snmp_env.pl [-v] -H <host> -C <snmp_community>
|
||||
[-2] | (-l login -x passwd [-X pass -L <authp>,<privp>])
|
||||
[-p <port>] -T (cisco|nokia|bc|iron|foundry) [-F <rpm>]
|
||||
[-c <celcius>] [-f] [-t <timeout>] [-V]<br>
|
||||
-v, --verbose<br>
|
||||
print extra debugging information <br>
|
||||
-h, --help<br>
|
||||
print this help message<br>
|
||||
-H, --hostname=HOST<br>
|
||||
name or IP address of host to check<br>
|
||||
-C, --community=COMMUNITY NAME<br>
|
||||
community name for the host's SNMP agent (implies v1 protocol)<br>
|
||||
-2, --v2c<br>
|
||||
Use snmp v2c<br>
|
||||
-l, --login=LOGIN ; -x, --passwd=PASSWD<br>
|
||||
Login and auth password for snmpv3 authentication <br>
|
||||
If no priv password exists, implies AuthNoPriv <br>
|
||||
-X, --privpass=PASSWD<br>
|
||||
Priv password for snmpv3 (AuthPriv protocol)<br>
|
||||
-L, --protocols=<authproto>,<privproto><br>
|
||||
<authproto> : Authentication protocol (md5|sha : default
|
||||
md5)<br>
|
||||
<privproto> : Priv protocole (des|aes : default des)
|
||||
<br>
|
||||
-P, --port=PORT<br>
|
||||
SNMP port (Default 161)<br>
|
||||
-T, --type=cisco|nokia|bc|iron|foundry<br>
|
||||
Environemental check : <br>
|
||||
cisco : voltage,temp,fan,power supply status<br>
|
||||
will try to check everything present<br>
|
||||
nokia : fan and power supply<br>
|
||||
bc : fans, power supply, voltage, disks<br>
|
||||
iron : fans, power supply, temp<br>
|
||||
foundry : power supply, temp<br>
|
||||
-F, --fan=<rpm><br>
|
||||
Minimum fan rpm value<br>
|
||||
-c, --celcius=<celcius><br>
|
||||
Maximum temp in degree celcius<br>
|
||||
-f, --perfparse<br>
|
||||
Perfparse compatible output<br>
|
||||
-t, --timeout=INTEGER<br>
|
||||
timeout for SNMP in seconds (Default: 5)<br>
|
||||
-V, --version<br>
|
||||
prints version number<br>
|
||||
</p>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
|
||||
<p class="SectionBody">This project is hosted on : <br>
|
||||
|
||||
<A href="http://sourceforge.net/projects/nagios-snmp"> <IMG src="http://sourceforge.net/sflogo.php?group_id=134917&type=5" width="210" height="62" border="0" alt="SourceForge.net Logo" /></A>
|
||||
|
||||
</p>
|
||||
|
||||
<p class="SectionBody"> Nagios and the Nagios logo are registered
|
||||
|
||||
trademarks of Ethan Galstad.</p>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
</HTML>
|
||||
|
||||
|
||||
|
690
doc/snmp_int.html
Executable file
690
doc/snmp_int.html
Executable file
|
@ -0,0 +1,690 @@
|
|||
<HTML>
|
||||
|
||||
<HEAD>
|
||||
|
||||
<TITLE>Nagios plugins</TITLE>
|
||||
|
||||
<META NAME="Keywords" CONTENT="nagios,plugins,perl,snmp,proy">
|
||||
|
||||
<STYLE type="text/css">
|
||||
|
||||
<!--
|
||||
|
||||
.Default { font-family: verdana,arial,serif; font-size: 10pt; }
|
||||
|
||||
.ProgramTitle { font-family: verdana,arial,serif; font-size: 18pt; font-weight: bold;}
|
||||
|
||||
.Copyright { font-family: verdana,arial,serif; font-size: 10pt;}
|
||||
|
||||
.Email { font-family: verdana,arial,serif; font-size: 10pt;}
|
||||
|
||||
.NewsItem { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
|
||||
.NewsItemOdd { font-family: verdana,arial,serif; font-size: 8pt; background-color: #DBDBDB;}
|
||||
|
||||
.NewsItemEven { font-family: verdana,arial,serif; font-size: 8pt; background-color: #C4C2C2;}
|
||||
|
||||
.NewsItemUrgent { font-family: verdana,arial,serif; font-size: 8pt; background-color: #ccff99;}
|
||||
|
||||
.NewsItemDate { font-family: verdana,arial,serif; font-size: 8pt; font-weight: bold; }
|
||||
|
||||
.SectionTitle { font-family: verdana,arial,serif; font-size: 9pt; font-weight: bold; text-decoration: underline;}
|
||||
|
||||
.SectionBody { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
|
||||
.ModificationDate { font-family: verdana,arial,serif; font-size: 7pt; }
|
||||
|
||||
.Disclaimer { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
|
||||
A.SideNavBarItem { font-family: verdana,arial,serif; background-color : black; color: #e7e7e7; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
|
||||
A.SideNavBarItem:Hover { font-family: verdana,arial,serif; background-color : black; color: #ccff33; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
|
||||
A.SideNavBarHotItem { font-family: verdana,arial,serif; background-color : black; color: #ffcc66; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
|
||||
A.SideNavBarHotItem:Hover { font-family: verdana,arial,serif; background-color : black; color: #ccff33; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
|
||||
-->
|
||||
|
||||
</STYLE>
|
||||
|
||||
</HEAD>
|
||||
|
||||
<body background="img/sideback.jpg" bgcolor="#FFFFFF" text="black" class="Default">
|
||||
|
||||
<!-- background="img/sideback.jpg" -->
|
||||
|
||||
<table border="0" height="1477">
|
||||
|
||||
<tr>
|
||||
|
||||
<td valign=top>
|
||||
|
||||
<!-- Begin Side Bar -->
|
||||
|
||||
<table border="0" width="125" valign=top>
|
||||
|
||||
<tr>
|
||||
|
||||
<td><a href="http://nagios.manubulon.com/" class="SideNavBarItem" >Home</a></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td><BR>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td> </td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<!-- End Side Bar -->
|
||||
|
||||
</td>
|
||||
|
||||
<td valign=top>
|
||||
|
||||
<table border="0" valign=top height="1452">
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="ProgramTitle"> Snmp interface check</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
|
||||
<p class="NewsItemDate">Script : check_snmp_int.pl</p>
|
||||
|
||||
<p class="SectionTitle"> Last update : March 17 2007</p>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td valign="top">
|
||||
|
||||
<p class="SectionTitle">Description :</p>
|
||||
|
||||
<p class="SectionBody">Checks by snmp (v1, v2c or v3) host interface
|
||||
|
||||
state and usage. <br>
|
||||
|
||||
<br>
|
||||
|
||||
Interfaces can be selected by regexp ( 'eth' will check eth0, eth1,
|
||||
|
||||
eth2, ...).<br>
|
||||
|
||||
If multiple interfaces are selected, all must be up to get an OK
|
||||
|
||||
result<br>
|
||||
|
||||
<b><br>
|
||||
|
||||
</b>Vérifie par snmp v1, v2c ou v3 l'état des interfaces
|
||||
|
||||
d'un hôte, leur utilisation (bande passante, erreurs, pertes)
|
||||
|
||||
et sortir des informations de performances.<br>
|
||||
|
||||
Ce script permet d'utiliser des expressions régulières
|
||||
|
||||
pour sélectionner les interfaces : ex 'eth' va vérifier
|
||||
|
||||
eth0, eth1, ...<br>
|
||||
|
||||
Il permet également de lister toutes les interfaces disponibles
|
||||
|
||||
sur la machine cible (option -v) pour voir leur nom en SNMP.<br>
|
||||
|
||||
<i>Pour les francophones, je ferais un manuel en Français
|
||||
|
||||
quand j'aurais le temps... (et toute aide est bienvenue).</i><b><br>
|
||||
|
||||
</b><br>
|
||||
|
||||
<span class="SectionTitle">Standard checks</span><br>
|
||||
|
||||
</p>
|
||||
|
||||
<p class="SectionBody">The script will check interface operationnal
|
||||
|
||||
status using the MIB-II table. The interface is (are) selected by
|
||||
|
||||
the <b>-n </b>option.<br>
|
||||
|
||||
This option will be treated as a regular expression (eth will match
|
||||
|
||||
eth0, eth1, eth2...). You can disable this with the <b>-r </b>option
|
||||
|
||||
: the interface will be selected if it's description exactly matches
|
||||
|
||||
the name given by -n</p>
|
||||
|
||||
<p class="SectionBody">The interfaces are selected by their description
|
||||
|
||||
in the MIB-II table.<br>
|
||||
<b>To see how interface looks like by snmp, you can list all of
|
||||
them with the '-v' switch.</b><br>
|
||||
|
||||
</p>
|
||||
|
||||
<p class="SectionBody">The script will return OK if ALL interfaces
|
||||
|
||||
selected are UP, or CRITICAL if at least one interface is down.<br>
|
||||
|
||||
<br>
|
||||
|
||||
You can make the script return a OK value when all interfaces are
|
||||
|
||||
down (and CRITICAL when at least one is up) with the <b>-i </b>option.</p>
|
||||
|
||||
<p class="SectionBody">You can make the same tests on administrative
|
||||
|
||||
status instead with the <b>-a </b>option.</p>
|
||||
|
||||
<p class="SectionBody">To make output shorter, specially when you
|
||||
|
||||
have multiple interface, you can put the <b>-s</b> option. <br>
|
||||
|
||||
It will get only the first <n> caracters of the interface
|
||||
|
||||
descrition. If the number is negative then get the last <n>
|
||||
|
||||
caracters.</p>
|
||||
|
||||
<p class="SectionBody">Ex : EL20005 3Com Gigabit NIC (3C2000 Family)<br>
|
||||
|
||||
<b> -s 4 </b> will output : "EL20".<br>
|
||||
|
||||
<b>-s -4</b> will output : "ily)".</p>
|
||||
|
||||
<p class="SectionTitle">Performance output </p>
|
||||
|
||||
<p class="SectionBody"><b>-f </b>option : activate performance output
|
||||
(default the In/out octet as a counter).<br>
|
||||
<b>-e </b>option : in/out errors and discarded packets. -f must
|
||||
also be set.<br>
|
||||
-<b>S</b> option : Include speed in performance output in bits/s
|
||||
as '<interface_name>_speed_bps'<br>
|
||||
<b>-y </b>option : output performance data in % of interface speed<b><br>
|
||||
-Y</b> option : output performance data in bits/s or Bytes/s (depending
|
||||
on -B)</p>
|
||||
<p class="SectionBody"><b>Note</b> : -y and -Y options need the usage
|
||||
check to ba active (-k)</p>
|
||||
<p class="SectionBody"><b>Warning</b> : the counters needed by -e
|
||||
|
||||
are not always available on all machines (ex Nokia IP)<br>
|
||||
|
||||
</p>
|
||||
|
||||
<p class="SectionBody"><span class="SectionTitle">Usage check (-k)
|
||||
</span><br>
|
||||
<br>
|
||||
<br>
|
||||
A temporary file will be created in "/tmp" by default
|
||||
: this can be changed at the beginning of the script. <br>
|
||||
The file name will be : tmp_Nagios_int.<host IP>.<Interface
|
||||
name>. One file will be created by interface.<br>
|
||||
<br>
|
||||
The status UNKNOWN is returned when the script doesn't have enough
|
||||
information (see -d option).<br>
|
||||
<br>
|
||||
You will have to tell the warning and critical levels, separated
|
||||
with "," and you can use decimal (ex : 10.3).<br>
|
||||
For standard checks (no "-q" option) : <br>
|
||||
-w <i><In warn></i>,<i><Out warn></i> -c <i><In warn></i>,<i><Out
|
||||
warn><br>
|
||||
</i>In warn : warning level for incomming traffic<br>
|
||||
Out warn : warning level for outgoing traffic<br>
|
||||
In crit : critical level for incomming traffic<br>
|
||||
Out crit : critical level for outgoing traffic<br>
|
||||
</p>
|
||||
<p class="SectionBody">The unit for the check depends on the -B, -M
|
||||
and -G option :</p>
|
||||
<table border="0" cellpadding="2" cellspacing="3" width="276">
|
||||
<tr>
|
||||
<td class="SectionBody" width="111"> </td>
|
||||
<td class="SectionBody" width="66"><b> -B set</b></td>
|
||||
<td class="SectionBody" width="75"><b>-B not set</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="SectionBody" width="111"><b>-M & -G not set</b></td>
|
||||
<td class="SectionBody" width="66">
|
||||
<div align="center">Kbps</div>
|
||||
</td>
|
||||
<td class="SectionBody" width="75">
|
||||
<div align="center">KBps</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="SectionBody" width="111"><b>-M set</b></td>
|
||||
<td class="SectionBody" width="66">
|
||||
<div align="center">Mbps</div>
|
||||
</td>
|
||||
<td class="SectionBody" width="75">
|
||||
<div align="center">MBps</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="SectionBody" width="111"><b>-G set</b></td>
|
||||
<td class="SectionBody" width="66">
|
||||
<div align="center">Gbps</div>
|
||||
</td>
|
||||
<td class="SectionBody" width="75">
|
||||
<div align="center">GBps</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p class="SectionBody">It is possible to put warning and critical
|
||||
|
||||
levels with -b option.<br>
|
||||
|
||||
<b>0 means no warning or critical level checks</b></p>
|
||||
|
||||
<p class="SectionBody">When the extended checks are activated (-q
|
||||
option), the warning levels are <br>
|
||||
-w <i><In bytes></i>,<i><Out bytes></i>,<i><In error></i>,<i><Out
|
||||
error>,<i><In disc></i>,<i><Out disc></i></i> -c
|
||||
<i><In warn></i>,<i><Out warn></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>
|
||||
</p>
|
||||
<p class="SectionBody"><b>-k</b> : activates the standard usage feature<br>
|
||||
<b>-q</b> : activates the extended usage<br>
|
||||
<b>-d</b> : delta in seconds (default is 300s)<br>
|
||||
<b>-w</b> : warning levels<br>
|
||||
<b>-c</b> : critical levels<br>
|
||||
</p>
|
||||
<p class="SectionBody"><b>-d</b>: delta time<br>
|
||||
|
||||
You can put the delta time as an option : the "delta"
|
||||
|
||||
is the prefered time between two values that the script will use
|
||||
|
||||
to calculate the average Kbytes/s or error/min. The delta time should
|
||||
|
||||
(not must) be bigger than the check interval.<br>
|
||||
|
||||
Here is an example : Check interval of 2 minutes and delta of 4min</p>
|
||||
|
||||
<p class="SectionBody">T0 : value 1 : can't calculate usage<br>
|
||||
|
||||
T0+2 : value 2 : can't calculate usage<br>
|
||||
|
||||
T0+4 : value 3 : usage=(value3-value1)/((T0+4)-T0) <br>
|
||||
|
||||
T0+6 : value 4 : usage=(value4-value2)/((T0+6)-T0+2)<br>
|
||||
|
||||
(Yes I know TO+4-T0=4, it's just to explain..)<br>
|
||||
|
||||
.........</p>
|
||||
|
||||
<p class="SectionBody">The script will allow 10% less of the delta
|
||||
|
||||
and 300% more than delta as a correct interval. <br>
|
||||
|
||||
For example, with a delta of 5 minutes, the acceptable interval
|
||||
|
||||
will be between 4'30" and 15 minutes.</p>
|
||||
|
||||
<p class="SectionBody"> <b>Msg size option </b>(<i>-o</i><b><i> </i></b>option)</p>
|
||||
<p class="SectionBody">In case you get a "ERROR: running table
|
||||
: Message size exceeded maxMsgSize" error, you may need to
|
||||
adjust the maxMsgSize, i.e. the maximum size of snmp message with
|
||||
the -o option. Try a value with the -o AND the -v option : the script
|
||||
will output the actual value so you can add some octets to it with
|
||||
the -o option.</p>
|
||||
<p class="SectionBody"><b>--label option</b></p>
|
||||
<p class="SectionBody">This option just put label before the speed
|
||||
output :<br>
|
||||
Without : eth1:UP (10.3Kbps/4.4Kbps), eth0:UP (10.9Kbps/16.4Kbps):2
|
||||
UP: OK<br>
|
||||
With : eth1:UP (in=14.4Kbps/out=6.2Kbps), eth0:UP (in=15.3Kbps/out=22.9Kbps):2
|
||||
UP: OK<br>
|
||||
</p>
|
||||
<p class="SectionBody"><span class="SectionTitle">SNMP Login</span><br>
|
||||
|
||||
</p>
|
||||
|
||||
<p class="SectionBody">See <a href="index_info.html">snmp info page</a></p>
|
||||
|
||||
<p class="SectionTitle">Requirements :</p>
|
||||
|
||||
<p class="SectionBody"> - Perl in /usr/bin/perl - or just run 'perl
|
||||
|
||||
script' <br>
|
||||
|
||||
- Net::SNMP<br>
|
||||
|
||||
- file 'utils.pm' in plugin diretory (/usr/local/nagios/libexec)<br>
|
||||
|
||||
</p>
|
||||
|
||||
<p class="SectionBody"><a href="check_snmp_int.pl" class="SectionTitle">Dowload
|
||||
latest version : 1.4.5</a></p>
|
||||
|
||||
<p class="SectionBody"><a href="index_commands.html" class="SectionTitle">Configuration
|
||||
|
||||
examples</a></p>
|
||||
|
||||
<p class="SectionTitle">Examples :</p>
|
||||
|
||||
<p class="SectionBody"><br>
|
||||
|
||||
All examples below are considering the script is local directory.
|
||||
|
||||
Host to be checked is 127.0.0.1 with snmp community "public".</p>
|
||||
|
||||
<p class="SectionBody">If multiple interfaces are selected, all must
|
||||
|
||||
be up to get an OK result</p>
|
||||
|
||||
<table border="1" cellspacing="5">
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="NewsItemDate" valign = top width="198">
|
||||
|
||||
<p>Get help
|
||||
|
||||
</td>
|
||||
|
||||
<td class="SectionBody" width="496">
|
||||
|
||||
<p>./check_snmp_int.pl <b>-h</b></p>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="NewsItemDate" valign = top width="198">List all interfaces</td>
|
||||
|
||||
<td class="SectionBody" width="496">./check_snmp_int.pl -H 127.0.0.1
|
||||
|
||||
-C public -n zzzz <b>-v</b></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="NewsItemDate" valign = top width="198">snmpv3 login</td>
|
||||
|
||||
<td class="SectionBody" width="496">./check_snmp_int.pl -H 127.0.0.1
|
||||
|
||||
-l login -w passwd<b></b></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="NewsItemDate" valign = top width="198">
|
||||
|
||||
<p>Check eth0 interface is up
|
||||
|
||||
</td>
|
||||
|
||||
<td class="SectionBody" width="496">
|
||||
|
||||
<p>./check_snmp_int.pl -H 127.0.0.1 -C public <b>-n eth0 -r</b></p>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="NewsItemDate" valign = top width="198">
|
||||
|
||||
<p>Check that all eth interface are up
|
||||
|
||||
</td>
|
||||
|
||||
<td class="SectionBody" width="496">
|
||||
|
||||
<p>./check_snmp_int.pl -H 127.0.0.1 -C public <b>-n eth </b></p>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="NewsItemDate" valign = top width="198">
|
||||
|
||||
<p>Check that all ppp interface are down
|
||||
|
||||
</td>
|
||||
|
||||
<td class="SectionBody" width="496">
|
||||
|
||||
<p>./check_snmp_int.pl -H 127.0.0.1 -C public <b>-n ppp -i</b></p>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="NewsItemDate" valign = top width="198">
|
||||
|
||||
<p>Check that all eth interface are administratively up
|
||||
|
||||
</td>
|
||||
|
||||
<td class="SectionBody" width="496">
|
||||
|
||||
<p>./check_snmp_int.pl -H 127.0.0.1 -C public <b>-n eth -a</b></p>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="NewsItemDate" valign = top width="198">
|
||||
|
||||
<p>Check that FastEternet0/11 to 0/14 are up (Cisco)
|
||||
|
||||
</td>
|
||||
|
||||
<td class="SectionBody" width="496">
|
||||
|
||||
<p>./check_snmp_int.pl -H 127.0.0.1 -C public <b>-n "Fast.*0.1[1234]"</b></p>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="NewsItemDate" valign = top width="198">Check the eth0
|
||||
|
||||
usage <br>
|
||||
|
||||
Note : no critical inbound (0)</td>
|
||||
|
||||
<td class="SectionBody" width="496">./check_snmp_int.pl -H 127.0.0.1
|
||||
|
||||
-C public -n eth0 <b>-k -w 200,400 -c 0,600</b></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<p class="NewsItemDate"><span class="SectionTitle">Changelog</span>
|
||||
: On CVS repository on sourceforge : <a href="http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/">http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/</a>.</p>
|
||||
|
||||
<p class="NewsItemDate">Output of check_snmp_int.pl -h</p>
|
||||
|
||||
<table border="1" cellspacing="5">
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="SectionBody" valign = top>
|
||||
<p class="SectionBody">SNMP Network Interface Monitor for Nagios
|
||||
version 1.4.5<br>
|
||||
GPL licence, (c)2004-2007 Patrick Proy
|
||||
<p>Usage: ./check_snmp_int.pl [-v] -H <host> -C <snmp_community>
|
||||
[-2] | (-l login -x passwd [-X pass -L <authp>,<privp>)
|
||||
[-p <port>] -n <name in desc_oid> [-i] [-a] [-r]
|
||||
[-f[eSyY]] [-k[qBMGu] -g -w<warn levels> -c<crit
|
||||
levels> -d<delta>] [-o <octet_length>] [-t
|
||||
<timeout>] [-s] [-V]<br>
|
||||
-v, --verbose<br>
|
||||
print extra debugging information (including interface list
|
||||
on the system)<br>
|
||||
-h, --help<br>
|
||||
print this help message<br>
|
||||
-H, --hostname=HOST<br>
|
||||
name or IP address of host to check<br>
|
||||
-C, --community=COMMUNITY NAME<br>
|
||||
community name for the host's SNMP agent (implies v1 protocol)<br>
|
||||
-l, --login=LOGIN ; -x, --passwd=PASSWD, -2, --v2c<br>
|
||||
Login and auth password for snmpv3 authentication <br>
|
||||
If no priv password exists, implies AuthNoPriv <br>
|
||||
-2 : use snmp v2c<br>
|
||||
-X, --privpass=PASSWD<br>
|
||||
Priv password for snmpv3 (AuthPriv protocol)<br>
|
||||
-L, --protocols=<authproto>,<privproto><br>
|
||||
<authproto> : Authentication protocol (md5|sha : default
|
||||
md5)<br>
|
||||
<privproto> : Priv protocole (des|aes : default des)
|
||||
<br>
|
||||
-P, --port=PORT<br>
|
||||
SNMP port (Default 161)<br>
|
||||
-n, --name=NAME<br>
|
||||
Name in description OID (eth0, ppp0 ...).<br>
|
||||
This is treated as a regexp : -n eth will match eth0,eth1,...<br>
|
||||
Test it before, because there are known bugs (ex : trailling
|
||||
/)<br>
|
||||
-r, --noregexp<br>
|
||||
Do not use regexp to match NAME in description OID<br>
|
||||
-i, --inverse<br>
|
||||
Make critical when up<br>
|
||||
-a, --admin<br>
|
||||
Use administrative status instead of operational<br>
|
||||
-o, --octetlength=INTEGER<br>
|
||||
max-size of the SNMP message, usefull in case of Too Long
|
||||
responses.<br>
|
||||
Be carefull with network filters. Range 484 - 65535, default
|
||||
are<br>
|
||||
usually 1472,1452,1460 or 1440. <br>
|
||||
-f, --perfparse<br>
|
||||
Perfparse compatible output (no output when interface is down).<br>
|
||||
-e, --error<br>
|
||||
Add error & discard to Perfparse output<br>
|
||||
-S, --intspeed<br>
|
||||
Include speed in performance output in bits/s<br>
|
||||
-y, --perfprct ; -Y, --perfspeed<br>
|
||||
-y : output performance data in % of max speed<br>
|
||||
-Y : output performance data in bits/s or Bytes/s (depending
|
||||
on -B) <br>
|
||||
-k, --perfcheck ; -q, --extperfcheck <br>
|
||||
-k check the input/ouput bandwidth of the interface<br>
|
||||
-q also check the error and discard input/output<br>
|
||||
-g, --64bits<br>
|
||||
Use 64 bits counters instead of the standard counters <br>
|
||||
when checking bandwidth & performance data.<br>
|
||||
-d, --delta=seconds<br>
|
||||
make an average of <delta> seconds (default 300=5min)<br>
|
||||
-B, --kbits<br>
|
||||
Make the warning and critical levels in K|M|G Bits/s instead
|
||||
of K|M|G Bytes/s<br>
|
||||
-G, --giga ; -M, --mega ; -u, --prct<br>
|
||||
-G : Make the warning and critical levels in Gbps (with -B)
|
||||
or GBps<br>
|
||||
-M : Make the warning and critical levels in Mbps (with -B)
|
||||
or MBps<br>
|
||||
-u : Make the warning and critical levels in % of reported
|
||||
interface speed.<br>
|
||||
-w, --warning=input,output[,error in,error out,discard in,discard
|
||||
out]<br>
|
||||
warning level for input / output bandwidth (0 for no warning)<br>
|
||||
unit depends on B,M,G,u options<br>
|
||||
warning for error & discard input / output in error/min
|
||||
(need -q)<br>
|
||||
-c, --critical=input,output[,error in,error out,discard in,discard
|
||||
out]<br>
|
||||
critical level for input / output bandwidth (0 for no critical)<br>
|
||||
unit depends on B,M,G,u options<br>
|
||||
critical for error & discard input / output in error/min
|
||||
(need -q)<br>
|
||||
-s, --short=int<br>
|
||||
Make the output shorter : only the first <n> chars of
|
||||
the interface(s)<br>
|
||||
If the number is negative, then get the <n> LAST caracters.<br>
|
||||
-t, --timeout=INTEGER<br>
|
||||
timeout for SNMP in seconds (Default: 5) <br>
|
||||
-V, --version<br>
|
||||
prints version number<br>
|
||||
Note : when multiple interface are selected with regexp, <br>
|
||||
all be must be up (or down with -i) to get an OK result.</p>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
|
||||
<p class="SectionBody">This project is hosted on : <br>
|
||||
|
||||
<A href="http://sourceforge.net/projects/nagios-snmp"> <IMG src="http://sourceforge.net/sflogo.php?group_id=134917&type=5" width="210" height="62" border="0" alt="SourceForge.net Logo" /></A>
|
||||
|
||||
</p>
|
||||
|
||||
<p class="SectionBody"> Nagios and the Nagios logo are registered
|
||||
|
||||
trademarks of Ethan Galstad.</p>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<p> </p>
|
||||
|
||||
</BODY>
|
||||
|
||||
</HTML>
|
||||
|
||||
|
||||
|
409
doc/snmp_load.html
Executable file
409
doc/snmp_load.html
Executable file
|
@ -0,0 +1,409 @@
|
|||
<HTML>
|
||||
|
||||
<HEAD>
|
||||
|
||||
<TITLE>Nagios plugins</TITLE>
|
||||
|
||||
<META NAME="Keywords" CONTENT="nagios,plugins,perl,snmp,proy">
|
||||
|
||||
<STYLE type="text/css">
|
||||
|
||||
<!--
|
||||
|
||||
.Default { font-family: verdana,arial,serif; font-size: 10pt; }
|
||||
|
||||
.ProgramTitle { font-family: verdana,arial,serif; font-size: 18pt; font-weight: bold;}
|
||||
|
||||
.Copyright { font-family: verdana,arial,serif; font-size: 10pt;}
|
||||
|
||||
.Email { font-family: verdana,arial,serif; font-size: 10pt;}
|
||||
|
||||
.NewsItem { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
|
||||
.NewsItemOdd { font-family: verdana,arial,serif; font-size: 8pt; background-color: #DBDBDB;}
|
||||
|
||||
.NewsItemEven { font-family: verdana,arial,serif; font-size: 8pt; background-color: #C4C2C2;}
|
||||
|
||||
.NewsItemUrgent { font-family: verdana,arial,serif; font-size: 8pt; background-color: #ccff99;}
|
||||
|
||||
.NewsItemDate { font-family: verdana,arial,serif; font-size: 8pt; font-weight: bold; }
|
||||
|
||||
.SectionTitle { font-family: verdana,arial,serif; font-size: 9pt; font-weight: bold; text-decoration: underline;}
|
||||
|
||||
.SectionBody { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
|
||||
.ModificationDate { font-family: verdana,arial,serif; font-size: 7pt; }
|
||||
|
||||
.Disclaimer { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
|
||||
A.SideNavBarItem { font-family: verdana,arial,serif; background-color : black; color: #e7e7e7; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
|
||||
A.SideNavBarItem:Hover { font-family: verdana,arial,serif; background-color : black; color: #ccff33; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
|
||||
A.SideNavBarHotItem { font-family: verdana,arial,serif; background-color : black; color: #ffcc66; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
|
||||
A.SideNavBarHotItem:Hover { font-family: verdana,arial,serif; background-color : black; color: #ccff33; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
|
||||
-->
|
||||
|
||||
</STYLE>
|
||||
|
||||
</HEAD>
|
||||
|
||||
<body background="img/sideback.jpg" bgcolor="#FFFFFF" text="black" class="Default">
|
||||
|
||||
<table border="0">
|
||||
|
||||
<tr>
|
||||
|
||||
<td valign=top>
|
||||
|
||||
<!-- Begin Side Bar -->
|
||||
|
||||
<table border="0" width="125" valign=top>
|
||||
|
||||
<tr>
|
||||
|
||||
<td><a href="http://nagios.manubulon.com/" class="SideNavBarItem" >Home</a></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td><BR>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td> </td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<!-- End Side Bar -->
|
||||
|
||||
</td>
|
||||
|
||||
<td valign=top>
|
||||
|
||||
<table border="0" valign=top>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="ProgramTitle"> Snmp load check</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
|
||||
<p class="NewsItemDate">Script : check_snmp_load.pl</p>
|
||||
|
||||
<p class="SectionTitle"> Last update : Sept 5 2006</p>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td valign="top">
|
||||
|
||||
<p class="SectionTitle">Description : </p>
|
||||
|
||||
<p class="SectionBody">Checks by snmp v1, v2c or v3 cpu or average
|
||||
|
||||
load. <br>
|
||||
|
||||
Works on Windows, Linux/Unix, AS400, Cisco, Cisco catalyst, HP Procurve, LinkProof,
|
||||
|
||||
Blucoat, Nokia, Fortinet, Netscreen.</p>
|
||||
|
||||
<p class="SectionBody">Check types are selected by the -T option :
|
||||
|
||||
</p>
|
||||
|
||||
<table border="1">
|
||||
<tr>
|
||||
<td class="SectionTitle">
|
||||
<div align="center">-T value</div>
|
||||
</td>
|
||||
<td class="SectionTitle">
|
||||
<div align="center">System </div>
|
||||
</td>
|
||||
<td class="SectionTitle">
|
||||
<div align="center">-w & -c values</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="SectionBody"><b>netsl</b></td>
|
||||
<td class="SectionBody">Linux : load provided by Net SNMP</td>
|
||||
<td class="SectionBody">3 values : load average on 1 min, 5 min,
|
||||
15 min (absolute)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="SectionBody"><b>netsc</b></td>
|
||||
<td class="SectionBody">Linux : CPU usage given by net-snmp</td>
|
||||
<td class="SectionBody">1 value in %</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="SectionBody"><b>as400</b></td>
|
||||
<td class="SectionBody">as400 CPU usage</td>
|
||||
<td class="SectionBody">1 value in %</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="SectionBody"><b>cisco</b></td>
|
||||
<td class="SectionBody">cisco CPU usage</td>
|
||||
<td class="SectionBody">3 values : CPU average on 5sec, 1 min
|
||||
& 5 min (%)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="SectionBody"><b>cata</b></td>
|
||||
<td class="SectionBody">cisco catalyst CPU usage</td>
|
||||
<td class="SectionBody">3 values : CPU average on 5sec, 1 min
|
||||
& 5 min (%)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="SectionBody"><b>nsc</b></td>
|
||||
<td class="SectionBody">Netscreen CPU usage</td>
|
||||
<td class="SectionBody">3 values : CPU average on 5sec, 1 min
|
||||
& 5 min (%)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="SectionBody"><b>fg</b></td>
|
||||
<td class="SectionBody">Fortigate CPU usage</td>
|
||||
<td class="SectionBody">1 value in %</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="SectionBody"><b>bc</b></td>
|
||||
<td class="SectionBody">bluecoat CPU usage</td>
|
||||
<td class="SectionBody">1 value in %</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="SectionBody"><b>nokia</b></td>
|
||||
<td class="SectionBody">nokia CPU usage</td>
|
||||
<td class="SectionBody">1 value in %</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="SectionBody"><b>hp</b></td>
|
||||
<td class="SectionBody">HP procurve switch CPU usage</td>
|
||||
<td class="SectionBody">1 value in %</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="SectionBody"><b>lp</b></td>
|
||||
<td class="SectionBody">Linkproof CPU usage</td>
|
||||
<td class="SectionBody">1 value in %</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="SectionBody"><b>hpux</b></td>
|
||||
<td class="SectionBody">HP-UX load</td>
|
||||
<td class="SectionBody">3 values : load average on 1 min, 5 min,
|
||||
15 min</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p class="SectionBody"> Vérifie par snmp v1,v2c ou v3 la charge
|
||||
|
||||
ou l'ocupation CPU.</p>
|
||||
|
||||
<p class="SectionBody"><span class="SectionTitle">SNMP Login</span><br>
|
||||
|
||||
</p>
|
||||
|
||||
<p class="SectionBody">See <a href="index_info.html">snmp info page</a></p>
|
||||
|
||||
<p class="SectionTitle">Requirements :</p>
|
||||
|
||||
<p class="SectionBody"> - Perl in /usr/bin/perl - or just run 'perl
|
||||
|
||||
script' <br>
|
||||
|
||||
- Net::SNMP<br>
|
||||
|
||||
- file 'utils.pm' in plugin diretory<br>
|
||||
|
||||
</p>
|
||||
|
||||
<p class="SectionBody"><a href="check_snmp_load.pl" class="SectionTitle">Dowload
|
||||
lastest version : 1.3.1</a> </p>
|
||||
|
||||
<p class="SectionBody"><a href="index_commands.html" class="SectionTitle">Configurations
|
||||
|
||||
examples</a></p>
|
||||
|
||||
<p class="SectionTitle"><span class="SectionTitle">Changelog</span>
|
||||
: On CVS repository on sourceforge : <a href="http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/">http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/</a>.</p>
|
||||
<p class="SectionTitle">Examples :</p>
|
||||
|
||||
<p class="SectionBody"><br>
|
||||
|
||||
All examples below are considering the script is local directory.
|
||||
|
||||
Host to be checked is 127.0.0.1 with snmp community "public".</p>
|
||||
|
||||
<p class="SectionBody">If multiple interfaces are selected, all must
|
||||
|
||||
be up to get an OK result</p>
|
||||
|
||||
<table border="1" cellspacing="5">
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="282">
|
||||
<p>Get help
|
||||
</td>
|
||||
<td class="SectionBody">
|
||||
<p>./check_snmp_load.pl <b>-h</b></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="282">
|
||||
<p>Check loads on linux with Net-SNMP : checks the 1, 5 and
|
||||
15 minutes load average.
|
||||
</td>
|
||||
<td class="SectionBody">
|
||||
<p>./check_snmp_load.pl -H 127.0.0.1 -C public <b>-w 3,3,2 -c
|
||||
4,4,3 -T netsl</b></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="282">
|
||||
<p>Check cpu load (generic) : checks the %used CPU for the last
|
||||
minute
|
||||
</td>
|
||||
<td class="SectionBody">
|
||||
<p>./check_snmp_load.pl -H 127.0.0.1 -C public <b>-w 98% -c
|
||||
99%</b></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="282">
|
||||
<p>Check cpu load on AS/400
|
||||
</td>
|
||||
<td class="SectionBody">
|
||||
<p>./check_snmp_load.pl -H 127.0.0.1 -C public <b>-w 98% -c
|
||||
99% -T as400</b></p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p class="NewsItemDate">Output of check_snmp_load.pl -h</p>
|
||||
|
||||
<table border="1" cellspacing="5">
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="SectionBody" valign = top>
|
||||
SNMP Load & CPU Monitor for Nagios version 1.3<br>
|
||||
(c)2004-2006 Patrick Proy
|
||||
<p>Usage: ./check_snmp_load.pl [-v] -H <host> -C <snmp_community>
|
||||
[-2] | (-l login -x passwd [-X pass -L <authp>,<privp>])
|
||||
[-p <port>] -w <warn level> -c <crit level>
|
||||
-T=[stand|netsl|netsc|as400|cisco|cata|nsc|fg|bc|nokia|hp|lp]
|
||||
[-f] [-t <timeout>] [-V]<br>
|
||||
-v, --verbose<br>
|
||||
print extra debugging information <br>
|
||||
-h, --help<br>
|
||||
print this help message<br>
|
||||
-H, --hostname=HOST<br>
|
||||
name or IP address of host to check<br>
|
||||
-C, --community=COMMUNITY NAME<br>
|
||||
community name for the host's SNMP agent (implies v1 protocol)<br>
|
||||
-2, --v2c<br>
|
||||
Use snmp v2c<br>
|
||||
-l, --login=LOGIN ; -x, --passwd=PASSWD<br>
|
||||
Login and auth password for snmpv3 authentication <br>
|
||||
If no priv password exists, implies AuthNoPriv <br>
|
||||
-X, --privpass=PASSWD<br>
|
||||
Priv password for snmpv3 (AuthPriv protocol)<br>
|
||||
-L, --protocols=<authproto>,<privproto><br>
|
||||
<authproto> : Authentication protocol (md5|sha : default
|
||||
md5)<br>
|
||||
<privproto> : Priv protocole (des|aes : default des)
|
||||
<br>
|
||||
-P, --port=PORT<br>
|
||||
SNMP port (Default 161)<br>
|
||||
-w, --warn=INTEGER | INT,INT,INT<br>
|
||||
1 value check : warning level for cpu in percent (on one minute)<br>
|
||||
3 value check : comma separated level for load or cpu for
|
||||
1min, 5min, 15min <br>
|
||||
-c, --crit=INTEGER | INT,INT,INT<br>
|
||||
critical level for cpu in percent (on one minute)<br>
|
||||
1 value check : critical level for cpu in percent (on one
|
||||
minute)<br>
|
||||
3 value check : comma separated level for load or cpu for
|
||||
1min, 5min, 15min <br>
|
||||
-T, --type=stand|netsl|netsc|as400|cisco|bc|nokia|hp|lp<br>
|
||||
CPU check : <br>
|
||||
stand : standard MIBII (works with Windows), <br>
|
||||
can handle multiple CPU.<br>
|
||||
netsl : linux load provided by Net SNMP<br>
|
||||
netsc : cpu usage given by net-snmp (100-idle)<br>
|
||||
as400 : as400 CPU usage<br>
|
||||
cisco : Cisco CPU usage<br>
|
||||
cata : Cisco catalyst CPU usage<br>
|
||||
nsc : NetScreen CPU usage<br>
|
||||
fg : Fortigate CPU usage<br>
|
||||
bc : Bluecoat CPU usage<br>
|
||||
nokia : Nokia CPU usage<br>
|
||||
hp : HP procurve switch CPU usage<br>
|
||||
lp : Linkproof CPU usage<br>
|
||||
-f, --perfparse<br>
|
||||
Perfparse compatible output<br>
|
||||
-t, --timeout=INTEGER<br>
|
||||
timeout for SNMP in seconds (Default: 5)<br>
|
||||
-V, --version<br>
|
||||
prints version number</p>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
|
||||
<p class="SectionBody">This project is hosted on : <br>
|
||||
|
||||
<A href="http://sourceforge.net/projects/nagios-snmp"> <IMG src="http://sourceforge.net/sflogo.php?group_id=134917&type=5" width="210" height="62" border="0" alt="SourceForge.net Logo" /></A>
|
||||
|
||||
</p>
|
||||
|
||||
<p class="SectionBody"> Nagios and the Nagios logo are registered
|
||||
|
||||
trademarks of Ethan Galstad.</p>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<p> </p>
|
||||
|
||||
</BODY>
|
||||
|
||||
</HTML>
|
||||
|
||||
|
||||
|
485
doc/snmp_mem.html
Executable file
485
doc/snmp_mem.html
Executable file
|
@ -0,0 +1,485 @@
|
|||
<HTML>
|
||||
|
||||
<HEAD>
|
||||
|
||||
<TITLE>Nagios plugins</TITLE>
|
||||
|
||||
<META NAME="Keywords" CONTENT="nagios,plugins,perl,snmp,proy">
|
||||
|
||||
<STYLE type="text/css">
|
||||
|
||||
<!--
|
||||
|
||||
.Default { font-family: verdana,arial,serif; font-size: 10pt; }
|
||||
|
||||
.ProgramTitle { font-family: verdana,arial,serif; font-size: 18pt; font-weight: bold;}
|
||||
|
||||
.Copyright { font-family: verdana,arial,serif; font-size: 10pt;}
|
||||
|
||||
.Email { font-family: verdana,arial,serif; font-size: 10pt;}
|
||||
|
||||
.NewsItem { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
|
||||
.NewsItemOdd { font-family: verdana,arial,serif; font-size: 8pt; background-color: #DBDBDB;}
|
||||
|
||||
.NewsItemEven { font-family: verdana,arial,serif; font-size: 8pt; background-color: #C4C2C2;}
|
||||
|
||||
.NewsItemUrgent { font-family: verdana,arial,serif; font-size: 8pt; background-color: #ccff99;}
|
||||
|
||||
.NewsItemDate { font-family: verdana,arial,serif; font-size: 8pt; font-weight: bold; }
|
||||
|
||||
.SectionTitle { font-family: verdana,arial,serif; font-size: 9pt; font-weight: bold; text-decoration: underline;}
|
||||
|
||||
.SectionBody { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
|
||||
.ModificationDate { font-family: verdana,arial,serif; font-size: 7pt; }
|
||||
|
||||
.Disclaimer { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
|
||||
A.SideNavBarItem { font-family: verdana,arial,serif; background-color : black; color: #e7e7e7; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
|
||||
A.SideNavBarItem:Hover { font-family: verdana,arial,serif; background-color : black; color: #ccff33; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
|
||||
A.SideNavBarHotItem { font-family: verdana,arial,serif; background-color : black; color: #ffcc66; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
|
||||
A.SideNavBarHotItem:Hover { font-family: verdana,arial,serif; background-color : black; color: #ccff33; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
|
||||
-->
|
||||
|
||||
</STYLE>
|
||||
|
||||
</HEAD>
|
||||
|
||||
<body background="img/sideback.jpg" bgcolor="#FFFFFF" text="black" class="Default">
|
||||
|
||||
<!-- background="img/sideback.jpg" -->
|
||||
|
||||
<table border="0">
|
||||
|
||||
<tr>
|
||||
|
||||
<td valign=top>
|
||||
|
||||
<!-- Begin Side Bar -->
|
||||
|
||||
<table border="0" width="125" valign=top>
|
||||
|
||||
<tr>
|
||||
|
||||
<td><a href="http://nagios.manubulon.com/" class="SideNavBarItem" >Home</a></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td><BR>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td> </td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<!-- End Side Bar -->
|
||||
|
||||
</td>
|
||||
|
||||
<td valign=top>
|
||||
|
||||
<table border="0" valign=top>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="ProgramTitle"> Snmp memory check</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
|
||||
<p class="NewsItemDate">Script : check_snmp_mem.pl</p>
|
||||
|
||||
<p class="SectionTitle"> Last update : Sept 4 2006</p>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td valign="top">
|
||||
|
||||
<p class="SectionTitle">Description : </p>
|
||||
|
||||
<p class="SectionBody">Checks by snmp v1, v2c or v3 :</p>
|
||||
|
||||
<p class="SectionBody">- Memory and swap usage on Linux given by Net-snmp.
|
||||
|
||||
<br>
|
||||
|
||||
It checks memory and swap usage independantly : one warning and
|
||||
|
||||
critical level for each of them.<br>
|
||||
|
||||
</p>
|
||||
|
||||
<p class="SectionBody">- Memory usage on cisco routers or Pix : the
|
||||
|
||||
plugin will add all of the memory pool and then checks the warning
|
||||
|
||||
and critical levels.<br>
|
||||
|
||||
On cisco routeurs, it will add 'IO' and 'Processor' memory<br>
|
||||
|
||||
On Pix, it will check the memory used (one memory pool only on Pix).<br>
|
||||
|
||||
</p>
|
||||
|
||||
<p class="SectionBody">- Memory usage on HP Procurve switch.<br>
|
||||
|
||||
Memory segments will be added then the free memory will be checked.<br>
|
||||
|
||||
</p>
|
||||
|
||||
<p class="SectionBody">Vérification de :<br>
|
||||
|
||||
- l'utilisation mémoire et swap sur Linux/Net-snmp<br>
|
||||
|
||||
- l'utilisation mémoire sur Cisco (routeurs et Pix).<br>
|
||||
|
||||
Pour d'autres SE (Windows, AS400), lire la suite.</p>
|
||||
|
||||
<p class="SectionTitle">Checking memory for other os :</p>
|
||||
|
||||
<p class="SectionBody"><b>AS/400 : </b>use the check_snmp_storage
|
||||
|
||||
command to check the RAM</p>
|
||||
|
||||
<p class="SectionBody">./check_snmp_storage.pl -H <b><IP></b>
|
||||
|
||||
-C <b><community></b> -m RAM -s -w <b><warn%></b> -c
|
||||
|
||||
<b><crit%></b></p>
|
||||
|
||||
<p class="SectionBody"><b>Windows : </b>use the check_snmp_storage
|
||||
|
||||
command to check the virtual memory (RAM+Swap)</p>
|
||||
|
||||
<p class="SectionBody">./check_snmp_storage.pl -H <b><IP></b>
|
||||
|
||||
-C <b><community></b> -m "^Virtual Memory$" -w <b><warn%></b>
|
||||
|
||||
-c <b><crit%></b></p>
|
||||
|
||||
<p class="SectionBody"><span class="SectionTitle">SNMP Login</span><br>
|
||||
|
||||
</p>
|
||||
|
||||
<p class="SectionBody">See <a href="index_info.html">snmp info page</a></p>
|
||||
|
||||
<p class="SectionTitle">Requirements :</p>
|
||||
|
||||
<p class="SectionBody"> - Perl in /usr/bin/perl - or just run 'perl
|
||||
|
||||
script' <br>
|
||||
|
||||
- Net::SNMP<br>
|
||||
|
||||
- file 'utils.pm' in plugin diretory (/usr/local/nagios/libexec)<br>
|
||||
|
||||
</p>
|
||||
|
||||
<p class="SectionBody"><a href="check_snmp_mem.pl" class="SectionTitle">Dowload
|
||||
|
||||
lastest version : 1.1</a> </p>
|
||||
|
||||
<p class="SectionBody"><a href="index_commands.html" class="SectionTitle">Configurations
|
||||
|
||||
examples</a></p>
|
||||
|
||||
<p class="NewsItemDate"><span class="SectionTitle">Changelog</span>
|
||||
: On CVS repository on sourceforge : <a href="http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/">http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/</a>.</p>
|
||||
|
||||
<p class="SectionTitle">Examples :</p>
|
||||
|
||||
<p class="SectionBody"><br>
|
||||
|
||||
All examples below are considering the script is local directory.
|
||||
|
||||
Host to be checked is 127.0.0.1 with snmp community "public".</p>
|
||||
|
||||
<table border="1" cellspacing="5">
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="NewsItemDate" valign = top width="154">
|
||||
|
||||
<p>Get help
|
||||
|
||||
</td>
|
||||
|
||||
<td class="SectionBody" width="420">
|
||||
|
||||
<p>./check_snmp_mem.pl <b>-h</b></p>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="NewsItemDate" valign = top width="154">Verbose output</td>
|
||||
|
||||
<td class="SectionBody" width="420">./check_snmp_mem.pl -H <IP>
|
||||
|
||||
-C <com> -w 80 -c 81 <b>-v</b></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="NewsItemDate" valign = top width="154">snmpv3 login</td>
|
||||
|
||||
<td class="SectionBody" width="420">./check_snmp_mem.pl -H 127.0.0.1
|
||||
|
||||
-l login -x passwd<b></b></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="NewsItemDate" valign = top width="154">
|
||||
|
||||
<p>
|
||||
|
||||
</td>
|
||||
|
||||
<td class="SectionBody" width="420">
|
||||
|
||||
<p class="NewsItemDate">Unix/Linux</p>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="NewsItemDate" valign = top width="154">
|
||||
|
||||
<p>%used of <br>
|
||||
|
||||
- RAM < 99% and 100%<br>
|
||||
|
||||
- Swap : < 20% and 30%
|
||||
|
||||
</td>
|
||||
|
||||
<td class="SectionBody" width="420">
|
||||
|
||||
<p>./check_snmp_mem.pl -H <IP> -C <com> <b> -w 99,20
|
||||
|
||||
-c 100,30</b></p>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="NewsItemDate" valign = top width="154">
|
||||
|
||||
<p>Same with no warning levels for memory
|
||||
|
||||
</td>
|
||||
|
||||
<td class="SectionBody" width="420">
|
||||
|
||||
<p>./check_snmp_mem.pl -H <IP> -C <com> -w <b>0</b>,20
|
||||
|
||||
-c 100,30</p>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="NewsItemDate" valign = top width="154">
|
||||
|
||||
<p>Check memory on Cisco
|
||||
|
||||
</td>
|
||||
|
||||
<td class="SectionBody" width="420">
|
||||
|
||||
<p>./check_snmp_mem.pl -H <IP> -C <com> <b>-I -w
|
||||
|
||||
90% -c 98%</b></p>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<p class="NewsItemDate">Output of check_snmp_mem.pl -h <</p>
|
||||
|
||||
<table border="1" cellspacing="5">
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="SectionBody" valign = top>
|
||||
|
||||
<p class="SectionBody">
|
||||
|
||||
<pre>
|
||||
|
||||
SNMP Memory Monitor for Nagios version 1.1
|
||||
|
||||
(c)2004-2006 - Patrick Proy
|
||||
|
||||
|
||||
|
||||
Usage: ./check_snmp_mem.pl [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>]) [-p <port>] -w <warn level> -c <crit level> [-I|-N|-E] [-f] [-m] [-t <timeout>] [-V]
|
||||
|
||||
-v, --verbose
|
||||
|
||||
print extra debugging information (including interface list on the system)
|
||||
|
||||
-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 or v2c with option)
|
||||
|
||||
-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=<authproto>,<privproto>
|
||||
|
||||
<authproto> : Authentication protocol (md5|sha : default md5)
|
||||
|
||||
<privproto> : Priv protocole (des|aes : default des)
|
||||
|
||||
-P, --port=PORT
|
||||
|
||||
SNMP port (Default 161)
|
||||
|
||||
-w, --warn=INTEGER | INT,INT
|
||||
|
||||
warning level for memory in percent (0 for no checks)
|
||||
|
||||
Default (-N switch) : comma separated level for Real Memory and Swap
|
||||
|
||||
-I switch : warning level
|
||||
|
||||
-c, --crit=INTEGER | INT,INT
|
||||
|
||||
critical level for memory in percent (0 for no checks)
|
||||
|
||||
Default (-N switch) : comma separated level for Real Memory and Swap
|
||||
|
||||
-I switch : critical level
|
||||
|
||||
-N, --netsnmp (default)
|
||||
|
||||
check linux memory & swap provided by Net SNMP
|
||||
|
||||
-m, --memcache
|
||||
|
||||
include cached memory in used memory (only with Net-SNMP)
|
||||
|
||||
-I, --cisco
|
||||
|
||||
check cisco memory (sum of all memory pools)
|
||||
|
||||
-E, --hp
|
||||
|
||||
check HP proccurve memory
|
||||
|
||||
-f, --perfdata
|
||||
|
||||
Performance data output
|
||||
|
||||
-t, --timeout=INTEGER
|
||||
|
||||
timeout for SNMP in seconds (Default: 5)
|
||||
|
||||
-V, --version
|
||||
|
||||
prints version number
|
||||
|
||||
</pre>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
|
||||
<p class="SectionBody">This project is hosted on : <br>
|
||||
|
||||
<A href="http://sourceforge.net/projects/nagios-snmp"> <IMG src="http://sourceforge.net/sflogo.php?group_id=134917&type=5" width="210" height="62" border="0" alt="SourceForge.net Logo" /></A>
|
||||
|
||||
</p>
|
||||
|
||||
<p class="SectionBody"> Nagios and the Nagios logo are registered
|
||||
|
||||
trademarks of Ethan Galstad.</p>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
</HTML>
|
||||
|
||||
|
||||
|
354
doc/snmp_process.html
Executable file
354
doc/snmp_process.html
Executable file
|
@ -0,0 +1,354 @@
|
|||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Nagios plugins</TITLE>
|
||||
<META NAME="Keywords" CONTENT="nagios,plugins,perl,snmp,proy">
|
||||
<STYLE type="text/css">
|
||||
<!--
|
||||
.Default { font-family: verdana,arial,serif; font-size: 10pt; }
|
||||
.ProgramTitle { font-family: verdana,arial,serif; font-size: 18pt; font-weight: bold;}
|
||||
.Copyright { font-family: verdana,arial,serif; font-size: 10pt;}
|
||||
.Email { font-family: verdana,arial,serif; font-size: 10pt;}
|
||||
.NewsItem { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
.NewsItemOdd { font-family: verdana,arial,serif; font-size: 8pt; background-color: #DBDBDB;}
|
||||
.NewsItemEven { font-family: verdana,arial,serif; font-size: 8pt; background-color: #C4C2C2;}
|
||||
.NewsItemUrgent { font-family: verdana,arial,serif; font-size: 8pt; background-color: #ccff99;}
|
||||
.NewsItemDate { font-family: verdana,arial,serif; font-size: 8pt; font-weight: bold; }
|
||||
.SectionTitle { font-family: verdana,arial,serif; font-size: 9pt; font-weight: bold; text-decoration: underline;}
|
||||
.SectionBody { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
.ModificationDate { font-family: verdana,arial,serif; font-size: 7pt; }
|
||||
.Disclaimer { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
A.SideNavBarItem { font-family: verdana,arial,serif; background-color : black; color: #e7e7e7; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
A.SideNavBarItem:Hover { font-family: verdana,arial,serif; background-color : black; color: #ccff33; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
A.SideNavBarHotItem { font-family: verdana,arial,serif; background-color : black; color: #ffcc66; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
A.SideNavBarHotItem:Hover { font-family: verdana,arial,serif; background-color : black; color: #ccff33; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
-->
|
||||
</STYLE>
|
||||
</HEAD>
|
||||
<body background="img/sideback.jpg" bgcolor="#FFFFFF" text="black" class="Default">
|
||||
<table border="0">
|
||||
<tr>
|
||||
<td valign=top>
|
||||
<!-- Begin Side Bar -->
|
||||
<table border="0" width="125" valign=top>
|
||||
<tr>
|
||||
<td><a href="http://nagios.manubulon.com/" class="SideNavBarItem" >Home</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><BR>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- End Side Bar -->
|
||||
</td>
|
||||
<td valign=top>
|
||||
<table border="0" valign=top>
|
||||
<tr>
|
||||
<td class="ProgramTitle"> Snmp process check</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p class="NewsItemDate">Script : check_snmp_process.pl</p>
|
||||
<p class="SectionTitle"> Last update : March 12 2007</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<p class="SectionTitle">Description : </p>
|
||||
<p class="SectionBody">Checks by snmp v1 or v3 if a process is running
|
||||
and how many instances are running (minimum & maximum). <br>
|
||||
It is also possible to check memory and cpu used by one or a group
|
||||
of process<br>
|
||||
<br>
|
||||
Works on Windows, Linux/Unix, AS400.</p>
|
||||
<p class="SectionBody"> Vérifie par snmp v1 ou v3 si un process tourne
|
||||
et combien d'instances de ce process tournent (minimum et maximum).<br>
|
||||
Il est également possible de vérifier la mémoire
|
||||
et le cpu utilisé.<br>
|
||||
<br>
|
||||
<span class="SectionTitle"> Standard checks<br>
|
||||
</span></p>
|
||||
<p class="SectionBody">The plugin checks if there is at least one
|
||||
process matching the filter (<b>-n </b>option) when no warning or
|
||||
critical levels are set. <br>
|
||||
The filter is treated as a regular expression by default, but you
|
||||
can deactivate this (<b>-r</b>)</p>
|
||||
<p class="SectionBody">You can use -w and -c options to set the warning
|
||||
and critical levels : <br>
|
||||
<b>-w <minW>,<maxW> </b>: with minW and maxW the minimum
|
||||
and maximum number of processes.<br>
|
||||
<br>
|
||||
<b>-c <minC>,<maxC></b> : same thing<br>
|
||||
Of course : <b>minC <= minW < maxW <=maxC</b><br>
|
||||
<i><br>
|
||||
You can omit <maxW> and <maxC></i><br>
|
||||
<br>
|
||||
Saying N is the current number of processes<br>
|
||||
- N < minC : critical<br>
|
||||
- minC < N <=minW : warning<br>
|
||||
- minW< N <= maxW : OK<br>
|
||||
- maxW< N <= maxC : warning<br>
|
||||
- maxC < N : critical<br>
|
||||
</p>
|
||||
<p class="SectionTitle">Memory checks </p>
|
||||
<p class="SectionBody">The <b>-m </b>option can check the memory used
|
||||
by the selected processes.<br>
|
||||
By default, this will select the process wich use the maximum memory.
|
||||
The <b>-a</b> switch will make an average<br>
|
||||
<br>
|
||||
Ex : <b>-m 7,20 </b>will send a warning if a process uses more than
|
||||
7 Mb, and critical for more than 20Mb.</p>
|
||||
<p class="SectionTitle">CPU checks</p>
|
||||
<p class="SectionBody">When you use the <b>-u </b>option, a temporary
|
||||
file will be created in "/tmp" by default : this can be
|
||||
changed at the beginning of the script. <br>
|
||||
The file name will be : tmp_Nagios_proc.<host IP>.<process
|
||||
filter>.</p>
|
||||
<p class="SectionBody">The -u option will add all the cpu used by
|
||||
all selected process and the make the check<br>
|
||||
</p>
|
||||
<p class="SectionBody"><b>-u 91,95</b> : will send a warning if more
|
||||
than 91% of cpu is used, and critical if more than 95% is used.</p>
|
||||
<p class="SectionBody">On multiprocessor hosts, the % of cpu use can
|
||||
be > 100% : on a 4 CPU host, cpu usage can go up to 400% (the
|
||||
script doesn't check if a host is multiprocessor or not).</p>
|
||||
<p class="SectionBody">The script curently wants a minimum of 5 minutes
|
||||
between values taken from host (can be changed at the beginning
|
||||
of the scripts). You can check more than once every 5 minutes but
|
||||
don't put check-interval to more than 15 minutes.<br>
|
||||
When the script doesn't have enough data to compute the CPU use
|
||||
(for example, the first time it is run), then it will return a UNKNOWN
|
||||
status. </p>
|
||||
<p class="SectionBody"><b>Msg size option </b>(<i>-o</i><b><i> </i></b>option)</p>
|
||||
<p class="SectionBody">In case you get a "ERROR: running table
|
||||
: Message size exceeded maxMsgSize" error, you may need to
|
||||
adjust the maxMsgSize, i.e. the maximum size of snmp message with
|
||||
the -o option. Try a value with the -o AND the -v option : the script
|
||||
will output the actual value so you can add some octets to it with
|
||||
the -o option.</p>
|
||||
<p class="SectionBody"><span class="SectionTitle">SNMP Login</span><br>
|
||||
</p>
|
||||
<p class="SectionBody">See <a href="index_info.html">snmp info page</a></p>
|
||||
<p class="SectionTitle">Requirements :</p>
|
||||
<p class="SectionBody"> - Perl in /usr/bin/perl - or just run 'perl
|
||||
script' <br>
|
||||
- Net::SNMP<br>
|
||||
- file 'utils.pm' in plugin diretory<br>
|
||||
</p>
|
||||
<p class="SectionBody"><a href="check_snmp_process.pl" class="SectionTitle">Dowload
|
||||
latest version : 1.4</a> </p>
|
||||
<p class="SectionBody"><a href="index_commands.html" class="SectionTitle">Configurations
|
||||
examples</a></p>
|
||||
<p class="SectionBody"><span class="SectionTitle">Changelog</span>
|
||||
: On CVS repository on sourceforge : <a href="http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/">http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/</a>.</p>
|
||||
<p class="SectionTitle">Examples :</p>
|
||||
<p class="SectionBody"><br>
|
||||
All examples below are considering the script is local directory.
|
||||
Host to be checked is 127.0.0.1 with snmp community "public".</p>
|
||||
<p class="SectionBody">If multiple interfaces are selected, all must
|
||||
be up to get an OK result</p>
|
||||
<table border="1" cellspacing="5" width="819">
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="261">
|
||||
<p>Get help
|
||||
</td>
|
||||
<td class="SectionBody" width="533">
|
||||
<p>./check_snmp_process.pl <b>-h</b></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="261">snmpv3 login</td>
|
||||
<td class="SectionBody" width="533">./check_snmp_process.pl -H
|
||||
127.0.0.1 -l login -x passwd<b></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="261">
|
||||
<p>Check if at least one process matching http is running
|
||||
</td>
|
||||
<td class="SectionBody" width="533">
|
||||
<p>./check_snmp_process.pl -H 127.0.0.1 -C public <b>-n http</b></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="261">
|
||||
<p align="right">Result example :
|
||||
</td>
|
||||
<td class="SectionBody" width="533">
|
||||
<p>3 process matching http : > 0 : OK</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="261">
|
||||
<p>Check if at least 3 process matching http are running
|
||||
</td>
|
||||
<td class="SectionBody" width="533">
|
||||
<p>./check_snmp_process.pl -H 127.0.0.1 -C public -n http<b>
|
||||
-w 2 -c 0</b></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="261">
|
||||
<div align="right">Result example : <br>
|
||||
(<=2 will return warning, 0 critical)</div>
|
||||
</td>
|
||||
<td class="SectionBody" width="533">3 process matching httpd :
|
||||
> 2 : OK</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="261">Check if at
|
||||
least one process named "httpd" exists (no regexp)</td>
|
||||
<td class="SectionBody" width="533">./check_snmp_process.pl -H
|
||||
127.0.0.1 -C public -n http <b>-r</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="261">
|
||||
<p align="right">Result example : </p>
|
||||
</td>
|
||||
<td class="SectionBody" width="533">3 process <b>named</b> httpd
|
||||
: > 0 : OK</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="261">Check process
|
||||
by their full path : check process of /opt/soft/bin/ (at least
|
||||
one) </td>
|
||||
<td class="SectionBody" width="533">./check_snmp_process.pl -H
|
||||
127.0.0.1 -C public <b>-n /opt/soft/bin/ -f</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="261">Check that at
|
||||
least 3 process but not more than 8 are running</td>
|
||||
<td class="SectionBody" width="533">./check_snmp_process.pl -H
|
||||
127.0.0.1 -C public -n http <b>-w 3,8 -c 0,15</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="261">Same checks
|
||||
+ checks maximum memory used by process (in Mb) : warning and
|
||||
critical levels</td>
|
||||
<td class="SectionBody" width="533">./check_snmp_process.pl -H
|
||||
127.0.0.1 -C public -n http -w 3,8 -c 0,15 <b>-m 9,25</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="261">Same check but
|
||||
sum all CPU used by all selected process</td>
|
||||
<td class="SectionBody" width="533">./check_snmp_process.pl -H
|
||||
127.0.0.1 -C public -n http -w 3,8 -c 0,15 -m 9,25 <b>-u 70,99</b></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p class="NewsItemDate">Output of check_snmp_process.pl -h</p>
|
||||
<table border="1" cellspacing="5">
|
||||
<tr>
|
||||
<td class="SectionBody" valign = top>
|
||||
<p>SNMP Process Monitor for Nagios version 1.4<br>
|
||||
GPL licence, (c)2004-2006 Patrick Proy</p>
|
||||
<p>Usage: ./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%>
|
||||
] [-t <timeout>] [-o <octet_length>] [-f ] [-r]
|
||||
[-V] [-g]<br>
|
||||
-v, --verbose<br>
|
||||
print extra debugging information (and lists all storages)<br>
|
||||
-h, --help<br>
|
||||
print this help message<br>
|
||||
-H, --hostname=HOST<br>
|
||||
name or IP address of host to check<br>
|
||||
-C, --community=COMMUNITY NAME<br>
|
||||
community name for the host's SNMP agent (implies SNMP v1
|
||||
or v2c with option)<br>
|
||||
-l, --login=LOGIN ; -x, --passwd=PASSWD, -2, --v2c<br>
|
||||
Login and auth password for snmpv3 authentication <br>
|
||||
If no priv password exists, implies AuthNoPriv <br>
|
||||
-2 : use snmp v2c<br>
|
||||
-X, --privpass=PASSWD<br>
|
||||
Priv password for snmpv3 (AuthPriv protocol)<br>
|
||||
-L, --protocols=<authproto>,<privproto><br>
|
||||
<authproto> : Authentication protocol (md5|sha : default
|
||||
md5)<br>
|
||||
<privproto> : Priv protocole (des|aes : default des)
|
||||
<br>
|
||||
-p, --port=PORT<br>
|
||||
SNMP port (Default 161)<br>
|
||||
-n, --name=NAME<br>
|
||||
Name of the process (regexp)<br>
|
||||
No trailing slash !<br>
|
||||
-r, --noregexp<br>
|
||||
Do not use regexp to match NAME in description OID<br>
|
||||
-f, --fullpath<br>
|
||||
Use full path name instead of process name <br>
|
||||
(Windows doesn't provide full path name)<br>
|
||||
-w, --warn=MIN[,MAX]<br>
|
||||
Number of process that will cause a warning <br>
|
||||
-1 for no warning, MAX must be >0. Ex : -w-1,50<br>
|
||||
-c, --critical=MIN[,MAX]<br>
|
||||
number of process that will cause an error (<br>
|
||||
-1 for no critical, MAX must be >0. Ex : -c-1,50<br>
|
||||
Notes on warning and critical : <br>
|
||||
with the following options : -w m1,x1 -c m2,x2<br>
|
||||
you must have : m2 <= m1 < x1 <= x2<br>
|
||||
you can omit x1 or x2 or both<br>
|
||||
-m, --memory=WARN,CRIT<br>
|
||||
checks memory usage (default max of all process)<br>
|
||||
values are warning and critical values in Mb<br>
|
||||
-a, --average<br>
|
||||
makes an average of memory used by process instead of max<br>
|
||||
-u, --cpu=WARN,CRIT<br>
|
||||
checks cpu usage of all process<br>
|
||||
values are warning and critical values in % of CPU usage<br>
|
||||
if more than one CPU, value can be > 100% : 100%=1 CPU<br>
|
||||
-g, --getall<br>
|
||||
In some cases, it is necessary to get all data at once because<br>
|
||||
process die very frequently.<br>
|
||||
This option eats bandwidth an cpu (for remote host) at breakfast.<br>
|
||||
-o, --octetlength=INTEGER<br>
|
||||
max-size of the SNMP message, usefull in case of Too Long
|
||||
responses.<br>
|
||||
Be carefull with network filters. Range 484 - 65535, default
|
||||
are<br>
|
||||
usually 1472,1452,1460 or 1440. <br>
|
||||
-t, --timeout=INTEGER<br>
|
||||
timeout for SNMP in seconds (Default: 5)<br>
|
||||
-V, --version<br>
|
||||
prints version number<br>
|
||||
Note : <br>
|
||||
CPU usage is in % of one cpu, so maximum can be 100% * number
|
||||
of CPU <br>
|
||||
example : <br>
|
||||
Browse process list : <script> -C <community>
|
||||
-H <host> -n <anything> -v <br>
|
||||
the -n option allows regexp in perl format : <br>
|
||||
All process of /opt/soft/bin : -n /opt/soft/bin/ -f<br>
|
||||
All 'named' process : -n named<br>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p class="SectionBody">This project is hosted on : <br>
|
||||
<A href="http://sourceforge.net/projects/nagios-snmp"> <IMG src="http://sourceforge.net/sflogo.php?group_id=134917&type=5" width="210" height="62" border="0" alt="SourceForge.net Logo" /></A>
|
||||
</p>
|
||||
<p class="SectionBody"> Nagios and the Nagios logo are registered
|
||||
trademarks of Ethan Galstad.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p> </p>
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
1343
doc/snmp_storage.html
Executable file
1343
doc/snmp_storage.html
Executable file
File diff suppressed because it is too large
Load diff
358
doc/snmp_vrrp.html
Executable file
358
doc/snmp_vrrp.html
Executable file
|
@ -0,0 +1,358 @@
|
|||
<HTML>
|
||||
|
||||
<HEAD>
|
||||
|
||||
<TITLE>Nagios plugins</TITLE>
|
||||
|
||||
<META NAME="Keywords" CONTENT="nagios,plugins,perl,snmp,proy">
|
||||
|
||||
<STYLE type="text/css">
|
||||
|
||||
<!--
|
||||
|
||||
.Default { font-family: verdana,arial,serif; font-size: 10pt; }
|
||||
|
||||
.ProgramTitle { font-family: verdana,arial,serif; font-size: 18pt; font-weight: bold;}
|
||||
|
||||
.Copyright { font-family: verdana,arial,serif; font-size: 10pt;}
|
||||
|
||||
.Email { font-family: verdana,arial,serif; font-size: 10pt;}
|
||||
|
||||
.NewsItem { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
|
||||
.NewsItemOdd { font-family: verdana,arial,serif; font-size: 8pt; background-color: #DBDBDB;}
|
||||
|
||||
.NewsItemEven { font-family: verdana,arial,serif; font-size: 8pt; background-color: #C4C2C2;}
|
||||
|
||||
.NewsItemUrgent { font-family: verdana,arial,serif; font-size: 8pt; background-color: #ccff99;}
|
||||
|
||||
.NewsItemDate { font-family: verdana,arial,serif; font-size: 8pt; font-weight: bold; }
|
||||
|
||||
.SectionTitle { font-family: verdana,arial,serif; font-size: 9pt; font-weight: bold; text-decoration: underline;}
|
||||
|
||||
.SectionBody { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
|
||||
.ModificationDate { font-family: verdana,arial,serif; font-size: 7pt; }
|
||||
|
||||
.Disclaimer { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
|
||||
A.SideNavBarItem { font-family: verdana,arial,serif; background-color : black; color: #e7e7e7; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
|
||||
A.SideNavBarItem:Hover { font-family: verdana,arial,serif; background-color : black; color: #ccff33; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
|
||||
A.SideNavBarHotItem { font-family: verdana,arial,serif; background-color : black; color: #ffcc66; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
|
||||
A.SideNavBarHotItem:Hover { font-family: verdana,arial,serif; background-color : black; color: #ccff33; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
|
||||
-->
|
||||
|
||||
</STYLE>
|
||||
|
||||
</HEAD>
|
||||
|
||||
<body background="img/sideback.jpg" bgcolor="#FFFFFF" text="black" class="Default">
|
||||
|
||||
<table border="0">
|
||||
|
||||
<tr>
|
||||
|
||||
<td valign=top>
|
||||
|
||||
<!-- Begin Side Bar -->
|
||||
|
||||
<table border="0" width="125" valign=top>
|
||||
|
||||
<tr>
|
||||
|
||||
<td><a href="http://nagios.manubulon.com/" class="SideNavBarItem" >Home</a></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td><BR>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td> </td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<!-- End Side Bar -->
|
||||
|
||||
</td>
|
||||
|
||||
<td valign=top>
|
||||
|
||||
<table border="0" valign=top>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="ProgramTitle"> Snmp vrrp check</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
|
||||
<p class="NewsItemDate">Script : check_snmp_vrrp.pl</p>
|
||||
|
||||
<p class="SectionTitle"> Last update : Sept 4 2006</p>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td valign="top">
|
||||
|
||||
<p class="SectionTitle">Description : </p>
|
||||
|
||||
<p class="SectionBody">Checks by snmp v1, v2c or v3 the vrrp status
|
||||
of all vrrp enabled interfaces. <br>
|
||||
Works on<br>
|
||||
- Nokia IP with ipso 3.X , 4.X in VRRP mode.<br>
|
||||
- Nokia IP with ipso 3.X , 4.X in clustering mode.<br>
|
||||
- Radware Linkproof<br>
|
||||
- Alteon AD4 Loadbalancers</p>
|
||||
<p class="SectionBody">Depending on the state you put as option ("master"
|
||||
or "backup") the script will get all the vrrp enables
|
||||
interface and check they are in this state. <br>
|
||||
If not, it will retrun a critical status<br>
|
||||
By default, it will check Nokia IP platforms using vrrp, you can
|
||||
test other platforms with the '-T' option :<br>
|
||||
<br>
|
||||
- Alteon<br>
|
||||
- Linkproof (VRRP)<br>
|
||||
- Nokia clustering.</p>
|
||||
<p class="SectionTitle">Nokia clustering check</p>
|
||||
<p class="SectionBody">Nokia clustering check does not have a master
|
||||
& backup state. Instead, the plugin will check : </p>
|
||||
<p class="SectionBody">- The number of cluster member<br>
|
||||
- The % load on each cluster.</p>
|
||||
<p class="SectionBody">For example <b>-s 2,90</b> will issue <br>
|
||||
- A critical level if there is not 2 members.<br>
|
||||
- A warning level if more than 90% is assigned to one cluster member.</p>
|
||||
<p class="SectionBody">To have a long output, put the '-g' option.</p>
|
||||
|
||||
<p class="SectionBody"><span class="SectionTitle">SNMP Login</span><br>
|
||||
</p>
|
||||
<p class="SectionBody">See <a href="index_info.html">snmp info page</a></p>
|
||||
<p class="SectionBody"><span class="SectionTitle">French </span>:
|
||||
Vérifie par snmp v1 ou v3 l'état des interfaces vrrp : Nokia,
|
||||
Linkproof, Altéon ou l'état d'un cluster Nokia.</p>
|
||||
|
||||
<p class="SectionTitle">Requirements :</p>
|
||||
|
||||
<p class="SectionBody"> - Perl in /usr/bin/perl - or just run 'perl
|
||||
|
||||
script' <br>
|
||||
|
||||
- Net::SNMP<br>
|
||||
|
||||
- file 'utils.pm' in plugin diretory<br>
|
||||
|
||||
</p>
|
||||
|
||||
<p class="SectionBody"><a href="check_snmp_vrrp.pl" class="SectionTitle">Dowload
|
||||
lastest version : 1.3</a> </p>
|
||||
|
||||
<p class="SectionBody"><a href="index_commands.html" class="SectionTitle">Configurations
|
||||
|
||||
examples</a></p>
|
||||
|
||||
<p class="SectionTitle">Examples :</p>
|
||||
|
||||
<p class="SectionBody"><br>
|
||||
|
||||
All examples below are considering the script is local directory.
|
||||
|
||||
Host to be checked is 127.0.0.1 with snmp community "public".</p>
|
||||
|
||||
<p class="SectionBody">If multiple interfaces are selected, all must
|
||||
|
||||
be up to get an OK result</p>
|
||||
|
||||
<table border="1" cellspacing="5">
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="282">
|
||||
<p>Get help
|
||||
</td>
|
||||
<td class="SectionBody" width="387">
|
||||
<p>./check_snmp_vrrp.pl <b>-h</b></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="282">snmpv3 login</td>
|
||||
<td class="SectionBody" width="387">./check_snmp_vrrp.pl -H 127.0.0.1
|
||||
-l login -x passwd<b></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="282">
|
||||
<p>Check vrrp state of a node to be master.
|
||||
</td>
|
||||
<td class="SectionBody" width="387">
|
||||
<p>./check_snmp_vrrp.pl -H 127.0.0.1 -C public <b>-s master</b></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="282">
|
||||
<div align="right">
|
||||
<p>Output example :<br>
|
||||
The ouput is : <vrid>(<state>,<status>,<priority>)
|
||||
</p>
|
||||
</div>
|
||||
</td>
|
||||
<td class="SectionBody" width="387">Vrid : 10(master/up/100),
|
||||
1(master/up/100), 3(master/up/100), 2(master/up/100), : All
|
||||
master :OK</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="282">Check vrrp state
|
||||
of a node to be backup. </td>
|
||||
<td class="SectionBody" width="387">./check_snmp_vrrp.pl -H 127.0.0.1
|
||||
-C public <b>-s backup</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="282">
|
||||
<p align="right">Output example :
|
||||
</td>
|
||||
<td class="SectionBody" width="387">
|
||||
<p>Vrid : 1(backup/up/95), 3(backup/up/95), 10(backup/up/95),
|
||||
2(backup/up/95), : All backup :OK</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="282">Test a Linkproof</td>
|
||||
<td class="SectionBody" width="387">./check_snmp_vrrp.pl -H 127.0.0.1
|
||||
-C public -s master <b>-T lp</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="282">Test a Nokia
|
||||
cluster : 2 cluster members and max 90% load assigned to one
|
||||
cluster. </td>
|
||||
<td class="SectionBody" width="387">./check_snmp_vrrp.pl -H 127.0.0.1
|
||||
-C public <b>-s 2,90%-T ipso</b></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p class="NewsItemDate"><span class="SectionTitle">Changelog</span>
|
||||
: On CVS repository on sourceforge : <a href="http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/">http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/</a>.</p>
|
||||
|
||||
<p class="NewsItemDate">Output of check_snmp_vrrp.pl -h</p>
|
||||
|
||||
<table border="1" cellspacing="5">
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="SectionBody" valign = top>
|
||||
<p class="SectionBody">SNMP VRRP Monitor for Nagios version
|
||||
1.3<br>
|
||||
(c)2004-2006 to my cat Ratoune - Author : Patrick Proy
|
||||
<p>Usage: ./check_snmp_vrrp.pl [-v] -H <host> -C <snmp_community>
|
||||
[-2] | (-l login -x passwd [-X pass -L <authp>,<privp>])
|
||||
-s <master|backup|num,%> [-T <nokia|alteon|lp|nsc|ipsocluster>]
|
||||
[-p <port>] [-t <timeout>] [-V]<br>
|
||||
-v, --verbose<br>
|
||||
print extra debugging information (including interface list
|
||||
on the system)<br>
|
||||
-h, --help<br>
|
||||
print this help message<br>
|
||||
-H, --hostname=HOST<br>
|
||||
name or IP address of host to check<br>
|
||||
-C, --community=COMMUNITY NAME<br>
|
||||
community name for the host's SNMP agent (implies v1 protocol)<br>
|
||||
-2, --v2c<br>
|
||||
Use snmp v2c<br>
|
||||
-l, --login=LOGIN ; -x, --passwd=PASSWD<br>
|
||||
Login and auth password for snmpv3 authentication <br>
|
||||
If no priv password exists, implies AuthNoPriv <br>
|
||||
-X, --privpass=PASSWD<br>
|
||||
Priv password for snmpv3 (AuthPriv protocol)<br>
|
||||
-L, --protocols=<authproto>,<privproto><br>
|
||||
<authproto> : Authentication protocol (md5|sha : default
|
||||
md5)<br>
|
||||
<privproto> : Priv protocole (des|aes : default des)
|
||||
<br>
|
||||
-P, --port=PORT<br>
|
||||
SNMP port (Default 161)<br>
|
||||
-T, --type=<nokia|alteon|lp|nsc|ipso><br>
|
||||
Type of vrrp router to check<br>
|
||||
nokia (default) : Nokai vrrp. Should be working for most vrrp
|
||||
routers<br>
|
||||
alteon : for Alteon AD4 Loadbalancers<br>
|
||||
lp : Radware Linkproof<br>
|
||||
nsc : Nescreen (ScreenOS 5.x NSRP)<br>
|
||||
ipso : Nokia IPSO clustering<br>
|
||||
-s, --state=master|backup|num,%<br>
|
||||
Nokia ipso clustering : number of members, max % assigned
|
||||
to nodes.<br>
|
||||
Other : check vrrp interface to be master or backup<br>
|
||||
-g, --long<br>
|
||||
Make output long even is all is OK <br>
|
||||
-t, --timeout=INTEGER<br>
|
||||
timeout for SNMP in seconds (Default: 5)<br>
|
||||
-V, --version<br>
|
||||
prints version number</p>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
|
||||
<p class="SectionBody">This project is hosted on : <br>
|
||||
|
||||
<A href="http://sourceforge.net/projects/nagios-snmp"> <IMG src="http://sourceforge.net/sflogo.php?group_id=134917&type=5" width="210" height="62" border="0" alt="SourceForge.net Logo" /></A>
|
||||
|
||||
</p>
|
||||
|
||||
<p class="SectionBody"> Nagios and the Nagios logo are registered
|
||||
|
||||
trademarks of Ethan Galstad.</p>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<p> </p>
|
||||
|
||||
</BODY>
|
||||
|
||||
</HTML>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
261
doc/snmp_windows.html
Executable file
261
doc/snmp_windows.html
Executable file
|
@ -0,0 +1,261 @@
|
|||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Nagios plugins</TITLE>
|
||||
<META NAME="Keywords" CONTENT="nagios,plugins,perl,snmp,proy">
|
||||
<STYLE type="text/css">
|
||||
<!--
|
||||
.Default { font-family: verdana,arial,serif; font-size: 10pt; }
|
||||
.ProgramTitle { font-family: verdana,arial,serif; font-size: 18pt; font-weight: bold;}
|
||||
.Copyright { font-family: verdana,arial,serif; font-size: 10pt;}
|
||||
.Email { font-family: verdana,arial,serif; font-size: 10pt;}
|
||||
.NewsItem { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
.NewsItemOdd { font-family: verdana,arial,serif; font-size: 8pt; background-color: #DBDBDB;}
|
||||
.NewsItemEven { font-family: verdana,arial,serif; font-size: 8pt; background-color: #C4C2C2;}
|
||||
.NewsItemUrgent { font-family: verdana,arial,serif; font-size: 8pt; background-color: #ccff99;}
|
||||
.NewsItemDate { font-family: verdana,arial,serif; font-size: 8pt; font-weight: bold; }
|
||||
.SectionTitle { font-family: verdana,arial,serif; font-size: 9pt; font-weight: bold; text-decoration: underline;}
|
||||
.SectionBody { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
.ModificationDate { font-family: verdana,arial,serif; font-size: 7pt; }
|
||||
.Disclaimer { font-family: verdana,arial,serif; font-size: 8pt; }
|
||||
A.SideNavBarItem { font-family: verdana,arial,serif; background-color : black; color: #e7e7e7; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
A.SideNavBarItem:Hover { font-family: verdana,arial,serif; background-color : black; color: #ccff33; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
A.SideNavBarHotItem { font-family: verdana,arial,serif; background-color : black; color: #ffcc66; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
A.SideNavBarHotItem:Hover { font-family: verdana,arial,serif; background-color : black; color: #ccff33; font-size: 9pt; font-weight: bold; text-decoration: none; }
|
||||
-->
|
||||
</STYLE>
|
||||
</HEAD>
|
||||
<body background="img/sideback.jpg" bgcolor="#FFFFFF" text="black" class="Default">
|
||||
<table border="0">
|
||||
<tr>
|
||||
<td valign=top>
|
||||
<!-- Begin Side Bar -->
|
||||
<table border="0" width="125" valign=top>
|
||||
<tr>
|
||||
<td><a href="http://nagios.manubulon.com/" class="SideNavBarItem" >Home</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><BR>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- End Side Bar -->
|
||||
</td>
|
||||
<td valign=top>
|
||||
<table border="0" valign=top>
|
||||
<tr>
|
||||
<td class="ProgramTitle"> Snmp windows check</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p class="NewsItemDate">Script : check_snmp_win.pl</p>
|
||||
<p class="SectionTitle"> Last update : Jan 11 2007</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<p class="SectionTitle">Description : </p>
|
||||
<p class="SectionBody">Checks by snmp v1 or v3 windows specific health
|
||||
monitoring (service state for now).<br>
|
||||
<br>
|
||||
Works on Windows server (2000, 2003) maybe XP and NT.</p>
|
||||
<p class="SectionBody"> Vérifie par snmp v1 ou v3 si un(des) service
|
||||
Windows tournent.<br>
|
||||
<br>
|
||||
<span class="SectionTitle"> Service checks <br>
|
||||
</span></p>
|
||||
<p class="SectionBody">The plugin checks if there if the Windows service(s)
|
||||
he gets as input are running. <br>
|
||||
You can provide multiple services, comma separated : <br>
|
||||
<b>-n <service1>,<service2></b> </p>
|
||||
<p class="SectionBody">The script will return : <br>
|
||||
OK : if <service1> is found (and active) and <service2>
|
||||
is found (and active). <br>
|
||||
WARNING : if <service1> and <service2> match <b>more</b>
|
||||
than 2 active services.<br>
|
||||
CRITICAL : if <service1> OR <service2> don't match any
|
||||
active service. </p>
|
||||
<p class="SectionBody"><b>-N <number> </b>: will return OK if
|
||||
<number> of active services matches the filter</p>
|
||||
<p class="SectionBody"><b>-s </b>: will show all active services instead
|
||||
of the non active ones only</p>
|
||||
<p class="SectionTitle">Requirements :</p>
|
||||
<p class="SectionBody"> - Perl in /usr/bin/perl - or just run 'perl
|
||||
script' <br>
|
||||
- Net::SNMP<br>
|
||||
- file 'utils.pm' in plugin diretory<br>
|
||||
</p>
|
||||
<p class="SectionBody"><a href="check_snmp_win.pl" class="SectionTitle">Dowload
|
||||
latest version : 0.6</a> </p>
|
||||
<p class="SectionBody"><a href="index_commands.html" class="SectionTitle">Configurations
|
||||
examples</a></p>
|
||||
<p class="SectionTitle">Examples :</p>
|
||||
<p class="SectionBody"><br>
|
||||
All examples below are considering the script is local directory.
|
||||
Host to be checked is 127.0.0.1 with snmp community "public".</p>
|
||||
<p class="SectionBody">If multiple interfaces are selected, all must
|
||||
be up to get an OK result</p>
|
||||
<table border="1" cellspacing="5" width="819">
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="262">
|
||||
<p>Get help
|
||||
</td>
|
||||
<td class="SectionBody" width="532">
|
||||
<p>./check_snmp_win.pl <b>-h</b></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="262">snmpv3 login</td>
|
||||
<td class="SectionBody" width="532">./check_snmp_win.pl -H 127.0.0.1
|
||||
-l login -x passwd<b></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="262">
|
||||
<p>Check if at least one process matching dns is running
|
||||
</td>
|
||||
<td class="SectionBody" width="532">
|
||||
<p>./check_snmp_win.pl -H 127.0.0.1 -C public <b>-n dns</b></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="262">
|
||||
<p align="right">Result example :
|
||||
</td>
|
||||
<td class="SectionBody" width="532">
|
||||
<p>1 services active (matching "dns") : OK</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="262">
|
||||
<p>Check if at least 3 process matching dns are running
|
||||
</td>
|
||||
<td class="SectionBody" width="532">
|
||||
<p>./check_snmp_win.pl -H 127.0.0.1 -C public -n http<b> -N
|
||||
2 </b></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="262">
|
||||
<div align="right">Result example : <br>
|
||||
(<=2 will return warning, 0 critical)</div>
|
||||
</td>
|
||||
<td class="SectionBody" width="532">1 services active (matching
|
||||
"dns") : CRITICAL</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="262">Check if dns
|
||||
and ssh services are running</td>
|
||||
<td class="SectionBody" width="532">./check_snmp_win.pl -H 127.0.0.1
|
||||
-C public -n dns,ssh</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="262">
|
||||
<p align="right">Result example : </p>
|
||||
</td>
|
||||
<td class="SectionBody" width="532">"dns" active, "ssh"
|
||||
active : OK</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="262">Check if dns
|
||||
and toto services are running</td>
|
||||
<td class="SectionBody" width="532">./check_snmp_win.pl -H 127.0.0.1
|
||||
-C public <b>-n dns,toto</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="NewsItemDate" valign = top width="262">
|
||||
<div align="right">Result example : </div>
|
||||
</td>
|
||||
<td class="SectionBody" width="532">"toto" not active
|
||||
: CRITICAL</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p> </p>
|
||||
<p class="NewsItemDate"><span class="SectionTitle">Changelog</span>
|
||||
: On CVS repository on sourceforge : <a href="http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/">http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/</a>.<br>
|
||||
</p>
|
||||
<p class="NewsItemDate">Output of check_snmp_win.pl -h</p>
|
||||
<table border="1" cellspacing="5">
|
||||
<tr>
|
||||
<td class="SectionBody" valign = top>
|
||||
<p>SNMP Windows Monitor for Nagios version 0.6<br>
|
||||
GPL licence, (c)2004-2005 Patrick Proy</p>
|
||||
<p>Usage: check_snmp_win [-v] -H <host> -C <snmp_community>
|
||||
[-2] | (-l login -x passwd) [-p <port>] -n <name>[,<name2]
|
||||
[-T=service] [-r] [-s] [-N=<n>] [-t <timeout>]
|
||||
[-V]<br>
|
||||
-v, --verbose<br>
|
||||
print extra debugging information (and lists all services)<br>
|
||||
-h, --help<br>
|
||||
print this help message<br>
|
||||
-H, --hostname=HOST<br>
|
||||
name or IP address of host to check<br>
|
||||
-C, --community=COMMUNITY NAME<br>
|
||||
community name for the host's SNMP agent (implies SNMP v1
|
||||
or v2c with option)<br>
|
||||
-2, --v2c<br>
|
||||
Use snmp v2c<br>
|
||||
-l, --login=LOGIN<br>
|
||||
Login for snmpv3 authentication (implies v3 protocol with
|
||||
MD5)<br>
|
||||
-x, --passwd=PASSWD<br>
|
||||
Password for snmpv3 authentication<br>
|
||||
-p, --port=PORT<br>
|
||||
SNMP port (Default 161)<br>
|
||||
-T, --type=service<br>
|
||||
Check type : <br>
|
||||
- service (default) checks service<br>
|
||||
-n, --name=NAME[,NAME2...]<br>
|
||||
Comma separated names of services (perl regular expressions
|
||||
can be used for every one).<br>
|
||||
By default, it is not case sensitive.<br>
|
||||
-N, --number=<n><br>
|
||||
Compare matching services with <n> instead of the number
|
||||
of names provided.<br>
|
||||
-s, --showall<br>
|
||||
Show all services in the output, instead of only the non-active
|
||||
ones.<br>
|
||||
-r, --noregexp<br>
|
||||
Do not use regexp to match NAME in service description.<br>
|
||||
-t, --timeout=INTEGER<br>
|
||||
timeout for SNMP in seconds (Default: 5)<br>
|
||||
-V, --version<br>
|
||||
prints version number<br>
|
||||
Note : <br>
|
||||
The script will return <br>
|
||||
OK if ALL services are in active state,<br>
|
||||
WARNING if there is more than specified (ex 2 service specified,
|
||||
3 active services matching), <br>
|
||||
CRITICAL if at least one of them is non active.<br>
|
||||
The -n option will allows regexp in perl format <br>
|
||||
-n "service" will match 'service WINS' 'sevice DNS'
|
||||
etc...<br>
|
||||
It is not case sensitive by default : WINS = wins</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p class="SectionBody">This project is hosted on : <br>
|
||||
<A href="http://sourceforge.net/projects/nagios-snmp"> <IMG src="http://sourceforge.net/sflogo.php?group_id=134917&type=5" width="210" height="62" border="0" alt="SourceForge.net Logo" /></A>
|
||||
</p>
|
||||
<p class="SectionBody"> Nagios and the Nagios logo are registered
|
||||
trademarks of Ethan Galstad.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p> </p>
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
|
||||
|
429
install.sh
429
install.sh
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
############################## check_snmp_storage ##############
|
||||
# Version : 1.2
|
||||
# Date : Jan 11 2007
|
||||
############################## install.sh #####################
|
||||
# Version : 1.4
|
||||
# Date : Jan 13 2007
|
||||
# Author : Patrick Proy ( nagios at proy.org)
|
||||
# Help : http://www.manubulon.com/nagios/
|
||||
# Licence : GPL - http://www.fsf.org/licenses/gpl.txt
|
||||
|
@ -9,7 +9,7 @@
|
|||
# Contribs :
|
||||
#################################################################
|
||||
#
|
||||
# USAGE : ./install [<perl script name>]
|
||||
# USAGE : ./install [<perl script name> | AUTO <dir> <tmp_dir> <perl_dir> [<install_location>] ]
|
||||
# USAGE : by default all scripts will be installed
|
||||
#
|
||||
# REQUIREMENTS : /bin/bash and sed
|
||||
|
@ -21,191 +21,250 @@
|
|||
# - Check Net::SNMP version
|
||||
# - Install plugins in the plugins directory and modify paths if necessary.
|
||||
|
||||
############################ get script to install
|
||||
############################ script list
|
||||
PLUGINS="check_snmp_boostedge.pl check_snmp_css.pl check_snmp_linkproof_nhr.pl check_snmp_nsbox.pl check_snmp_vrrp.pl check_snmp_cpfw.pl check_snmp_env.pl check_snmp_load.pl check_snmp_process.pl check_snmp_win.pl check_snmp_css_main.pl check_snmp_int.pl check_snmp_mem.pl check_snmp_storage.pl"
|
||||
############################ get script to install or install type
|
||||
|
||||
if [ $# -gt 0 ] ; then INSTSCRIPT=$1 ; else INSTSCRIPT="all" ; fi
|
||||
echo
|
||||
echo "###### Nagios snmp scripts installer ######"
|
||||
echo
|
||||
echo "Will install $INSTSCRIPT script(s)"
|
||||
echo
|
||||
|
||||
############################ default values
|
||||
|
||||
SRCDIR=$PWD
|
||||
PERLHOME=`which perl 2>&1`
|
||||
if [ $? -ne 0 ]; then PERLHOME="" ; fi
|
||||
|
||||
PLUGHOME=/usr/local/nagios/libexec
|
||||
TMPDATA=/tmp
|
||||
PLUGINS="check_snmp_boostedge.pl check_snmp_css.pl check_snmp_linkproof_nhr.pl check_snmp_nsbox.pl check_snmp_vrrp.pl check_snmp_cpfw.pl check_snmp_env.pl check_snmp_load.pl check_snmp_process.pl check_snmp_win.pl check_snmp_css_main.pl check_snmp_int.pl check_snmp_mem.pl check_snmp_storage.pl"
|
||||
|
||||
############################ Checking Perl
|
||||
|
||||
echo -n "What is your perl location ? [$PERLHOME] "
|
||||
read USERPERL
|
||||
if [ "ZZ$USERPERL" != "ZZ" ]; then PERLHOME=$USERPERL ; fi
|
||||
|
||||
if [ "z$PERLHOME" == "z" ]; then
|
||||
echo "Can't find perl binary... exiting"
|
||||
echo "######### ERROR ########"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
NETSNMP=`$PERLHOME -e 'if (eval "require Net::SNMP") { print "Yes" ;}'`
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo "Error while checking Net::SNMP module"
|
||||
echo "######### ERROR ########"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if [ "zz$NETSNMP" != "zzYes" ]; then
|
||||
echo "Module Net::SNMP not found!"
|
||||
echo "Install it with CPAN or manually : http://www.manubulon.com/nagios/faq.html#FAQ2"
|
||||
echo "######### ERROR ########"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
SNMPVER=`$PERLHOME -e 'require Net::SNMP;print Net::SNMP->VERSION'`
|
||||
echo "Net::SNMP module version is $SNMPVER [OK]"
|
||||
|
||||
GETOPT=`$PERLHOME -e 'if (eval "require Getopt::Long") { print "Yes" ;}'`
|
||||
if [ "zz$GETOPT" != "zzYes" ]; then
|
||||
echo "Module Getopt::Long not found!"
|
||||
echo "Install it with CPAN or manually"
|
||||
echo "######### ERROR ########"
|
||||
exit 1;
|
||||
fi
|
||||
echo "Module Getopt::Long found [OK]"
|
||||
|
||||
############################ Check nagios plugin directory and utils.pm
|
||||
|
||||
echo
|
||||
echo "What is your nagios plugin location ? "
|
||||
echo -n "Note : file utils.pm must be present in it [$PLUGHOME] "
|
||||
read USERPLUG
|
||||
|
||||
if [ "z$USERPLUG" != "z" ]; then PLUGHOME=$USERPLUG ; fi
|
||||
if [ ! -d $PLUGHOME ] ; then
|
||||
echo "Directory $PLUGHOME does not exist !"
|
||||
echo "######### ERROR ########"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -f $PLUGHOME/utils.pm ] ; then
|
||||
echo "File $PLUGHOME/utils.pm does not exist !"
|
||||
echo "Install it from nagios plugins"
|
||||
echo "######### ERROR ########"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
############################ Asking for temp directory
|
||||
|
||||
echo
|
||||
echo "Where do you want the plugins to put temporary data (only used by some plugins) ? "
|
||||
echo -n "Nagios user must be able to write files in it [$TMPDATA] "
|
||||
read USERTMP
|
||||
|
||||
if [ "z$USERTMP" != "z" ]; then TMPDATA=$USERTMP ; fi
|
||||
|
||||
if [ ! -d $TMPDATA ] ; then
|
||||
echo "Directory $TMPDATA does not exist !"
|
||||
echo "######### ERROR ########"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
############################ Looks OK, copying with changes if necessary
|
||||
|
||||
TRANS=""
|
||||
# Change '#!/usr/bin/perl -w'
|
||||
if [ $PERLHOME != "/usr/bin/perl" ] ; then
|
||||
TRANS="-r -e s#/usr/bin/perl#$PERLHOME#"
|
||||
fi
|
||||
|
||||
# Change 'use lib "/usr/local/nagios/libexec";'
|
||||
if [ $PLUGHOME != "/usr/local/nagios/libexec" ] ; then
|
||||
if [ "z$TRANS" == "z" ]; then TRANS="-r -e s#/usr/local/nagios/libexec#$PLUGHOME#"
|
||||
else TRANS="$TRANS -e s#/usr/local/nagios/libexec#$PLUGHOME#";fi
|
||||
fi
|
||||
|
||||
# Change 'my $o_base_dir="/tmp/tmp_Nagios_'
|
||||
if [ $TMPDATA != "/tmp" ] ; then
|
||||
if [ "z$TRANS" == "z" ]; then TRANS="-r -e s#/tmp/tmp_Nagios#$TMPDATA/tmp_Nagios#"
|
||||
else TRANS="$TRANS -e s#/tmp/tmp_Nagios#$TMPDATA/tmp_Nagios#";fi
|
||||
fi
|
||||
|
||||
######################### script install
|
||||
|
||||
echo
|
||||
echo "Will now install $INSTSCRIPT script(s) : "
|
||||
echo "in directory : $PLUGHOME"
|
||||
echo "perl : $PERLHOME"
|
||||
echo "temp directory : $TMPDATA"
|
||||
echo
|
||||
echo -n "OK ? [Y/n]"
|
||||
read INSTOK
|
||||
|
||||
if [ "$INSTOK" == "n" ]; then
|
||||
echo "Aborting....."
|
||||
echo "######### ERROR ########"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ERROR=0
|
||||
|
||||
if [ $INSTSCRIPT == "all" ] ; then
|
||||
for i in $PLUGINS ; do
|
||||
if [ $INSTSCRIPT != "AUTO" ] ; then
|
||||
############################ Manual installation
|
||||
echo
|
||||
if [ ! -f $i ] ; then
|
||||
echo "Can't find source file $i : ##### ERROR #####"
|
||||
else
|
||||
echo -n "Installing $i : "
|
||||
if [ "z$TRANS" == "z" ] ; then
|
||||
cp $i $PLUGHOME/$i 2>&1
|
||||
else
|
||||
sed $TRANS $i > $PLUGHOME/$i 2>&1
|
||||
fi
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo "##### ERROR #####";
|
||||
rm -f $PLUGHOME/$i
|
||||
ERROR=1
|
||||
else
|
||||
echo "OK"
|
||||
chmod 755 $PLUGHOME/$i 2>&1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "###### Nagios snmp scripts installer ######"
|
||||
echo
|
||||
echo "Will install $INSTSCRIPT script(s)"
|
||||
echo
|
||||
if [ ! -f $INSTSCRIPT ] ; then
|
||||
echo "Can't find source file $INSTSCRIPT : ##### ERROR #####"
|
||||
else
|
||||
echo -n "Installing $INSTSCRIPT : "
|
||||
if [ "z$TRANS" == "z" ] ; then
|
||||
cp $INSTSCRIPT > $PLUGHOME/$INSTSCRIPT
|
||||
else
|
||||
sed $TRANS $INSTSCRIPT > $PLUGHOME/$INSTSCRIPT 2>&1
|
||||
fi
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo "##### ERROR #####";
|
||||
rm -f $PLUGHOME/$INSTSCRIPT
|
||||
ERROR=1
|
||||
exit 1;
|
||||
else
|
||||
echo "OK"
|
||||
chmod 755 $PLUGHOME/$INSTSCRIPT 2>&1
|
||||
fi
|
||||
fi
|
||||
|
||||
############################ default values
|
||||
|
||||
SRCDIR=$PWD
|
||||
PERLHOME=`which perl 2>&1`
|
||||
if [ $? -ne 0 ]; then PERLHOME="" ; fi
|
||||
|
||||
PLUGHOME=/usr/local/nagios/libexec
|
||||
TMPDATA=/tmp
|
||||
############################ Checking Perl
|
||||
|
||||
echo -n "What is your perl location ? [$PERLHOME] "
|
||||
read USERPERL
|
||||
if [ "ZZ$USERPERL" != "ZZ" ]; then PERLHOME=$USERPERL ; fi
|
||||
|
||||
if [ "z$PERLHOME" == "z" ]; then
|
||||
echo "Can't find perl binary... exiting"
|
||||
echo "######### ERROR ########"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
NETSNMP=`$PERLHOME -e 'if (eval "require Net::SNMP") { print "Yes" ;}'`
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo "Error while checking Net::SNMP module"
|
||||
echo "######### ERROR ########"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if [ "zz$NETSNMP" != "zzYes" ]; then
|
||||
echo "Module Net::SNMP not found!"
|
||||
echo "Install it with CPAN or manually : http://www.manubulon.com/nagios/faq.html#FAQ2"
|
||||
echo "######### ERROR ########"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
SNMPVER=`$PERLHOME -e 'require Net::SNMP;print Net::SNMP->VERSION'`
|
||||
echo "Net::SNMP module version is $SNMPVER [OK]"
|
||||
|
||||
GETOPT=`$PERLHOME -e 'if (eval "require Getopt::Long") { print "Yes" ;}'`
|
||||
if [ "zz$GETOPT" != "zzYes" ]; then
|
||||
echo "Module Getopt::Long not found!"
|
||||
echo "Install it with CPAN or manually"
|
||||
echo "######### ERROR ########"
|
||||
exit 1;
|
||||
fi
|
||||
echo "Module Getopt::Long found [OK]"
|
||||
|
||||
############################ Check nagios plugin directory and utils.pm
|
||||
|
||||
echo
|
||||
echo "What is your nagios plugin location ? "
|
||||
echo -n "Note : file utils.pm must be present in it [$PLUGHOME] "
|
||||
read USERPLUG
|
||||
|
||||
if [ "z$USERPLUG" != "z" ]; then PLUGHOME=$USERPLUG ; fi
|
||||
if [ ! -d $PLUGHOME ] ; then
|
||||
echo "Directory $PLUGHOME does not exist !"
|
||||
echo "######### ERROR ########"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -f $PLUGHOME/utils.pm ] ; then
|
||||
echo "File $PLUGHOME/utils.pm does not exist !"
|
||||
echo "Install it from nagios plugins"
|
||||
echo "######### ERROR ########"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
############################ Asking for temp directory
|
||||
|
||||
echo
|
||||
echo "Where do you want the plugins to put temporary data (only used by some plugins) ? "
|
||||
echo -n "Nagios user must be able to write files in it [$TMPDATA] "
|
||||
read USERTMP
|
||||
|
||||
if [ "z$USERTMP" != "z" ]; then TMPDATA=$USERTMP ; fi
|
||||
|
||||
if [ ! -d $TMPDATA ] ; then
|
||||
echo "Directory $TMPDATA does not exist !"
|
||||
echo "######### ERROR ########"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
############################ Looks OK, copying with changes if necessary
|
||||
|
||||
TRANS=""
|
||||
# Change '#!/usr/bin/perl -w'
|
||||
if [ $PERLHOME != "/usr/bin/perl" ] ; then
|
||||
TRANS="-r -e s#/usr/bin/perl#$PERLHOME#"
|
||||
fi
|
||||
|
||||
# Change 'use lib "/usr/local/nagios/libexec";'
|
||||
if [ $PLUGHOME != "/usr/local/nagios/libexec" ] ; then
|
||||
if [ "z$TRANS" == "z" ]; then TRANS="-r -e s#/usr/local/nagios/libexec#$PLUGHOME#"
|
||||
else TRANS="$TRANS -e s#/usr/local/nagios/libexec#$PLUGHOME#";fi
|
||||
fi
|
||||
|
||||
# Change 'my $o_base_dir="/tmp/tmp_Nagios_'
|
||||
if [ $TMPDATA != "/tmp" ] ; then
|
||||
if [ "z$TRANS" == "z" ]; then TRANS="-r -e s#/tmp/tmp_Nagios#$TMPDATA/tmp_Nagios#"
|
||||
else TRANS="$TRANS -e s#/tmp/tmp_Nagios#$TMPDATA/tmp_Nagios#";fi
|
||||
fi
|
||||
|
||||
######################### script install
|
||||
|
||||
echo
|
||||
echo "Will now install $INSTSCRIPT script(s) : "
|
||||
echo "in directory : $PLUGHOME"
|
||||
echo "perl : $PERLHOME"
|
||||
echo "temp directory : $TMPDATA"
|
||||
echo
|
||||
echo -n "OK ? [Y/n]"
|
||||
read INSTOK
|
||||
|
||||
if [ "$INSTOK" == "n" ]; then
|
||||
echo "Aborting....."
|
||||
echo "######### ERROR ########"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ERROR=0
|
||||
|
||||
if [ $INSTSCRIPT == "all" ] ; then
|
||||
for i in $PLUGINS ; do
|
||||
echo
|
||||
if [ ! -f $i ] ; then
|
||||
echo "Can't find source file $i : ##### ERROR #####"
|
||||
else
|
||||
echo -n "Installing $i : "
|
||||
if [ "z$TRANS" == "z" ] ; then
|
||||
cp $i $PLUGHOME/$i 2>&1
|
||||
else
|
||||
sed $TRANS $i > $PLUGHOME/$i 2>&1
|
||||
fi
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo "##### ERROR #####";
|
||||
rm -f $PLUGHOME/$i
|
||||
ERROR=1
|
||||
else
|
||||
echo "OK"
|
||||
chmod 755 $PLUGHOME/$i 2>&1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo
|
||||
if [ ! -f $INSTSCRIPT ] ; then
|
||||
echo "Can't find source file $INSTSCRIPT : ##### ERROR #####"
|
||||
else
|
||||
echo -n "Installing $INSTSCRIPT : "
|
||||
if [ "z$TRANS" == "z" ] ; then
|
||||
cp $INSTSCRIPT > $PLUGHOME/$INSTSCRIPT
|
||||
else
|
||||
sed $TRANS $INSTSCRIPT > $PLUGHOME/$INSTSCRIPT 2>&1
|
||||
fi
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo "##### ERROR #####";
|
||||
rm -f $PLUGHOME/$INSTSCRIPT
|
||||
ERROR=1
|
||||
exit 1;
|
||||
else
|
||||
echo "OK"
|
||||
chmod 755 $PLUGHOME/$INSTSCRIPT 2>&1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
echo
|
||||
if [ $ERROR -eq 1 ] ; then
|
||||
echo "Installation ended with errors. Check output above"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
echo "Installation completed OK"
|
||||
echo "You can delete all the source files and directory"
|
||||
echo "Remember to look for informtation at http://www.manubulon.com/nagios/"
|
||||
exit 0;
|
||||
|
||||
else
|
||||
####################### Silent install with parameters ############
|
||||
# PARAM AUTO <dir> <tmp_dir> <perl_dir> [<install_location>]
|
||||
if [ $# -ne 4 ] && [ $# -ne 5 ] ; then exit 1; fi
|
||||
|
||||
SRCDIR=$PWD
|
||||
PERLHOME=$4
|
||||
PLUGHOME=$2
|
||||
TMPDATA=$3
|
||||
INSTALLDIR=$5
|
||||
|
||||
TRANS=""
|
||||
# Change '#!/usr/bin/perl -w'
|
||||
if [ $PERLHOME != "/usr/bin/perl" ] ; then
|
||||
TRANS="-r -e s#/usr/bin/perl#$PERLHOME#"
|
||||
fi
|
||||
|
||||
# Change 'use lib "/usr/local/nagios/libexec";'
|
||||
if [ $PLUGHOME != "/usr/local/nagios/libexec" ] ; then
|
||||
if [ "z$TRANS" == "z" ]; then TRANS="-r -e s#/usr/local/nagios/libexec#$PLUGHOME#"
|
||||
else TRANS="$TRANS -e s#/usr/local/nagios/libexec#$PLUGHOME#";fi
|
||||
fi
|
||||
|
||||
# Change 'my $o_base_dir="/tmp/tmp_Nagios_'
|
||||
if [ $TMPDATA != "/tmp" ] ; then
|
||||
if [ "z$TRANS" == "z" ]; then TRANS="-r -e s#/tmp/tmp_Nagios#$TMPDATA/tmp_Nagios#"
|
||||
else TRANS="$TRANS -e s#/tmp/tmp_Nagios#$TMPDATA/tmp_Nagios#";fi
|
||||
fi
|
||||
|
||||
######################### script install
|
||||
ERROR=0
|
||||
if [ "z$INSTALLDIR" != "z" ] ; then
|
||||
PLUGHOME=$INSTALLDIR
|
||||
fi
|
||||
for i in $PLUGINS ; do
|
||||
if [ ! -f $i ] ; then
|
||||
ERROR=1
|
||||
else
|
||||
if [ "z$TRANS" == "z" ] ; then
|
||||
cp $i $PLUGHOME/$i 2>&1
|
||||
else
|
||||
sed $TRANS $i > $PLUGHOME/$i 2>&1
|
||||
fi
|
||||
if [ $? -ne 0 ] ; then
|
||||
rm -f $PLUGHOME/$i
|
||||
ERROR=1
|
||||
else
|
||||
chmod 755 $PLUGHOME/$i 2>&1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [ $ERROR -eq 1 ] ; then
|
||||
exit 1;
|
||||
fi
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
echo
|
||||
if [ $ERROR -eq 1 ] ; then
|
||||
echo "Installation ended with errors. Check output above"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
echo "Installation completed OK"
|
||||
echo "You can delete all the source files and directory"
|
||||
echo "Remember to look for informtation at http://www.manubulon.com/nagios/"
|
||||
exit 0;
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue