new plugins and old plugins check_graph updated + updates for traps
git-svn-id: http://svn.centreon.com/Plugins/Dev@2529 6bcd3966-0018-0410-8128-fd23d134de7e
This commit is contained in:
parent
c4ccd6998e
commit
a49c4aede5
|
@ -0,0 +1,182 @@
|
|||
#! /usr/bin/perl -w
|
||||
#
|
||||
# $Id: check_graph_dell_temperature.pl,v 1.1 2005/07/27 22:22:48 wistof Exp $
|
||||
#
|
||||
# Oreon's plugins are developped with GPL Licence :
|
||||
# http://www.fsf.org/licenses/gpl.txt
|
||||
# Developped by : Wistof
|
||||
#
|
||||
# Modified for Oreon Project by : Mathieu Chateau - Christophe Coraboeuf
|
||||
#
|
||||
# The Software is provided to you AS IS and WITH ALL FAULTS.
|
||||
# OREON makes no representation and gives no warranty whatsoever,
|
||||
# whether express or implied, and without limitation, with regard to the quality,
|
||||
# safety, contents, performance, merchantability, non-infringement or suitability for
|
||||
# any particular or intended purpose of the Software found on the OREON web site.
|
||||
# In no event will OREON be liable for any direct, indirect, punitive, special,
|
||||
# incidental or consequential damages however they may arise and even if OREON has
|
||||
# been previously advised of the possibility of such damages.
|
||||
|
||||
# based on "graph plugins" developped by Oreon Team. See http://www.oreon.org.
|
||||
##
|
||||
## Plugin init
|
||||
##
|
||||
use strict;
|
||||
use Net::SNMP qw(:snmp oid_lex_sort);
|
||||
use FindBin;
|
||||
use lib "$FindBin::Bin";
|
||||
use lib "/srv/nagios/libexec";
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &support);
|
||||
|
||||
if (eval "require oreon" ) {
|
||||
use oreon qw(get_parameters);
|
||||
use vars qw($VERSION %oreon);
|
||||
%oreon=get_parameters();
|
||||
} else {
|
||||
print "Unable to load oreon perl module\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
use vars qw($PROGNAME $VERSION);
|
||||
use Getopt::Long;
|
||||
use vars qw($opt_h $opt_V $opt_H $opt_C $opt_v $opt_s $opt_t $sensor $OID $OID_DESC);
|
||||
|
||||
##
|
||||
## Plugin var init
|
||||
##
|
||||
|
||||
|
||||
$VERSION = '$Revision: 1.1 $';
|
||||
$VERSION =~ s/^\$.*:\W(.*)\W.+?$/$1/;
|
||||
|
||||
$PROGNAME = $0;
|
||||
sub print_help ();
|
||||
sub print_usage ();
|
||||
|
||||
Getopt::Long::Configure('bundling');
|
||||
GetOptions
|
||||
("h" => \$opt_h, "help" => \$opt_h,
|
||||
"V" => \$opt_V, "version" => \$opt_V,
|
||||
"v=s" => \$opt_v, "snmp=s" => \$opt_v,
|
||||
"C=s" => \$opt_C, "community=s" => \$opt_C,
|
||||
"s" => \$opt_s, "show" => \$opt_s,
|
||||
"t=s" => \$opt_t, "sensor=s" => \$opt_t,
|
||||
"H=s" => \$opt_H, "hostname=s" => \$opt_H);
|
||||
|
||||
if ($opt_V) {
|
||||
print_revision($PROGNAME,'$Revision: 1.1 $');
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
if ($opt_h) {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
$opt_H = shift unless ($opt_H);
|
||||
(print_usage() && exit $ERRORS{'OK'}) unless ($opt_H);
|
||||
|
||||
($opt_v) || ($opt_v = shift) || ($opt_v = "1");
|
||||
my $snmp = $1 if ($opt_v =~ /(\d)/);
|
||||
|
||||
($opt_t) || ($opt_t = shift) || ($opt_t = "1");
|
||||
my $sensor = $1 if ($opt_t =~ /(\d)/);
|
||||
|
||||
($opt_C) || ($opt_C = shift) || ($opt_C = "public");
|
||||
|
||||
my $start=time;
|
||||
my $name = $0;
|
||||
$name =~ s/\.pl.*//g;
|
||||
|
||||
##
|
||||
## Plugin snmp requests
|
||||
##
|
||||
my $OID = ".1.3.6.1.4.1.674.10892.1.700.20.1.6.1";
|
||||
my $OID_DESC = ".1.3.6.1.4.1.674.10892.1.700.20.1.8.1";
|
||||
|
||||
|
||||
# create a SNMP session
|
||||
my ( $session, $error ) = Net::SNMP->session(-hostname => $opt_H,-community => $opt_C, -version => $snmp);
|
||||
if ( !defined($session) ) {
|
||||
print("UNKNOWN: $error");
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
if ($opt_s) {
|
||||
# Get desctiption table
|
||||
my $result = $session->get_table(
|
||||
Baseoid => $OID_DESC
|
||||
);
|
||||
|
||||
if (!defined($result)) {
|
||||
printf("ERROR: Description Table : %s.\n", $session->error);
|
||||
$session->close;
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
foreach my $key ( oid_lex_sort(keys %$result)) {
|
||||
my @oid_list = split (/\./,$key);
|
||||
my $index = pop (@oid_list) ;
|
||||
print "Temperature Sensor $index :: $$result{$key}\n";
|
||||
}
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
|
||||
my $result = $session->get_request(
|
||||
-varbindlist => [$OID.".".$sensor,
|
||||
$OID_DESC.".".$sensor]
|
||||
);
|
||||
if (!defined($result)) {
|
||||
printf("UNKNOWN: %s.\n", $session->error);
|
||||
$session->close;
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
my $return_result = $result->{$OID.".".$sensor};
|
||||
my $un = 0;
|
||||
if ($return_result =~ /(\d+)/ ) {
|
||||
$un = $1;
|
||||
} else {
|
||||
printf("UNKNOWN: Unable to parse SNMP Output :: %s", $return_result );
|
||||
$session->close;
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
$un = sprintf("%02.2f", $un / 10);
|
||||
|
||||
##
|
||||
## Plugin return code
|
||||
##
|
||||
if ($un || ( $un == 0) ){
|
||||
print "OK - ". $result->{$OID_DESC.".".$sensor} ." : $un\n";
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
else{
|
||||
print "CRITICAL Host unavailable\n";
|
||||
exit $ERRORS{'CRITICAL'};
|
||||
}
|
||||
|
||||
|
||||
sub print_usage () {
|
||||
print "\nUsage:\n";
|
||||
print "$PROGNAME\n";
|
||||
print " -H (--hostname) Hostname to query - (required)\n";
|
||||
print " -C (--community) SNMP read community (defaults to public,\n";
|
||||
print " used with SNMP v1 and v2c\n";
|
||||
print " -v (--snmp_version) 1 for SNMP v1 (default)\n";
|
||||
print " 2 for SNMP v2c\n";
|
||||
print " -t (--sensor) Set the sensor number (1 by default)\n";
|
||||
print " -s (--show) Describes all sensors \n";
|
||||
print " -V (--version) Plugin version\n";
|
||||
print " -h (--help) usage help\n";
|
||||
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print "Copyright (c) 2005 Oreon\n";
|
||||
print "Bugs to http://www.oreon.org/\n";
|
||||
print "\n";
|
||||
print_usage();
|
||||
print "\n";
|
||||
}
|
|
@ -0,0 +1,195 @@
|
|||
#! /usr/bin/perl -w
|
||||
#
|
||||
# $Id: check_graph_http,v 1.3 2005/08/01 18:03:52 gollum123 Exp $
|
||||
#
|
||||
# This plugin is developped under GPL Licence:
|
||||
# http://www.fsf.org/licenses/gpl.txt
|
||||
|
||||
# Developped by Linagora SA: http://www.linagora.com
|
||||
|
||||
# Modified for Oreon Project by : Sugumaran Mathavarajan - Mathieu Chateau - Christophe Coraboeuf
|
||||
|
||||
# The Software is provided to you AS IS and WITH ALL FAULTS.
|
||||
# LINAGORA makes no representation and gives no warranty whatsoever,
|
||||
# whether express or implied, and without limitation, with regard to the quality,
|
||||
# safety, contents, performance, merchantability, non-infringement or suitability for
|
||||
# any particular or intended purpose of the Software found on the LINAGORA web site.
|
||||
# In no event will LINAGORA be liable for any direct, indirect, punitive, special,
|
||||
# incidental or consequential damages however they may arise and even if LINAGORA has
|
||||
# been previously advised of the possibility of such damages.
|
||||
|
||||
# based on "graph plugins" developped by Oreon Team. See http://www.oreon.org.
|
||||
|
||||
##
|
||||
## Plugin init
|
||||
##
|
||||
use strict;
|
||||
use FindBin;
|
||||
use lib "$FindBin::Bin";
|
||||
use lib "/srv/nagios/libexec";
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &support);
|
||||
|
||||
if (eval "require oreon" ) {
|
||||
use oreon qw(get_parameters);
|
||||
use vars qw($VERSION %oreon);
|
||||
%oreon=get_parameters();
|
||||
} else {
|
||||
print "Unable to load oreon perl module\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
use Getopt::Long;
|
||||
use vars qw($opt_h $opt_V $opt_g $opt_D $opt_S $opt_H $opt_I $opt_e $opt_s $opt_u $opt_p $opt_P $opt_w $opt_c
|
||||
$opt_t $opt_a $opt_L $opt_f $opt_l $opt_r $opt_R $opt_z $opt_C $opt_step $step);
|
||||
use vars qw($PROGNAME);
|
||||
|
||||
##
|
||||
## Plugin var init
|
||||
##
|
||||
my $pathtolibexechttp = $oreon{GLOBAL}{ NAGIOS_LIBEXEC}."check_http";
|
||||
|
||||
$PROGNAME = "$0";
|
||||
sub print_help ();
|
||||
sub print_usage ();
|
||||
|
||||
Getopt::Long::Configure('bundling');
|
||||
GetOptions
|
||||
("h" => \$opt_h, "help" => \$opt_h,
|
||||
"V" => \$opt_V, "version" => \$opt_V,
|
||||
"H=s" => \$opt_H, "hostname=s" => \$opt_H,
|
||||
"I=s" => \$opt_I, "IP-address=s" => \$opt_I,
|
||||
"e=s" => \$opt_e, "expect=s" => \$opt_e,
|
||||
"s=s" => \$opt_s, "string=s" => \$opt_s,
|
||||
"u=s" => \$opt_u, "url=s" => \$opt_u,
|
||||
"p=s" => \$opt_p, "port=s" => \$opt_p,
|
||||
"P=s" => \$opt_P, "post=s" => \$opt_P,
|
||||
"w=s" => \$opt_w, "warning=s" => \$opt_w,
|
||||
"c=s" => \$opt_c, "critical=s" => \$opt_c,
|
||||
"t=s" => \$opt_t, "timeout=s" => \$opt_t,
|
||||
"a=s" => \$opt_a, "authorization=s" => \$opt_a,
|
||||
"L=s" => \$opt_L, "link=s" => \$opt_L,
|
||||
"f=s" => \$opt_f, "onredirect=s" => \$opt_f,
|
||||
"l=s" => \$opt_l, "linespan=s" => \$opt_l,
|
||||
"r=s" => \$opt_r, "regex=s" => \$opt_r,
|
||||
"R=s" => \$opt_R, "eregi=s" => \$opt_R,
|
||||
"C=s" => \$opt_C, "certificate=s" => \$opt_C,
|
||||
"z" => \$opt_R, "ssl" => \$opt_z
|
||||
|
||||
);
|
||||
|
||||
if ($opt_V) {
|
||||
print_revision($PROGNAME,'$Revision: 1.3 $');
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
if ($opt_h) {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
$opt_H = shift unless ($opt_H);
|
||||
(print_usage() && exit $ERRORS{'OK'}) unless ($opt_H);
|
||||
|
||||
($opt_step) || ($opt_step = shift) || ($opt_step = "300");
|
||||
$step = $1 if ($opt_step =~ /(\d+)/);
|
||||
|
||||
my $args_check_http = "";
|
||||
if ( $opt_H ) {
|
||||
$args_check_http .= " -H $opt_H";
|
||||
}
|
||||
if ( $opt_I ) {
|
||||
$args_check_http .= " -I $opt_I";
|
||||
}
|
||||
if ( $opt_e ) {
|
||||
$args_check_http .= " -e $opt_e";
|
||||
}
|
||||
if ( $opt_s ) {
|
||||
$args_check_http .= " -s $opt_s";
|
||||
}
|
||||
if ( $opt_u ) {
|
||||
$args_check_http .= " -u $opt_u";
|
||||
}
|
||||
if ( $opt_p ) {
|
||||
$args_check_http .= " -p $opt_p";
|
||||
}
|
||||
if ( $opt_P ) {
|
||||
$args_check_http .= " -P $opt_P";
|
||||
}
|
||||
if ( $opt_I ) {
|
||||
$args_check_http .= " -I $opt_I";
|
||||
}
|
||||
if ( $opt_e ) {
|
||||
$args_check_http .= " -e $opt_e";
|
||||
}
|
||||
if ( $opt_w ) {
|
||||
$args_check_http .= " -w $opt_w";
|
||||
}
|
||||
if ( $opt_c ) {
|
||||
$args_check_http .= " -c $opt_c";
|
||||
}
|
||||
if ( $opt_t ) {
|
||||
$args_check_http .= " -t $opt_t";
|
||||
}
|
||||
if ( $opt_a ) {
|
||||
$args_check_http .= " -a $opt_a";
|
||||
}
|
||||
if ( $opt_L ) {
|
||||
$args_check_http .= " -L $opt_L";
|
||||
}
|
||||
if ( $opt_f ) {
|
||||
$args_check_http .= " -f $opt_f";
|
||||
}
|
||||
if ( $opt_l ) {
|
||||
$args_check_http .= " -l $opt_l";
|
||||
}
|
||||
if ( $opt_r ) {
|
||||
$args_check_http .= " -r $opt_r";
|
||||
}
|
||||
if ( $opt_R ) {
|
||||
$args_check_http .= " -R $opt_R";
|
||||
}
|
||||
if ( $opt_C ) {
|
||||
$args_check_http .= " -C $opt_C";
|
||||
}
|
||||
if ( $opt_z ) {
|
||||
$args_check_http .= " --ssl";
|
||||
}
|
||||
|
||||
|
||||
|
||||
my $start=time;
|
||||
my $name = $0;
|
||||
$name =~ s/\.pl.*//g;
|
||||
|
||||
##
|
||||
## Plugin requests
|
||||
##
|
||||
# print "args: $args_check_http \n";
|
||||
my $result = `$pathtolibexechttp $args_check_http`;
|
||||
my $return_code = $? / 256;
|
||||
|
||||
$_ = $result;
|
||||
m/time=\s*(\d*\.\d*)/;
|
||||
my $time = $1;
|
||||
|
||||
|
||||
print "$result";
|
||||
exit $return_code;
|
||||
|
||||
##
|
||||
## Plugin return code
|
||||
##
|
||||
sub print_usage () {
|
||||
my $screen = `$pathtolibexechttp -h`;
|
||||
$screen =~ s/check_http/check_graph_http/g;
|
||||
$screen =~ s/-S/-Z/;
|
||||
print $screen;
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print "Copyright (c) 2005 LINAGORA SA\n";
|
||||
print "Bugs to http://www.linagora.com/\n";
|
||||
print "\n";
|
||||
print_usage();
|
||||
print "\n";
|
||||
}
|
|
@ -0,0 +1,338 @@
|
|||
#! /usr/bin/perl -w
|
||||
#
|
||||
# $Id: check_graph_nt.pl,v 1.3 2005/08/01 18:04:00 gollum123 Exp $
|
||||
#
|
||||
# Oreon's plugins are developped with GPL Licence :
|
||||
# http://www.fsf.org/licenses/gpl.txt
|
||||
# Developped by : Julien Mathis - Mathieu Mettre
|
||||
# Under control of Flavien Astraud, Jerome Landrieu for Epitech.
|
||||
# Oreon's plugins are developped in partnership with Linagora company.
|
||||
#
|
||||
# Modified for Oreon Project by : Mathieu Chateau - Christophe Coraboeuf
|
||||
# Modified for Oreon Project by : Sugumaran Mathavarajan - mat.sugumaran@merethis.com
|
||||
#
|
||||
# The Software is provided to you AS IS and WITH ALL FAULTS.
|
||||
# OREON makes no representation and gives no warranty whatsoever,
|
||||
# whether express or implied, and without limitation, with regard to the quality,
|
||||
# safety, contents, performance, merchantability, non-infringement or suitability for
|
||||
# any particular or intended purpose of the Software found on the OREON web site.
|
||||
# In no event will OREON be liable for any direct, indirect, punitive, special,
|
||||
# incidental or consequential damages however they may arise and even if OREON has
|
||||
# been previously advised of the possibility of such damages.
|
||||
|
||||
##
|
||||
## Plugin init
|
||||
##
|
||||
use strict;
|
||||
use FindBin;
|
||||
use lib "$FindBin::Bin";
|
||||
use lib "/srv/nagios/libexec";
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &support);
|
||||
|
||||
|
||||
if (eval "require oreon" ) {
|
||||
use oreon qw(get_parameters create_rrd update_rrd &is_valid_serviceid);
|
||||
use vars qw($VERSION %oreon);
|
||||
%oreon=get_parameters();
|
||||
} else {
|
||||
print "Unable to load oreon perl module\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
use vars qw($PROGNAME);
|
||||
use Getopt::Long;
|
||||
use vars qw($opt_H $opt_p $opt_s $opt_v $opt_V $opt_h $opt_w $opt_c $opt_S $opt_g $opt_t $opt_l $opt_d $opt_D $opt_step $step $opt_f);
|
||||
|
||||
##
|
||||
## Plugin var init
|
||||
##
|
||||
my $pathtolibexecnt = $oreon{GLOBAL}{NAGIOS_LIBEXEC}."check_nt";
|
||||
|
||||
my($op_v, $op_d, $op_s, $op_t, $op_l, $port, @values, @test, @test2, @test3, @test4, @test5, $warning, $critical, @w, @c, $uptime);
|
||||
my($warning2, $critical2, $warning3, $critical3, $warning4, $critical4, @output);
|
||||
$PROGNAME = "$0";
|
||||
sub print_help ();
|
||||
sub print_usage ();
|
||||
|
||||
Getopt::Long::Configure('bundling');
|
||||
GetOptions
|
||||
("h" => \$opt_h, "help" => \$opt_h,
|
||||
"p=s" => \$opt_p, "port=s" => \$opt_p,
|
||||
"V" => \$opt_V, "version" => \$opt_V,
|
||||
"s=s" => \$opt_s, "password=s" => \$opt_s,
|
||||
"d=s" => \$opt_d, "showall=s" => \$opt_d,
|
||||
"v=s" => \$opt_v, "variable=s" => \$opt_v,
|
||||
"D=s" => \$opt_D, "directory=s" => \$opt_D,
|
||||
"t=s" => \$opt_t, "timeout=s" => \$opt_t,
|
||||
"l:s" => \$opt_l, "parameter:s" => \$opt_l,
|
||||
"w=s" => \$opt_w, "warning=s" => \$opt_w,
|
||||
"c=s" => \$opt_c, "critical=s" => \$opt_c,
|
||||
"H=s" => \$opt_H, "hostname=s" => \$opt_H);
|
||||
|
||||
if ($opt_h) {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
if ($opt_V) {
|
||||
$_ = `$pathtolibexecnt -V`;
|
||||
print "$_";
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
if ($opt_p) {
|
||||
if ($opt_p =~ /([0-9]+)/){
|
||||
$port = $1;
|
||||
}
|
||||
else{
|
||||
print "Unknown -p number expected... or it doesn't exist, try another port - number\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
}
|
||||
|
||||
$opt_H = shift unless ($opt_H);
|
||||
(print_usage() && exit $ERRORS{'OK'}) unless ($opt_H);
|
||||
|
||||
|
||||
if ($opt_c) {
|
||||
($opt_c) || ($opt_c = shift);
|
||||
$critical = $1 if ($opt_c =~ /([0-9]+)/);
|
||||
}
|
||||
|
||||
if ($opt_w) {
|
||||
($opt_w) || ($opt_w = shift);
|
||||
$warning = $1 if ($opt_w =~ /([0-9]+)/);
|
||||
}
|
||||
|
||||
if (($critical && $warning) && ($critical <= $warning)) {
|
||||
print "(--crit) must be superior to (--warn)";
|
||||
print_usage();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
|
||||
if ($opt_t) {
|
||||
($opt_t) || ($opt_t = shift);
|
||||
$op_t = $1 if ($opt_t =~ /([-\.,\w]+)/);
|
||||
}
|
||||
|
||||
if ($opt_l) {
|
||||
($opt_l) || ($opt_l = shift);
|
||||
$op_l = $1 if ($opt_l =~ /(.+)/);
|
||||
}
|
||||
|
||||
if ($opt_s) {
|
||||
($opt_s) || ($opt_s = shift);
|
||||
$op_s = $1 if ($opt_s =~ /([-.,A-Za-z0-9]+)/);
|
||||
}
|
||||
|
||||
if ($opt_d) {
|
||||
($opt_d) || ($opt_d = shift);
|
||||
$op_d = $1 if ($opt_d =~ /([-.,A-Za-z0-9]+)/);
|
||||
}
|
||||
|
||||
if ($opt_v) {
|
||||
($opt_v) || ($opt_v = shift);
|
||||
$op_v = $1 if ($opt_v =~ /([-.,A-Za-z0-9]+)/);
|
||||
}
|
||||
|
||||
($opt_step) || ($opt_step = shift) || ($opt_step = 300);
|
||||
$step = $1 if ($opt_step =~ /(\d+)/);
|
||||
|
||||
my $name = $0;
|
||||
$name =~ s/\.pl.*//g;
|
||||
my $return_code;
|
||||
##
|
||||
## Plugin requests
|
||||
##
|
||||
my $start=time;
|
||||
if ($op_v) {
|
||||
if ($op_v) {$op_v = "-v ".$op_v;}
|
||||
if ($port) {$port = "-p ".$port;} else { $port = " ";}
|
||||
if ($warning) {$warning = "-w ".$warning;} else { $warning = " ";}
|
||||
if ($critical) {$critical = "-c ".$critical;} else { $critical = " ";}
|
||||
if ($op_l) {$op_l = "-l \"".$op_l ."\"";} else { $op_l = " ";}
|
||||
if ($op_t) {$op_t = "-t ".$op_t;} else { $op_t = " ";}
|
||||
if ($op_s) {$op_s = "-s ".$op_s;} else { $op_s = " ";}
|
||||
if ($op_d) {$op_d = "-d ".$op_d;} else { $op_d = " ";}
|
||||
# print "$pathtolibexecnt -H $opt_H $op_v $port $warning $critical $op_l $op_t $op_s $op_d\n";
|
||||
$_ = `$pathtolibexecnt -H $opt_H $op_v $port $warning $critical $op_l $op_t $op_s $op_d 2>/dev/null`;
|
||||
my $return = $_;
|
||||
$return =~ s/\\//g;
|
||||
$return_code = $? / 256;
|
||||
|
||||
##
|
||||
## CLIENTVERSION
|
||||
##
|
||||
if ($op_v =~ /CLIENTVERSION/){
|
||||
print "CLIENTVERSION impossible to Graph!\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
if (($op_v =~ /CPULOAD/) && ($op_l =~ /([-\.,\w]+)/)){ ## CPULOAD
|
||||
@output = split(/\|/,$_);
|
||||
@values = $output[0] =~ /(\d*)\%/g ;
|
||||
$start=time;
|
||||
## Print Plugins Output
|
||||
$return =~ s/\n/ /g;
|
||||
if (@values){
|
||||
if (defined($opt_c) && defined($opt_w)){
|
||||
print $return . "|cpu=@values;$opt_w;$opt_c\n";
|
||||
} else {
|
||||
print $return . "|cpu=@values\n";
|
||||
}
|
||||
} else {
|
||||
print $return . "\n";
|
||||
}
|
||||
exit $return_code;
|
||||
} elsif ($op_v =~ /UPTIME/){ ## UPTIME
|
||||
if ($_ =~ /.*[-:]+\s(\d+)\s.*$/ ) {
|
||||
$uptime = $1;
|
||||
} else {
|
||||
print "unable to parse check_nt output: $_\n" ;
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
$_ =~ s/\n/ /g;
|
||||
if (defined($uptime)){
|
||||
print $_ . "|uptime=".$uptime."d\n";
|
||||
} else {
|
||||
print $_ . "\n";
|
||||
}
|
||||
exit $return_code;
|
||||
} elsif (($op_v =~ /USEDDISKSPACE/) && ($op_l =~ /([-\.,\w]+)/)){ ## USEDDISKSPACE
|
||||
my @test = split(/ /,$_);
|
||||
if (defined($test[9]) && defined($test2[1])){
|
||||
@test2 = split(/\(/, $test[9]);
|
||||
@test3 = split(/\%/, $test2[1]);
|
||||
}
|
||||
@c = split(/ /, $critical);
|
||||
$critical = $c[1];
|
||||
@w = split(/ /, $warning);
|
||||
$warning = $w[1];
|
||||
## Print Plugins Output
|
||||
$return =~ s/\n/ /g;
|
||||
$return =~ s/%/ pct/g;
|
||||
if (defined($test[3]) && defined($test[7]) && defined($test[12])){
|
||||
print $return . "|total=".$test[3]."Mo used=".$test[7]."Mo free=".$test[12]."Mo\n";
|
||||
} else {
|
||||
print $return . "\n";
|
||||
}
|
||||
exit $return_code;
|
||||
} elsif ($op_v =~ /MEMUSE/){ ## MEMUSE
|
||||
$start=time;
|
||||
my @test = split(/ /,$_);
|
||||
if (defined($test[2])){
|
||||
@test4 = split(/:/, $test[2]);
|
||||
}
|
||||
@c = split(/ /, $critical);
|
||||
$critical = $c[1];
|
||||
@w = split(/ /, $warning);
|
||||
$warning = $w[1];
|
||||
## Print Plugins Output
|
||||
$return =~ s/\n/ /g;
|
||||
$return =~ s/%/ pct/g;
|
||||
if ($test4[1] && $test[6] && $test[11]){
|
||||
print $return . "|total=".$test4[1]." used=".$test[6]." free=".$test[11]."\n";
|
||||
} else {
|
||||
print $return . "\n";
|
||||
}
|
||||
exit $return_code;
|
||||
} elsif ($op_v =~ /SERVICESTATE/){## SERVICESTATE
|
||||
my (@tab, $process, $nom, $etat);
|
||||
@tab = split (' - ',$_);
|
||||
foreach $process (@tab) {
|
||||
($nom,$etat) = split (': ', $process);
|
||||
if (defined($etat)) {
|
||||
$etat =~ s/\n//;
|
||||
} else {
|
||||
$etat = "Unknow";
|
||||
}
|
||||
if ($etat =~ /Started/)
|
||||
{$etat=1;}
|
||||
elsif ($etat =~ /Stopped/)
|
||||
{$etat=0;}
|
||||
elsif ($etat =~ /Unknown/)
|
||||
{$etat=-1;}
|
||||
else {
|
||||
print "Unable to get $nom status [$etat]: \n\t$_\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
}
|
||||
$return =~ s/%/ pct/g;
|
||||
print $return;
|
||||
exit $return_code;
|
||||
} elsif ($op_v =~ /PROCSTATE/){## PROCSTATE
|
||||
print "PROCSTATE not graphed\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
} elsif (($op_v =~ /COUNTER/) && ($op_l =~ /(.+)/)) { ## COUNTER
|
||||
@output = split(/\|/,$_);
|
||||
@values = $output[0] =~ /([,\.\d]*)\s?\%/ ;
|
||||
if (!@values) {@values = $output[0] =~ /([\d]*)/;}
|
||||
$start=time;
|
||||
## Print Plugins Output
|
||||
$return =~ s/\n/ /g;
|
||||
$return =~ s/%/ pct/g;
|
||||
print $return . "|counter=".@values."\n";
|
||||
exit $return_code;
|
||||
}
|
||||
} else {
|
||||
print "Could not parse arguments\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
##
|
||||
## Plugin return code
|
||||
##
|
||||
|
||||
sub print_usage () {
|
||||
print "\nUsage:\n";
|
||||
print "$PROGNAME\n";
|
||||
print " Usage: check_graph_nt -H host -v variable [-p port] [-s password] [-w warning] [-c critical] [-l params] [-d SHOWALL] [-t timeout] \n";
|
||||
print " Options:\n";
|
||||
print " -H, --hostname=HOST\n";
|
||||
print " Name of the host to check\n";
|
||||
print " -p, --port=INTEGER\n";
|
||||
print " Optional port number (default: 1248)\n";
|
||||
print " -s <password>\n";
|
||||
print " Password needed for the request\n";
|
||||
print " -v, --variable=STRING\n";
|
||||
print " Variable to check. Valid variables are:\n";
|
||||
print " CLIENTVERSION = Not Graphed. Get the NSClient version\n";
|
||||
print " CPULOAD = Average CPU load on last x minutes. Request a -l parameter with the following syntax:\n";
|
||||
print " -l <minutes range>,<warning threshold>,<critical threshold>. <minute range> should be less than 24*60.\n";
|
||||
print " Thresholds are percentage and up to 10 requests can be done in one shot. ie: -l 60,90,95,120,90,95\n";
|
||||
print " and 4 requests can be graphed.\n";
|
||||
print " UPTIME = Only Days are graphed. Get the uptime of the machine. No specific parameters. No warning or critical threshold.\n";
|
||||
print " USEDDISKSPACE = Size and percentage of disk use. Request a -l parameter containing the drive letter only.\n";
|
||||
print " Warning and critical thresholds can be specified with -w and -c.\n";
|
||||
print " MEMUSE = Memory use. Warning and critical thresholds can be specified with -w and -c.\n";
|
||||
print " SERVICESTATE = Check and graph the state of one service. Request a -l parameters with the following syntax:\n";
|
||||
print " -l <service1>... You MUST specify -d SHOWALL in the input command.\n";
|
||||
print " 1: Service Started - 0: Service Stopped - -1: Service Unknown.\n";
|
||||
# print " SERVICESTATE = Not Graphed. Check the state of one or several services. Request a -l parameters with the following syntax:\n";
|
||||
# print " -l <service1>,<service2>,<service3>,... You can specify -d SHOWALL in case you want to see working services\n";
|
||||
# print " in the returned string.\n";
|
||||
print " PROCSTATE = Not Graphed. Check if one or several process are running. Same syntax as SERVICESTATE.\n";
|
||||
print " COUNTER = Check any performance counter of Windows NT/2000. Request a -l parameters with the following syntax:\n";
|
||||
print " -l \"<performance object>counter\",\"<description>\" The <description> parameter is optional and\n";
|
||||
print " is given to a printf output command which require a float parameters. Some examples:\n";
|
||||
print " \"Paging file usage is %.2f %%\" or \"%.f %% paging file used.\"\n";
|
||||
print " -w, --warning=INTEGER\n";
|
||||
print " Threshold which will result in a warning status\n";
|
||||
print " -c, --critical=INTEGER\n";
|
||||
print " Threshold which will result in a critical status\n";
|
||||
print " -t, --timeout=INTEGER\n";
|
||||
print " Seconds before connection attempt times out (default: 10)\n";
|
||||
print " -h, --help\n";
|
||||
print " Print this help screen\n";
|
||||
print " -V, --version\n";
|
||||
print " Print version information\n";
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print "Copyright (c) 2004 OREON\n";
|
||||
print "Bugs to http://www.oreon.org/\n";
|
||||
print "\n";
|
||||
print_usage();
|
||||
print "\n";
|
||||
}
|
|
@ -1,172 +1,201 @@
|
|||
#! /usr/bin/perl -w
|
||||
###################################################################
|
||||
# Oreon is developped with GPL Licence 2.0
|
||||
#
|
||||
# GPL License: http://www.gnu.org/licenses/gpl.txt
|
||||
#
|
||||
# Developped by : Julien Mathis - Romain Le Merlus
|
||||
# Christophe Coraboeuf
|
||||
#
|
||||
###################################################################
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# For information : contact@merethis.com
|
||||
####################################################################
|
||||
#
|
||||
# Script init
|
||||
#
|
||||
|
||||
use strict;
|
||||
use FindBin;
|
||||
use lib "$FindBin::Bin";
|
||||
use lib "@NAGIOS_PLUGINS@";
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &support);
|
||||
|
||||
use vars qw($PROGNAME);
|
||||
use Getopt::Long;
|
||||
use vars qw($opt_V $opt_h $opt_H $opt_D $opt_w $opt_c $opt_n $rta_critical $rta_warning $pl_critical $pl_warning $opt_s);
|
||||
|
||||
# Plugin var init
|
||||
|
||||
my $ping = `whereis -b ping`;
|
||||
$ping =~ /^.*:\s(.*)$/;
|
||||
$ping = $1;
|
||||
|
||||
$PROGNAME = "check_graph_ping";
|
||||
sub print_help ();
|
||||
sub print_usage ();
|
||||
|
||||
Getopt::Long::Configure('bundling');
|
||||
GetOptions
|
||||
("h" => \$opt_h, "help" => \$opt_h,
|
||||
"V" => \$opt_V, "version" => \$opt_V,
|
||||
"w=s" => \$opt_w, "warning=s" => \$opt_w,
|
||||
"c=s" => \$opt_c, "critical=s" => \$opt_c,
|
||||
"n=s" => \$opt_n, "number=s" => \$opt_n,
|
||||
"H=s" => \$opt_H, "hostname=s" => \$opt_H);
|
||||
|
||||
if ($opt_V) {
|
||||
print_revision($PROGNAME,'$Revision: 1.2 $');
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
if ($opt_h) {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
$opt_H = shift unless ($opt_H);
|
||||
(print_usage() && exit $ERRORS{'OK'}) unless ($opt_H);
|
||||
|
||||
($opt_c) || ($opt_c = shift) || ($opt_c = "500,40%");
|
||||
if ($opt_c =~ /([0-9]+),([0-9]+)%/) {
|
||||
$rta_critical = $1;
|
||||
$pl_critical = $2;
|
||||
}
|
||||
|
||||
($opt_w) || ($opt_w = shift) || ($opt_w = "200,20%");
|
||||
if ($opt_w =~ /([0-9]+),([0-9]+)%/) {
|
||||
$rta_warning = $1;
|
||||
$pl_warning = $2;
|
||||
}
|
||||
|
||||
if ( ($rta_critical <= $rta_warning) || ($pl_critical <= $pl_warning) ) {
|
||||
print "critical must be superior to warning\n";
|
||||
print_usage();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
($opt_n) || ($opt_n = shift) || ($opt_n = 1);
|
||||
my $NbPing;
|
||||
if ($opt_n =~ /([0-9]+)/){
|
||||
$NbPing = $1;
|
||||
} else {
|
||||
print "Unknown ping number\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
# Plugin requests
|
||||
|
||||
$_ = `$ping -n -c $NbPing $opt_H 2>/dev/null`;
|
||||
my $return = $? / 256;
|
||||
|
||||
# Get Data From Ping Result
|
||||
|
||||
my $ping_result = $_;
|
||||
my @ping_result_array = split(/\n/,$ping_result);
|
||||
my @ping_subresult1_array;
|
||||
my @ping_subresult2_array;
|
||||
my $rta = 0;
|
||||
my $pl;
|
||||
my $time_answer;
|
||||
|
||||
if( ( $return != 0 ) || $ping_result_array[@ping_result_array -2 ] =~ /100% packet loss/) {
|
||||
$rta = -1;
|
||||
$time_answer = 0;
|
||||
} else {
|
||||
@ping_subresult1_array = split(/=/,$ping_result_array[@ping_result_array -1 ]);
|
||||
@ping_subresult2_array = split(/,/,$ping_result_array[@ping_result_array -2 ]);
|
||||
@ping_subresult1_array = split(/\//,$ping_subresult1_array[1]);
|
||||
@ping_subresult2_array = split(/ /,$ping_subresult2_array[2]);
|
||||
$rta = $ping_subresult1_array[1];
|
||||
$pl = $ping_subresult2_array[1];
|
||||
$time_answer = $ping_subresult1_array[1];
|
||||
$pl =~ /([0-9]+)\%/;
|
||||
$pl = $1;
|
||||
}
|
||||
|
||||
# Plugin return code
|
||||
|
||||
my $result_str = "";
|
||||
|
||||
if( $rta == -1 ) {
|
||||
$ping_result_array[@ping_result_array -2 ] =~ s/\%/percent/g;
|
||||
print "GPING CRITICAL - ".$ping_result_array[@ping_result_array -2 ]."|time=0 ok=0\n";
|
||||
exit $ERRORS{'CRITICAL'};
|
||||
} elsif ( ($pl >= $pl_critical) || ($rta >= $rta_critical) ) {
|
||||
$ping_result_array[@ping_result_array -1 ] =~ s/\%/percent/g;
|
||||
my @tab = split(/,/,$ping_result_array[@ping_result_array -1 ]);
|
||||
print "GPING CRITICAL - ". $tab[1] ."|time=".$time_answer."ms;$pl_warning;$pl_critical;; ok=1\n";
|
||||
exit $ERRORS{'CRITICAL'};
|
||||
} elsif (($pl >= $pl_warning) || ($rta >= $rta_warning) ) {
|
||||
$ping_result_array[@ping_result_array -1 ] =~ s/\%/percent/g;
|
||||
my @tab = split(/,/,$ping_result_array[@ping_result_array -1 ]);
|
||||
print "GPING WARNING - ".$tab[0]."|time=".$time_answer."ms;$pl_warning;$pl_critical;; ok=1\n";
|
||||
exit $ERRORS{'WARNING'};
|
||||
} else {
|
||||
$ping_result_array[@ping_result_array -1 ] =~ s/\%/percent/g;
|
||||
my @tab = split(/,/,$ping_result_array[@ping_result_array -1 ]);
|
||||
print "GPING OK - ".$tab[0]."|time=".$time_answer."ms;$pl_warning;$pl_critical;; ok=1\n";
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
sub print_usage () {
|
||||
print "Usage:\n";
|
||||
print "$PROGNAME\n";
|
||||
print " -H (--hostname) Hostname to query (Required)\n";
|
||||
print " -g (--rrdgraph) Create a rrd base if necessary and add datas into this one\n";
|
||||
print " --rrd_step Specifies the base interval in seconds with which data will be fed into the RRD (300 by default)\n";
|
||||
print " -S (--ServiceId) Oreon Service Id\n";
|
||||
print " -w (--warning) Threshold pair (Default: 200,20%)\n";
|
||||
print " -c (--critical) Threshold pair (Default: 500,40%)\n";
|
||||
print " -n (--number) number of ICMP ECHO packets to send (Default: 1)\n";
|
||||
print " -V (--version) Plugin version\n";
|
||||
print " -h (--help) usage help\n";
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print "######################################################\n";
|
||||
print "# Copyright (c) 2004-2007 Oreon-project #\n";
|
||||
print "# Bugs to http://www.oreon-project.org/ #\n";
|
||||
print "######################################################\n";
|
||||
print_usage();
|
||||
print "\n";
|
||||
}
|
||||
#! /usr/bin/perl -w
|
||||
#
|
||||
# $Id: check_oreon_ping,v 1.2 2006/04/28 10:21:49 Julien Mathis $
|
||||
#
|
||||
# Oreon's plugins are developped with GPL Licence :
|
||||
# http://www.fsf.org/licenses/gpl.txt
|
||||
# Developped by : Julien Mathis - Mathieu Mettre - Romain Le Merlus
|
||||
#
|
||||
# Modified for Oreon Project by : Mathieu Chateau - Christophe Coraboeuf
|
||||
# Modified By Julien Mathis - Sugumaran Mathavarajan For Merethis Company
|
||||
#
|
||||
# The Software is provided to you AS IS and WITH ALL FAULTS.
|
||||
# OREON makes no representation and gives no warranty whatsoever,
|
||||
# whether express or implied, and without limitation, with regard to the quality,
|
||||
# safety, contents, performance, merchantability, non-infringement or suitability for
|
||||
# any particular or intended purpose of the Software found on the OREON web site.
|
||||
# In no event will OREON be liable for any direct, indirect, punitive, special,
|
||||
# incidental or consequential damages however they may arise and even if OREON has
|
||||
# been previously advised of the possibility of such damages.
|
||||
|
||||
#
|
||||
# Plugin init
|
||||
#
|
||||
|
||||
use strict;
|
||||
use FindBin;
|
||||
use lib "$FindBin::Bin";
|
||||
use lib "/srv/nagios/libexec";
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &support);
|
||||
|
||||
if (eval "require oreon" ) {
|
||||
use oreon qw(get_parameters);
|
||||
use vars qw($VERSION %oreon);
|
||||
%oreon=get_parameters();
|
||||
} else {
|
||||
print "Unable to load oreon perl module\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
use vars qw($PROGNAME);
|
||||
use Getopt::Long;
|
||||
use vars qw($opt_V $opt_h $opt_g $opt_H $opt_D $opt_w $opt_c $opt_n $opt_f $opt_S $rta_critical $rta_warning $pl_critical $pl_warning $opt_s $opt_step $step );
|
||||
|
||||
#
|
||||
# Plugin var init
|
||||
#
|
||||
|
||||
my $ping = `whereis -b ping`;
|
||||
$ping =~ /^.*:\s(.*)$/;
|
||||
$ping = $1;
|
||||
|
||||
$PROGNAME = "$0";
|
||||
sub print_help ();
|
||||
sub print_usage ();
|
||||
|
||||
Getopt::Long::Configure('bundling');
|
||||
GetOptions
|
||||
("h" => \$opt_h, "help" => \$opt_h,
|
||||
"V" => \$opt_V, "version" => \$opt_V,
|
||||
"rrd_step=s" => \$opt_step,"f" => \$opt_f,
|
||||
"w=s" => \$opt_w, "warning=s" => \$opt_w,
|
||||
"c=s" => \$opt_c, "critical=s" => \$opt_c,
|
||||
"n=s" => \$opt_n, "number=s" => \$opt_n,
|
||||
"H=s" => \$opt_H, "hostname=s" => \$opt_H);
|
||||
|
||||
if ($opt_V) {
|
||||
print_revision($PROGNAME,'$Revision: 1.2 $');
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
if ($opt_h) {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
$opt_H = shift unless ($opt_H);
|
||||
(print_usage() && exit $ERRORS{'OK'}) unless ($opt_H);
|
||||
|
||||
($opt_c) || ($opt_c = shift) || ($opt_c = "500,40%");
|
||||
if ($opt_c =~ /([0-9]+),([0-9]+)%/) {
|
||||
$rta_critical = $1;
|
||||
$pl_critical = $2;
|
||||
}
|
||||
|
||||
($opt_w) || ($opt_w = shift) || ($opt_w = "200,20%");
|
||||
if ($opt_w =~ /([0-9]+),([0-9]+)%/) {
|
||||
$rta_warning = $1;
|
||||
$pl_warning = $2;
|
||||
}
|
||||
if (!$rta_warning || !$rta_critical || !$pl_warning || !$pl_critical) {
|
||||
print "bad initialisation of Treshholds\n";
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
if ( ($rta_critical <= $rta_warning) || ($pl_critical <= $pl_warning) ) {
|
||||
print "critical must be superior to warning\n";
|
||||
print_usage();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
($opt_n) || ($opt_n = shift) || ($opt_n = 1);
|
||||
my $NbPing;
|
||||
if ($opt_n =~ /([0-9]+)/){
|
||||
$NbPing = $1;
|
||||
} else{
|
||||
print "Unknown ping number\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
my $start=time;
|
||||
|
||||
#
|
||||
# RRDTools create rrd
|
||||
#
|
||||
|
||||
#
|
||||
# Plugin requests
|
||||
#
|
||||
|
||||
$_ = `$ping -n -c $NbPing $opt_H 2>/dev/null`;
|
||||
my $return = $? / 256;
|
||||
|
||||
#
|
||||
# Get Data From Ping Result
|
||||
#
|
||||
if (!$_) {
|
||||
print "no value returned by ping\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
my $ping_result = $_;
|
||||
my @ping_result_array = split(/\n/,$ping_result);
|
||||
my @ping_subresult1_array;
|
||||
my @ping_subresult2_array;
|
||||
my $rta = 0;
|
||||
my $pl;
|
||||
my $time_answer;
|
||||
|
||||
if( ( $return != 0 ) || $ping_result_array[@ping_result_array -2 ] =~ /100% packet loss/) {
|
||||
$rta = -1;
|
||||
$time_answer = 0;
|
||||
} else {
|
||||
@ping_subresult1_array = split(/=/,$ping_result_array[@ping_result_array -1 ]);
|
||||
@ping_subresult2_array = split(/,/,$ping_result_array[@ping_result_array -2 ]);
|
||||
@ping_subresult1_array = split(/\//,$ping_subresult1_array[1]);
|
||||
@ping_subresult2_array = split(/ /,$ping_subresult2_array[2]);
|
||||
$rta = $ping_subresult1_array[1];
|
||||
$pl = $ping_subresult2_array[1];
|
||||
$time_answer = $ping_subresult1_array[1];
|
||||
$pl =~ /([0-9]+)\%/;
|
||||
$pl = $1;
|
||||
}
|
||||
|
||||
#
|
||||
# Plugin return code
|
||||
#
|
||||
|
||||
my $result_str = "";
|
||||
|
||||
if( $rta == -1 ) {
|
||||
$ping_result_array[@ping_result_array -2 ] =~ s/\%/percent/g;
|
||||
print "GPING CRITICAL - ".$ping_result_array[@ping_result_array -2 ]."|time=0 ok=0\n";
|
||||
exit $ERRORS{'CRITICAL'};
|
||||
} elsif ( ($pl >= $pl_critical) || ($rta >= $rta_critical) ) {
|
||||
$ping_result_array[@ping_result_array -1 ] =~ s/\%/percent/g;
|
||||
my @tab = split(/,/,$ping_result_array[@ping_result_array -1 ]);
|
||||
print "GPING CRITICAL - ". $tab[1] ."|time=".$time_answer."ms;$pl_warning;$pl_critical;; ok=1\n";
|
||||
exit $ERRORS{'CRITICAL'};
|
||||
} elsif ( ($pl >= $pl_warning) || ($rta >= $rta_warning) ) {
|
||||
$ping_result_array[@ping_result_array -1 ] =~ s/\%/percent/g;
|
||||
my @tab = split(/,/,$ping_result_array[@ping_result_array -1 ]);
|
||||
print "GPING WARNING - ".$tab[0]."|time=".$time_answer."ms;$pl_warning;$pl_critical;; ok=1\n";
|
||||
exit $ERRORS{'WARNING'};
|
||||
} else {
|
||||
$ping_result_array[@ping_result_array -1 ] =~ s/\%/percent/g;
|
||||
my @tab = split(/,/,$ping_result_array[@ping_result_array -1 ]);
|
||||
print "GPING OK - ".$tab[0]."|time=".$time_answer."ms;$pl_warning;$pl_critical;; ok=1\n";
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
sub print_usage () {
|
||||
print "Usage:\n";
|
||||
print "$PROGNAME\n";
|
||||
print " -H (--hostname) Hostname to query (Required)\n";
|
||||
print " -g (--rrdgraph) Create a rrd base if necessary and add datas into this one\n";
|
||||
print " --rrd_step Specifies the base interval in seconds with which data will be fed into the RRD (300 by default)\n";
|
||||
print " -S (--ServiceId) Oreon Service Id\n";
|
||||
print " -w (--warning) Threshold pair (Default: 200,20%)\n";
|
||||
print " -c (--critical) Threshold pair (Default: 500,40%)\n";
|
||||
print " -n (--number) number of ICMP ECHO packets to send (Default: 1)\n";
|
||||
print " -V (--version) Plugin version\n";
|
||||
print " -h (--help) usage help\n";
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print "######################################################\n";
|
||||
print "# Copyright (c) 2004-2006 Oreon-project #\n";
|
||||
print "# Bugs to http://www.oreon-project.org/ #\n";
|
||||
print "######################################################\n";
|
||||
print_usage();
|
||||
print "\n";
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ use strict;
|
|||
use Net::SNMP qw(:snmp);
|
||||
use FindBin;
|
||||
use lib "$FindBin::Bin";
|
||||
use lib "@NAGIOS_PLUGINS@";
|
||||
use lib "/srv/nagios/libexec";
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &support);
|
||||
if (eval "require oreon" ) {
|
||||
use oreon qw(get_parameters);
|
||||
|
@ -46,7 +46,7 @@ use vars qw($opt_V $opt_h $opt_v $opt_C $opt_H $opt_c $opt_w $opt_D $snmp $opt_k
|
|||
|
||||
my($return_code);
|
||||
|
||||
$PROGNAME = "check_graph_load_average";
|
||||
$PROGNAME = "$0";
|
||||
sub print_help ();
|
||||
sub print_usage ();
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ use strict;
|
|||
use Net::SNMP qw(:snmp oid_lex_sort);
|
||||
use FindBin;
|
||||
use lib "$FindBin::Bin";
|
||||
use lib "@NAGIOS_PLUGINS@";
|
||||
use lib "/srv/nagios/libexec";
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &support);
|
||||
if (eval "require oreon" ) {
|
||||
use oreon qw(get_parameters);
|
||||
|
@ -47,7 +47,7 @@ use vars qw($opt_V $opt_h $opt_v $opt_C $opt_p $opt_H $opt_n $opt_k $opt_u $opt_
|
|||
|
||||
my($proc, $proc_run);
|
||||
|
||||
$PROGNAME = "check_graph_process";
|
||||
$PROGNAME = $0;
|
||||
sub print_help ();
|
||||
sub print_usage ();
|
||||
|
||||
|
|
|
@ -1,255 +0,0 @@
|
|||
#! /usr/bin/perl -w
|
||||
###################################################################
|
||||
# Oreon is developped with GPL Licence 2.0
|
||||
#
|
||||
# GPL License: http://www.gnu.org/licenses/gpl.txt
|
||||
#
|
||||
# Developped by : Julien Mathis - Romain Le Merlus
|
||||
# Christophe Coraboeuf
|
||||
#
|
||||
###################################################################
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# For information : contact@merethis.com
|
||||
####################################################################
|
||||
#
|
||||
# Script init
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Net::SNMP qw(:snmp oid_lex_sort);
|
||||
use FindBin;
|
||||
use lib "$FindBin::Bin";
|
||||
use lib "/usr/local/nagios/libexec/";
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &support);
|
||||
if (eval "require oreon" ) {
|
||||
use oreon qw(get_parameters);
|
||||
use vars qw($VERSION %oreon);
|
||||
%oreon=get_parameters();
|
||||
} else {
|
||||
print "Unable to load oreon perl module\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
use vars qw($PROGNAME);
|
||||
use Getopt::Long;
|
||||
use vars qw($opt_V $opt_h $opt_a $opt_v $opt_C $opt_p $opt_H $opt_n $opt_k $opt_u $opt_x $result @result $opt_c $opt_w $opt_f %process_list %STATUS);
|
||||
|
||||
# Plugin var init
|
||||
|
||||
my($proc, $proc_run);
|
||||
|
||||
$PROGNAME = "check_graph_process";
|
||||
sub print_help ();
|
||||
sub print_usage ();
|
||||
%STATUS=(1=>'running',2=>'runnable',3=>'notRunnable',4=>'invalid');
|
||||
|
||||
Getopt::Long::Configure('bundling');
|
||||
GetOptions
|
||||
("h" => \$opt_h, "help" => \$opt_h,
|
||||
"u=s" => \$opt_u, "username=s" => \$opt_u,
|
||||
"x=s" => \$opt_x, "password=s" => \$opt_x,
|
||||
"k=s" => \$opt_k, "key=s" => \$opt_k,
|
||||
"V" => \$opt_V, "version" => \$opt_V,
|
||||
"n" => \$opt_n, "number" => \$opt_n,
|
||||
"v=s" => \$opt_v, "snmp=s" => \$opt_v,
|
||||
"f" => \$opt_f, "full_pathname" => \$opt_f,
|
||||
"a=s" => \$opt_a, "arguments=s" => \$opt_a,
|
||||
"C=s" => \$opt_C, "community=s" => \$opt_C,
|
||||
"p=s" => \$opt_p, "process=s" => \$opt_p,
|
||||
"H=s" => \$opt_H, "hostname=s" => \$opt_H);
|
||||
|
||||
if ($opt_V) {
|
||||
print_revision($PROGNAME,'$Revision: 1.2 $');
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
if ($opt_h) {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
if (!$opt_H) {
|
||||
print_usage();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
my $snmp = "1";
|
||||
if ($opt_v && $opt_v =~ /^[0-9]$/) {
|
||||
$snmp = $opt_v;
|
||||
}
|
||||
|
||||
if ($snmp eq "3") {
|
||||
if (!$opt_u) {
|
||||
print "Option -u (--username) is required for snmpV3\n";
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
if (!$opt_x && !$opt_k) {
|
||||
print "Option -k (--key) or -x (--password) is required for snmpV3\n";
|
||||
exit $ERRORS{'OK'};
|
||||
}elsif ($opt_x && $opt_k) {
|
||||
print "Only option -k (--key) or -x (--password) is needed for snmpV3\n";
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
}
|
||||
|
||||
if (!$opt_C) {
|
||||
$opt_C = "public";
|
||||
}
|
||||
|
||||
my $process;
|
||||
if(!$opt_p) {
|
||||
print_usage();
|
||||
exit $ERRORS{'OK'};
|
||||
}elsif ($opt_p !~ /([-.A-Za-z0-9]+)/){
|
||||
print_usage();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
$process = $opt_p;
|
||||
|
||||
my $name = $0;
|
||||
$name =~ s/\.pl.*//g;
|
||||
|
||||
# Plugin snmp requests
|
||||
my $OID_SW_RunName = $oreon{MIB2}{SW_RUNNAME};
|
||||
if ($opt_f) {
|
||||
$OID_SW_RunName = $oreon{MIB2}{SW_RUNFULLPATHNAME};
|
||||
}
|
||||
my $OID_SW_Runargs = $oreon{MIB2}{SW_RUNARGS};
|
||||
my $OID_SW_RunIndex =$oreon{MIB2}{SW_RUNINDEX};
|
||||
my $OID_SW_RunStatus =$oreon{MIB2}{SW_RUNSTATUS};
|
||||
|
||||
my ($session, $error);
|
||||
if ($snmp eq "1" || $snmp eq "2") {
|
||||
($session, $error) = Net::SNMP->session(-hostname => $opt_H, -community => $opt_C, -version => $snmp);
|
||||
if (!defined($session)) {
|
||||
print("UNKNOWN: SNMP Session : $error\n");
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
}elsif ($opt_k) {
|
||||
($session, $error) = Net::SNMP->session(-hostname => $opt_H, -version => $snmp, -username => $opt_u, -authkey => $opt_k);
|
||||
if (!defined($session)) {
|
||||
print("UNKNOWN: SNMP Session : $error\n");
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
}elsif ($opt_x) {
|
||||
($session, $error) = Net::SNMP->session(-hostname => $opt_H, -version => $snmp, -username => $opt_u, -authpassword => $opt_x);
|
||||
if (!defined($session)) {
|
||||
print("UNKNOWN: SNMP Session : $error\n");
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
}
|
||||
|
||||
$result = $session->get_table(Baseoid => $OID_SW_RunName);
|
||||
if (!defined($result)) {
|
||||
printf("UNKNOWN: %s.\n", $session->error);
|
||||
$session->close;
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
$proc = 0;
|
||||
foreach my $key (oid_lex_sort(keys %$result)) {
|
||||
my @oid_list = split (/\./,$key);
|
||||
my $args_index = $oid_list[scalar(@oid_list) - 1];
|
||||
if (defined($opt_p) && $opt_p ne ""){
|
||||
if ($$result{$key} eq $opt_p){
|
||||
my $result2 = $session->get_request(-varbindlist => [$OID_SW_Runargs . "." . $args_index]);
|
||||
if (!defined($result2)) {
|
||||
printf("UNKNOWN: %s.\n", $session->error);
|
||||
$session->close;
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
if ($opt_a && $result2->{$OID_SW_Runargs . "." . $args_index} =~ /$opt_a/) {
|
||||
$proc++ ;
|
||||
$process_list{$result->{$key}} = pop (@oid_list) ;
|
||||
}elsif (!$opt_a) {
|
||||
$process_list{$result->{$key}} = pop (@oid_list) ;
|
||||
$proc++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$proc++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!($opt_n))
|
||||
{
|
||||
if ($process_list{$process}) {
|
||||
$result = $session->get_request(-varbindlist => [$OID_SW_RunStatus . "." . $process_list{$process}]);
|
||||
if (!defined($result)) {
|
||||
printf("UNKNOWN: %s.\n", $session->error);
|
||||
$session->close;
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
$proc_run = $result->{$OID_SW_RunStatus . "." . $process_list{$process} };
|
||||
}
|
||||
}
|
||||
if ($opt_n){
|
||||
if ($proc > 0) {
|
||||
print "Processes OK - Number of current processes: $proc|nbproc=$proc\n";
|
||||
exit $ERRORS{'OK'};
|
||||
}else {
|
||||
print "Process CRITICAL - $process not in 'running' state\n";
|
||||
exit $ERRORS{'CRITICAL'};
|
||||
}
|
||||
} else {
|
||||
if ($proc_run){
|
||||
print "Process OK - $process: $STATUS{$proc_run}|procstatus=$proc_run\n";
|
||||
exit $ERRORS{'OK'};
|
||||
} else {
|
||||
print "Process CRITICAL - $process not in 'running' state\n";
|
||||
exit $ERRORS{'CRITICAL'};
|
||||
}
|
||||
}
|
||||
# Plugin return code
|
||||
if ( $opt_n) {
|
||||
if ($proc) {
|
||||
print "Processes OK - Number of current processes: $proc|nbproc=$proc\n";
|
||||
exit $ERRORS{'OK'};
|
||||
|
||||
}else {
|
||||
print "Process CRITICAL - $process not in 'running' state\n";
|
||||
exit $ERRORS{'CRITICAL'};
|
||||
}
|
||||
}else {
|
||||
if ($proc_run){
|
||||
print "Process OK - $process: $STATUS{$proc_run}|procstatus=$proc_run\n";
|
||||
exit $ERRORS{'OK'};
|
||||
} else {
|
||||
print "Process CRITICAL - $process not in 'running' state\n";
|
||||
exit $ERRORS{'CRITICAL'};
|
||||
}
|
||||
}
|
||||
|
||||
sub print_usage () {
|
||||
print "Usage:\n";
|
||||
print "$PROGNAME\n";
|
||||
print " -H (--hostname) Hostname to query - (required)\n";
|
||||
print " -C (--community) SNMP read community (defaults to public,\n";
|
||||
print " used with SNMP v1 and v2c\n";
|
||||
print " -v (--snmp_version) 1 for SNMP v1 (default)\n";
|
||||
print " 2 for SNMP v2c\n";
|
||||
print " -a (--arguments) arguments of process you want to check\n";
|
||||
print " -f (--full_pathname) process with its full path\n";
|
||||
print " -n (--number) Return the number of current running processes. \n";
|
||||
print " -p (--process) Set the process name ex: by default smbd\n";
|
||||
print " -V (--version) Plugin version\n";
|
||||
print " -h (--help) usage help\n";
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print "######################################################\n";
|
||||
print "# Copyright (c) 2004-2007 Oreon-project #\n";
|
||||
print "# Bugs to http://www.oreon-project.org/ #\n";
|
||||
print "######################################################\n";
|
||||
print_usage();
|
||||
print "\n";
|
||||
}
|
||||
|
|
@ -8,8 +8,6 @@
|
|||
# TODO : put $o_delta as an option
|
||||
###############################################################
|
||||
#
|
||||
# help : ./check_snmp_process -h
|
||||
|
||||
############### BASE DIRECTORY FOR TEMP FILE ########
|
||||
my $o_base_dir="/tmp/tmp_Nagios_proc.";
|
||||
my $file_history=200; # number of data to keep in files.
|
|
@ -28,7 +28,7 @@ use strict;
|
|||
use Net::SNMP qw(:snmp);
|
||||
use FindBin;
|
||||
use lib "$FindBin::Bin";
|
||||
use lib "@NAGIOS_PLUGINS@";
|
||||
use lib "/srv/nagios/libexec";
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &support);
|
||||
if (eval "require oreon" ) {
|
||||
use oreon qw(get_parameters);
|
||||
|
@ -48,7 +48,7 @@ my ($hrStorageDescr, $hrStorageAllocationUnits, $hrStorageSize, $hrStorageUsed);
|
|||
my ($AllocationUnits, $Size, $Used);
|
||||
my ($tot, $used, $pourcent, $return_code);
|
||||
|
||||
$PROGNAME = "check_snmp_remote_storage";
|
||||
$PROGNAME = "$0";
|
||||
sub print_help ();
|
||||
sub print_usage ();
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ use strict;
|
|||
use Net::SNMP qw(:snmp oid_lex_sort);
|
||||
use FindBin;
|
||||
use lib "$FindBin::Bin";
|
||||
use lib "@NAGIOS_PLUGINS@";
|
||||
use lib "/srv/nagios/libexec";
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &support);
|
||||
if (eval "require oreon" ) {
|
||||
use oreon qw(get_parameters);
|
||||
|
@ -46,7 +46,7 @@ use vars qw($opt_V $opt_h $opt_v $opt_C $opt_b $opt_k $opt_u $opt_p $opt_H $opt_
|
|||
|
||||
my($proc, $proc_run, @test, $row, @laste_values, $last_check_time, $last_in_bits, $last_out_bits, @last_values, $update_time, $db_file, $in_traffic, $out_traffic, $in_usage, $out_usage);
|
||||
|
||||
$PROGNAME = "check_graph_traffic";
|
||||
$PROGNAME = "$0";
|
||||
sub print_help ();
|
||||
sub print_usage ();
|
||||
|
||||
|
|
|
@ -0,0 +1,181 @@
|
|||
#! /usr/bin/perl -w
|
||||
#
|
||||
# $Id: check_graph_uptime.pl,v 1.2 2005/07/27 22:21:49 wistof Exp $
|
||||
#
|
||||
# This plugin is developped under GPL Licence:
|
||||
# http://www.fsf.org/licenses/gpl.txt
|
||||
|
||||
# Developped by Linagora SA: http://www.linagora.com
|
||||
|
||||
# Modified for Oreon Project by : Mathieu Chateau - Christophe Coraboeuf
|
||||
# Modified For Oreon compatibility by Julien Mathis For Merethis
|
||||
#
|
||||
# The Software is provided to you AS IS and WITH ALL FAULTS.
|
||||
# LINAGORA makes no representation and gives no warranty whatsoever,
|
||||
# whether express or implied, and without limitation, with regard to the quality,
|
||||
# safety, contents, performance, merchantability, non-infringement or suitability for
|
||||
# any particular or intended purpose of the Software found on the LINAGORA web site.
|
||||
# In no event will LINAGORA be liable for any direct, indirect, punitive, special,
|
||||
# incidental or consequential damages however they may arise and even if LINAGORA has
|
||||
# been previously advised of the possibility of such damages.
|
||||
|
||||
# based on "graph plugins" developped by Oreon Team. See http://www.oreon.org.
|
||||
##
|
||||
## Plugin init
|
||||
##
|
||||
use strict;
|
||||
use Net::SNMP qw(:snmp);
|
||||
use FindBin;
|
||||
use lib "$FindBin::Bin";
|
||||
use lib "/srv/nagios/libexec";
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &support);
|
||||
|
||||
if (eval "require oreon" ) {
|
||||
use oreon qw(get_parameters);
|
||||
use vars qw($VERSION %oreon);
|
||||
%oreon=get_parameters();
|
||||
} else {
|
||||
print "Unable to load oreon perl module\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
use vars qw($PROGNAME);
|
||||
use Getopt::Long;
|
||||
use vars qw($opt_h $opt_V $opt_H $opt_C $opt_v $opt_d $day);
|
||||
|
||||
$PROGNAME = $0;
|
||||
sub print_help ();
|
||||
sub print_usage ();
|
||||
|
||||
Getopt::Long::Configure('bundling');
|
||||
GetOptions
|
||||
("h" => \$opt_h, "help" => \$opt_h,
|
||||
"V" => \$opt_V, "version" => \$opt_V,
|
||||
"v=s" => \$opt_v, "snmp=s" => \$opt_v,
|
||||
"C=s" => \$opt_C, "community=s" => \$opt_C,
|
||||
"d" => \$opt_d, "day" => \$opt_d,
|
||||
"H=s" => \$opt_H, "hostname=s" => \$opt_H);
|
||||
|
||||
if ($opt_V) {
|
||||
print_revision($PROGNAME,'$Revision: 1.2 $');
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
if ($opt_h) {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
$opt_H = shift unless ($opt_H);
|
||||
(print_usage() && exit $ERRORS{'OK'}) unless ($opt_H);
|
||||
|
||||
|
||||
($opt_v) || ($opt_v = shift) || ($opt_v = "1");
|
||||
my $snmp = $1 if ($opt_v =~ /(\d)/);
|
||||
|
||||
($opt_C) || ($opt_C = shift) || ($opt_C = "public");
|
||||
|
||||
my $start=time;
|
||||
my $name = $0;
|
||||
$name =~ s/\.pl.*//g;
|
||||
my $day = 0;
|
||||
|
||||
##
|
||||
## Plugin snmp requests
|
||||
##
|
||||
|
||||
my $OID_OBJECTID =$oreon{MIB2}{OBJECTID};
|
||||
my $OID_UPTIME_WINDOWS =$oreon{MIB2}{UPTIME_WINDOWS};
|
||||
my $OID_UPTIME_OTHER =$oreon{MIB2}{UPTIME_OTHER};
|
||||
|
||||
# create a SNMP session
|
||||
my ( $session, $error ) = Net::SNMP->session(-hostname => $opt_H,-community => $opt_C, -version => $snmp);
|
||||
if ( !defined($session) ) {
|
||||
print("CRITICAL: $error");
|
||||
exit $ERRORS{'CRITICAL'};
|
||||
}
|
||||
|
||||
my $result = $session->get_request(
|
||||
-varbindlist => [$OID_OBJECTID]
|
||||
);
|
||||
if (!defined($result)) {
|
||||
printf("UNKNOWN: %s.\n", $session->error);
|
||||
$session->close;
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
my $return_result = $result->{$OID_OBJECTID};
|
||||
my $OID = "";
|
||||
if ($return_result =~ /.*Windows.*/i ) {
|
||||
$OID = $OID_UPTIME_WINDOWS;
|
||||
} else {
|
||||
$OID = $OID_UPTIME_OTHER;
|
||||
}
|
||||
|
||||
$result = $session->get_request(
|
||||
-varbindlist => [$OID]
|
||||
);
|
||||
if (!defined($result)) {
|
||||
printf("UNKNOWN: %s.\n", $session->error);
|
||||
$session->close;
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
my $un = 0;
|
||||
|
||||
$return_result = $result->{$OID};
|
||||
if ( $return_result =~ m/(\d*) day[s]?,\s*(\d*):(\d*):(\d*).(\d*)/ ) {
|
||||
$un = $5 + $4 * 100 + $3 * 100 * 60 + $2 * 100 * 60 * 60 + $1 * 100 * 60 * 60 * 24;
|
||||
$day = $1;
|
||||
}
|
||||
|
||||
if ( $return_result =~ m/(\d*) hour.*(\d*):(\d*).(\d*)/ ) {
|
||||
$un = $4 + $3 * 100 + $3 * 100 * 60 + $1 * 100 * 60 * 60 ;
|
||||
}
|
||||
|
||||
if ($opt_d) {
|
||||
$un = $day;
|
||||
}
|
||||
|
||||
#print "un : $un\n";
|
||||
|
||||
##
|
||||
## Plugin return code
|
||||
##
|
||||
|
||||
if ($un || ( $un == 0) ){
|
||||
if ($opt_d) {
|
||||
print "OK - Uptime (in day): $un|uptime=".$un."hs\n";
|
||||
} else {
|
||||
print "OK - Uptime (in hundredths of a second): $un|uptime=".$un."hs\n";
|
||||
}
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
else{
|
||||
print "CRITICAL Host unavailable\n";
|
||||
exit $ERRORS{'CRITICAL'};
|
||||
}
|
||||
|
||||
|
||||
sub print_usage () {
|
||||
print "\nUsage:\n";
|
||||
print "$PROGNAME\n";
|
||||
print " -H (--hostname) Hostname to query - (required)\n";
|
||||
print " -C (--community) SNMP read community (defaults to public,\n";
|
||||
print " used with SNMP v1 and v2c\n";
|
||||
print " -v (--snmp_version) 1 for SNMP v1 (default)\n";
|
||||
print " 2 for SNMP v2c\n";
|
||||
print " -d (--day) Uptime in day\n";
|
||||
print " -V (--version) Plugin version\n";
|
||||
print " -h (--help) usage help\n";
|
||||
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print "Copyright (c) 2005 Linagora\n";
|
||||
print "Modified by Merethis \n";
|
||||
print "Bugs to http://www.linagora.com/\n";
|
||||
print "\n";
|
||||
print_usage();
|
||||
print "\n";
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
#! /usr/bin/perl -w
|
||||
# $Id: check_graph_tcp.pl,v 1.2 2005/08/01 17:50:50 gollum123 Exp $
|
||||
#
|
||||
# Oreon's plugins are developped with GPL Licence :
|
||||
# http://www.fsf.org/licenses/gpl.txt
|
||||
# Developped by : Julien Mathis - Romain Le Merlus
|
||||
#
|
||||
# Modified for Oreon Project by : Mathieu Chateau - Christophe Coraboeuf
|
||||
# Modified By Julien Mathis - Sugumaran Mathavarajan For Merethis Company
|
||||
#
|
||||
# The Software is provided to you AS IS and WITH ALL FAULTS.
|
||||
# OREON makes no representation and gives no warranty whatsoever,
|
||||
# whether express or implied, and without limitation, with regard to the quality,
|
||||
# safety, contents, performance, merchantability, non-infringement or suitability for
|
||||
# any particular or intended purpose of the Software found on the OREON web site.
|
||||
# In no event will OREON be liable for any direct, indirect, punitive, special,
|
||||
# incidental or consequential damages however they may arise and even if OREON has
|
||||
# been previously advised of the possibility of such damages.
|
||||
|
||||
use strict;
|
||||
use FindBin;
|
||||
use lib "$FindBin::Bin";
|
||||
#use lib "/srv/nagios/libexec";
|
||||
use lib "/usr/lib/nagios/plugins";
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &support);
|
||||
|
||||
if (eval "require oreon" ) {
|
||||
use oreon qw(get_parameters);
|
||||
use vars qw($VERSION %oreon);
|
||||
%oreon=get_parameters();
|
||||
} else {
|
||||
print "Unable to load oreon perl module\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
use Getopt::Long;
|
||||
use vars qw($opt_V $opt_h $opt_p $opt_c $opt_w $opt_H);
|
||||
use vars qw($PROGNAME);
|
||||
|
||||
my $pathtolibexectcp = $oreon{GLOBAL}{NAGIOS_LIBEXEC}."check_tcp";
|
||||
|
||||
sub print_help ();
|
||||
sub print_usage ();
|
||||
$PROGNAME = "$0";
|
||||
|
||||
#
|
||||
# get options
|
||||
#
|
||||
|
||||
Getopt::Long::Configure('bundling');
|
||||
GetOptions
|
||||
("h|help" => \$opt_h,
|
||||
"V|version" => \$opt_V,
|
||||
"H|hostname=s" => \$opt_H,
|
||||
"p|port=s" => \$opt_p,
|
||||
"w|warning=s" => \$opt_w,
|
||||
"c|critical=s" => \$opt_c);
|
||||
|
||||
if (defined($opt_h)) {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
$opt_H = shift unless ($opt_H);
|
||||
(print_usage() && exit $ERRORS{'OK'}) unless ($opt_H);
|
||||
|
||||
$opt_p = shift unless ($opt_p);
|
||||
(print_usage() && exit $ERRORS{'OK'}) unless ($opt_p);
|
||||
|
||||
|
||||
##################################################
|
||||
#### Create Command line
|
||||
#
|
||||
|
||||
my $args_check_tcp = "-H $opt_H -p $opt_p";
|
||||
$args_check_tcp .= " -w $opt_w -c $opt_c" if ($opt_w && $opt_c);
|
||||
|
||||
my $start=time;
|
||||
|
||||
|
||||
my $result = `$pathtolibexectcp $args_check_tcp`;
|
||||
my $return_code = $? / 256;
|
||||
$_ = $result;
|
||||
m/(\d*\.\d*) second/;
|
||||
my $time = $1;
|
||||
|
||||
print "$result";
|
||||
exit $return_code;
|
||||
|
||||
sub print_usage () {
|
||||
print "\nUsage:\n";
|
||||
print $0."\n";
|
||||
print "\t-H (--hostname)\t\tHostname to query (required)\n";
|
||||
print "\t-p, --port\t\tPort number (required)\n";
|
||||
print "\t-w, --warning\t\tResponse time to result in warning status (seconds) - optional\n";
|
||||
print "\t-c, --critical\t\tResponse time to result in critical status (seconds) - optional\n";
|
||||
print "\t-V (--version)\t\tVieuw plugin version\n";
|
||||
print "\t-h (--help)\t\tusage help\n";
|
||||
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print "################################################\n";
|
||||
print "# Bugs to http://bugs.oreon-project.org/ #\n";
|
||||
print "################################################\n";
|
||||
print "\n";
|
||||
print_usage();
|
||||
print "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
###########################################################################
|
||||
#
|
||||
# snmptrapd.conf
|
||||
#
|
||||
# - created by the snmpconf configuration program
|
||||
#
|
||||
###########################################################################
|
||||
# SECTION: Trap Handlers
|
||||
#
|
||||
# Here we define what programs are run when a trap is
|
||||
# received by the trap receiver.
|
||||
|
||||
# traphandle: When traps are received, a program can be run.
|
||||
# When traps are received, the list of configured trap
|
||||
# handles is consulted and any configured program is run.
|
||||
# If no handler is found, any handler with "default" as the
|
||||
# traphandle type is run instead. The information contained
|
||||
# in trap is passed to the program via standard input (see
|
||||
# the snmptrapd.conf manual page for details).
|
||||
#
|
||||
# arguments: oid|"default" program args
|
||||
|
||||
traphandle default /usr/sbin/snmptt --ini=/etc/snmp/oreon_traps/snmptt.ini
|
||||
|
||||
|
||||
|
||||
###########################################################################
|
||||
# SECTION: Runtime options
|
||||
#
|
||||
# Runtime options
|
||||
|
||||
# donotfork: Do not fork from the shell
|
||||
# arguments: (1|yes|true|0|no|false)
|
||||
|
||||
donotfork 1
|
||||
|
||||
# pidfile: Store Process ID in file
|
||||
# arguments: PID file
|
||||
|
||||
pidfile /var/run/snmptrapd.pid
|
||||
|
||||
|
||||
|
||||
###########################################################################
|
||||
# SECTION: Logging options
|
||||
#
|
||||
# Logging options
|
||||
|
||||
# donotlogtraps: Prevent traps from being logged
|
||||
# Useful when you only want to use traphandles
|
||||
# arguments: (1|yes|true|0|no|false)
|
||||
|
||||
donotlogtraps 0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
###########################################################################
|
||||
# SECTION: Authentication options
|
||||
#
|
||||
# Authentication options
|
||||
|
||||
# ignoreauthfailure: Ignore authentication failure traps
|
||||
# arguments: (1|yes|true|0|no|false)
|
||||
|
||||
ignoreauthfailure 0
|
||||
ignoreauthfailure no
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Unknown directives read in from other files by snmpconf
|
||||
#
|
||||
disableAuthorization yes
|
|
@ -0,0 +1,489 @@
|
|||
#
|
||||
# SNMPTT v1.0 Configuration File
|
||||
#
|
||||
# Linux / Unix
|
||||
#
|
||||
|
||||
[General]
|
||||
# Set to either 'standalone' or 'daemon'
|
||||
# standalone: snmptt called from snmptrapd.conf
|
||||
# daemon: snmptrapd.conf calls snmptthandler
|
||||
# Ignored by Windows. See documentation
|
||||
mode = standalone
|
||||
|
||||
# Set to 1 to allow multiple trap definitions to be executed for the same trap.
|
||||
# Set to 0 to have it stop after the first match.
|
||||
# Note: Wildcard matches are only matched if there are NO exact matches. This takes
|
||||
# into consideration the NODES list. Therefore, if there is a matching trap, but
|
||||
# the NODES list prevents it from being considered a match, the wildcard entry will
|
||||
# only be used if there are no other exact matches.
|
||||
multiple_event = 1
|
||||
|
||||
# SNMPTRAPD passes the IP address of device sending the trap, and the IP address of the
|
||||
# actual SNMP agent. These addresses could differ if the trap was sent on behalf of another
|
||||
# device (relay, proxy etc).
|
||||
# If DNS is enabled, the agent IP address is converted to a host name using a DNS lookup
|
||||
# (which includes the local hosts file, depending on how the OS is configured). This name
|
||||
# will be used for: NODES entry matches, hostname field in logged traps (file / database),
|
||||
# and the $A variable. Host names on the NODES line will be resolved and the IP address
|
||||
# will then be used for comparing.
|
||||
# Set to 0 to disable DNS resolution
|
||||
# Set to 1 to enable DNS resolution
|
||||
dns_enable = 0
|
||||
|
||||
# Set to 0 to enable the use of FQDN (Fully Qualified Domain Names). If a host name is
|
||||
# passed to SNMPTT that contains a domain name, it will not be altered in any way by
|
||||
# SNMPTT. This also affects resolve_value_ip_addresses.
|
||||
# Set to 1 to have SNMPTT strip the domain name from the host name passed to it. For
|
||||
# example, server01.domain.com would be changed to server01
|
||||
# Set to 2 to have SNMPTT strip the domain name from the host name passed to it
|
||||
# based on the list of domains in strip_domain_list
|
||||
strip_domain = 0
|
||||
|
||||
# List of domain names that should be stripped when strip_domain is set to 2.
|
||||
# List can contain one or more domains. For example, if the FQDN of a host is
|
||||
# server01.city.domain.com and the list contains domain.com, the 'host' will be
|
||||
# set as server01.city.
|
||||
strip_domain_list = <<END
|
||||
merethis.net
|
||||
END
|
||||
|
||||
# Configures how IP addresses contained in the VALUE of the variable bindings are handled.
|
||||
# This only applies to the values for $n, $+n, $-n, $vn, $+*, $-*.
|
||||
# Set to 0 to disable resolving ip address to host names
|
||||
# Set to 1 to enable resolving ip address to host names
|
||||
# Note: net_snmp_perl_enable *must* be enabled. The strip_domain settings influence the
|
||||
# format of the resolved host name. DNS must be enabled (dns_enable)
|
||||
resolve_value_ip_addresses = 0
|
||||
|
||||
# Set to 1 to enable the use of the Perl module from the UCD-SNMP / NET-SNMP package.
|
||||
# This is required for $v variable substitution to work, and also for some other options
|
||||
# that are enabled in this .ini file.
|
||||
# Set to 0 to disable the use of the Perl module from the UCD-SNMP / NET-SNMP package.
|
||||
# Note: Enabling this with stand-alone mode can cause SNMPTT to run very slowly due to
|
||||
# the loading of the MIBS at startup.
|
||||
net_snmp_perl_enable = 1
|
||||
|
||||
# This sets the best_guess parameter used by the UCD-SNMP / NET-SNMP Perl module for
|
||||
# translating symbolic nams to OIDs and vice versa.
|
||||
# For UCD-SNMP, and Net-SNMP 5.0.8 and previous versions, set this value to 0.
|
||||
# For Net-SNMP 5.0.9, or any Net-SNMP with patch 722075 applied, set this value to 2.
|
||||
# A value of 2 is equivalent to -IR on Net-SNMP command line utilities.
|
||||
# UCD-SNMP and Net-SNMP 5.0.8 and previous may not be able to translate certain formats of
|
||||
# symbolic names such as RFC1213-MIB::sysDescr. Net-SNMP 5.0.9 or patch 722075 will allow
|
||||
# all possibilities to be translated. See the FAQ section in the README for more info
|
||||
net_snmp_perl_best_guess = 0
|
||||
|
||||
# Configures how the OID of the received trap is handled when outputting to a log file /
|
||||
# database. It does NOT apply to the $O variable.
|
||||
# Set to 0 to use the default of numerical OID
|
||||
# Set to 1 to translate the trap OID to short text (symbolic form) (eg: linkUp)
|
||||
# Set to 2 to translate the trap OID to short text with module name (eg: IF-MIB::linkUp)
|
||||
# Set to 3 to translate the trap OID to long text (eg: iso...snmpTraps.linkUp)
|
||||
# Set to 4 to translate the trap OID to long text with module name (eg:
|
||||
# IF-MIB::iso...snmpTraps.linkUp)
|
||||
# Note: -The output of the long format will vary depending on the version of Net-SNMP you
|
||||
# are using.
|
||||
# -net_snmp_perl_enable *must* be enabled
|
||||
# -If using database logging, ensure the trapoid column is large enough to hold the
|
||||
# entire line
|
||||
translate_log_trap_oid = 0
|
||||
|
||||
# Configures how OIDs contained in the VALUE of the variable bindings are handled.
|
||||
# This only applies to the values for $n, $+n, $-n, $vn, $+*, $-*. For substitutions
|
||||
# that include variable NAMES ($+n etc), only the variable VALUE is affected.
|
||||
# Set to 0 to disable translating OID values to text (symbolic form)
|
||||
# Set to 1 to translate OID values to short text (symbolic form) (eg: BuildingAlarm)
|
||||
# Set to 2 to translate OID values to short text with module name (eg: UPS-MIB::BuildingAlarm)
|
||||
# Set to 3 to translate OID values to long text (eg: iso...upsAlarm.BuildingAlarm)
|
||||
# Set to 4 to translate OID values to long text with module name (eg:
|
||||
# UPS-MIB::iso...upsAlarm.BuildingAlarm)
|
||||
# For example, if the value contained: 'A UPS Alarm (.1.3.6.1.4.1.534.1.7.12) has cleared.',
|
||||
# it could be translated to: 'A UPS Alarm (UPS-MIB::BuildingAlarm) has cleared.'
|
||||
# Note: net_snmp_perl_enable *must* be enabled
|
||||
translate_value_oids = 1
|
||||
|
||||
# Configures how the symbolic enterprise OID will be displayed for $E.
|
||||
# Set to 1, 2, 3 or 4. See translate_value_oids options 1,2,3 and 4.
|
||||
# Note: net_snmp_perl_enable *must* be enabled
|
||||
translate_enterprise_oid_format = 1
|
||||
|
||||
# Configures how the symbolic trap OID will be displayed for $O.
|
||||
# Set to 1, 2, 3 or 4. See translate_value_oids options 1,2,3 and 4.
|
||||
# Note: net_snmp_perl_enable *must* be enabled
|
||||
translate_trap_oid_format = 1
|
||||
|
||||
# Configures how the symbolic trap OID will be displayed for $v, $-n, $+n, $-* and $+*.
|
||||
# Set to 1, 2, 3 or 4. See translate_value_oids options 1,2,3 and 4.
|
||||
# Note: net_snmp_perl_enable *must* be enabled
|
||||
translate_varname_oid_format = 1
|
||||
|
||||
# Set to 0 to disable converting INTEGER values to enumeration tags as defined in the
|
||||
# MIB files
|
||||
# Set to 1 to enable converting INTEGER values to enumeration tags as defined in the
|
||||
# MIB files
|
||||
# Example: moverDoorState:open instead of moverDoorState:2
|
||||
# Note: net_snmp_perl_enable *must* be enabled
|
||||
translate_integers = 1
|
||||
|
||||
# Allows you to set the MIBS environment variable used by SNMPTT
|
||||
# Leave blank or comment out to have the systems enviroment settings used
|
||||
# To have all MIBS processed, set to ALL
|
||||
# See the snmp.conf manual page for more info
|
||||
#mibs_environment = ALL
|
||||
|
||||
# Set what is used to separate variables when wildcards are expanded on the FORMAT /
|
||||
# EXEC line. Defaults to a space. Value MUST be within quotes. Can contain 1 or
|
||||
# more characters
|
||||
wildcard_expansion_separator = " "
|
||||
|
||||
# Set to 1 to allow unsafe REGEX code to be executed.
|
||||
# Set to 0 to prevent unsafe REGEX code from being executed (default).
|
||||
# Enabling unsafe REGEX code will allow variable interopolation and the use of the e
|
||||
# modifier to allow statements such as substitution with captures such
|
||||
# as: (one (two) three)(five $1 six)
|
||||
# which outputs: five two six
|
||||
# or: (one (two) three)("five ".length($1)." six")e
|
||||
# which outputs: five 3 six
|
||||
#
|
||||
# This is considered unsafe because the contents of the regular expression
|
||||
# (right) is executed (eval) by Perl which *could contain unsafe code*.
|
||||
# BE SURE THAT THE SNMPTT CONFIGURATION FILES ARE SECURE!
|
||||
allow_unsafe_regex = 0
|
||||
|
||||
# Set to 1 to have the backslash (escape) removed from quotes passed from
|
||||
# snmptrapd. For example, \" would be changed to just "
|
||||
# Set to 0 to disable
|
||||
remove_backslash_from_quotes = 0
|
||||
|
||||
# Set to 1 to have NODES files loaded each time a trap is processed.
|
||||
# Set to 0 to have all NODES files loaded when the snmptt.conf files are loaded.
|
||||
# If NODES files are used (files that contain lists of NODES), then setting to 1
|
||||
# will cause the list to be loaded each time an EVENT is processed that uses
|
||||
# NODES files. This will allow the NODES file to be modified while SNMPTT is
|
||||
# running but can result in many file reads depending on the number of traps
|
||||
# received. Defaults to 0
|
||||
dynamic_nodes = 0
|
||||
|
||||
# This option allows you to use the $D substitution variable to include the
|
||||
# description text from the SNMPTT.CONF or MIB files.
|
||||
# Set to 0 to disable the $D substitution variable. If $D is used, nothing
|
||||
# will be outputted.
|
||||
# Set to 1 to enable the $D substitution variable and have it use the
|
||||
# descriptions stored in the SNMPTT .conf files. Enabling this option can
|
||||
# greatly increase the amount of memory used by SNMPTT.
|
||||
# Set to 2 to enable the $D substitution variable and have it use the
|
||||
# description from the MIB files. This enables the UCD-SNMP / NET-SNMP Perl
|
||||
# module save_descriptions variable. Enabling this option can greatly
|
||||
# increase the amount of memory used by the Net-SNMP SNMP Perl module, which
|
||||
# will result in an increase of memory usage by SNMPTT.
|
||||
description_mode = 0
|
||||
|
||||
# Set to 1 to remove any white space at the start of each line from the MIB
|
||||
# or SNMPTT.CONF description when description_mode is set to 1 or 2.
|
||||
description_clean = 1
|
||||
|
||||
[DaemonMode]
|
||||
# Set to 1 to have snmptt fork to the background when run in daemon mode
|
||||
# Ignored by Windows. See documentation
|
||||
daemon_fork = 1
|
||||
|
||||
# Set to the numerical user id (eg: 500) or textual user id (eg: snmptt)
|
||||
# that snmptt should change to when running in daemon mode. Leave blank
|
||||
# to disable. The user used should have read/write access to all log
|
||||
# files, the spool folder, and read access to the configuration files.
|
||||
daemon_uid = root
|
||||
|
||||
# Directory to read received traps from. Ex: /var/spool/snmptt/
|
||||
# Don't forget the trailing slash!
|
||||
spool_directory = /var/spool/snmptt/
|
||||
|
||||
# Amount of time in seconds to sleep between processing spool files
|
||||
sleep = 2
|
||||
|
||||
# Set to 1 to have SNMPTT use the time that the trap was processed by SNMPTTHANDLER
|
||||
# Set to 0 to have SNMPTT use the time the trap was processed. Note: Using 0 can
|
||||
# result in the time being off by the number of seconds used for 'sleep'
|
||||
use_trap_time = 1
|
||||
|
||||
# Set to 0 to have SNMPTT erase the spooled trap file after it attempts to process
|
||||
# the trap even if it did not successfully log the trap to any of the log systems.
|
||||
# Set to 1 to have SNMPTT erase the spooled trap file only after it successfully
|
||||
# logs to at least ONE log system.
|
||||
# Set to 2 to have SNMPTT erase the spooled trap file only after it successfully
|
||||
# logs to ALL of the enabled log systems. Warning: If multiple log systems are
|
||||
# enabled and only one fails, the other log system will continuously be logged to
|
||||
# until ALL of the log systems function.
|
||||
# The recommended setting is 1 with only one log system enabled.
|
||||
keep_unlogged_traps = 1
|
||||
|
||||
[Logging]
|
||||
# Set to 1 to enable messages to be sent to standard output, or 0 to disable.
|
||||
# Would normally be disabled unless you are piping this program to another
|
||||
stdout_enable = 0
|
||||
|
||||
# Set to 1 to enable text logging. Make sure you specify a logfile location
|
||||
log_enable = 1
|
||||
|
||||
# Log file location. The COMPLETE path and filename. Ex: '/var/log/snmptt.log'
|
||||
log_file = /var/log/snmptt.log
|
||||
|
||||
# Set to 1 to enable logging of unknown traps. This should normally be left off
|
||||
# as the file could grow large quickly. Used primarily for troubleshooting. If
|
||||
# you have defined a trap in snmptt.conf, but it is not executing, enable this to
|
||||
# see if it is being considered an unknown trap due to an incorrect entry or
|
||||
# simply missing from the snmptt.conf file.
|
||||
# Unknown traps can be logged either a text file, a SQL table or both.
|
||||
# See SQL section to define SQL table to log unknown traps to.
|
||||
unknown_trap_log_enable = 1
|
||||
|
||||
# Unknown trap log file location. The COMPLETE path and filename.
|
||||
# Ex: '/var/log/snmpttunknown.log'
|
||||
# Leave blank to disable logging to text file if logging to SQL is enabled
|
||||
# for unknown traps
|
||||
unknown_trap_log_file = /var/log/snmpttunknown.log
|
||||
|
||||
# How often in seconds statistics should be logged to syslog or the event log.
|
||||
# Set to 0 to disable
|
||||
# 1 hour = 216000
|
||||
# 12 hours = 2592000
|
||||
# 24 hours = 5184000
|
||||
statistics_interval = 0
|
||||
|
||||
# Set to 1 to enable logging of *TRAPS* to syslog. If you do not have the Sys::Syslog
|
||||
# module then disable this. Windows users should disable this.
|
||||
syslog_enable = 0
|
||||
|
||||
# Syslog facility to use for logging of *TRAPS*. For example: 'local0'
|
||||
syslog_facility = local0
|
||||
|
||||
# Set the syslog level for *TRAPS* based on the severity level of the trap
|
||||
# as defined in the snmptt.conf file. Values must be one per line between
|
||||
# the syslog_level_* and END lines, and are not case sensitive. For example:
|
||||
# Warning
|
||||
# Critical
|
||||
# Duplicate definitions will use the definition with the higher severity.
|
||||
syslog_level_debug = <<END
|
||||
END
|
||||
syslog_level_info = <<END
|
||||
END
|
||||
syslog_level_notice = <<END
|
||||
END
|
||||
syslog_level_warning = <<END
|
||||
END
|
||||
syslog_level_err = <<END
|
||||
END
|
||||
syslog_level_crit = <<END
|
||||
END
|
||||
syslog_level_alert = <<END
|
||||
END
|
||||
|
||||
# Syslog default level to use for logging of *TRAPS*. For example: warning
|
||||
# Valid values: emerg, alert, crit, err, warning, notice, info, debug
|
||||
syslog_level = info
|
||||
|
||||
# Set to 1 to enable logging of *SNMPTT system errors* to syslog. If you do not have the
|
||||
# Sys::Syslog module then disable this. Windows users should disable this.
|
||||
syslog_system_enable = 1
|
||||
|
||||
# Syslog facility to use for logging of *SNMPTT system errors*. For example: 'local0'
|
||||
syslog_system_facility = local0
|
||||
|
||||
# Syslog level to use for logging of *SNMPTT system errors*.. For example: 'warning'
|
||||
# Valid values: emerg, alert, crit, err, warning, notice, info, debug
|
||||
syslog_system_level = err
|
||||
|
||||
[SQL]
|
||||
# Determines if the enterprise column contains the numeric OID or symbolic OID
|
||||
# Set to 0 for numeric OID
|
||||
# Set to 1 for symbolic OID
|
||||
# Uses translate_enterprise_oid_format to determine format
|
||||
# Note: net_snmp_perl_enable *must* be enabled
|
||||
db_translate_enterprise = 0
|
||||
|
||||
# FORMAT line to use for unknown traps. If not defined, defaults to $-*.
|
||||
db_unknown_trap_format = '$-*'
|
||||
|
||||
# MySQL: Set to 1 to enable logging to a MySQL database via DBI (Linux / Windows)
|
||||
# This requires DBI:: and DBD::mysql
|
||||
mysql_dbi_enable = 0
|
||||
|
||||
# MySQL: Hostname of database server (optional - default localhost)
|
||||
mysql_dbi_host = localhost
|
||||
|
||||
# MySQL: Port number of database server (optional - default 3306)
|
||||
mysql_dbi_port = 3306
|
||||
|
||||
# MySQL: Database to use
|
||||
mysql_dbi_database = snmptt
|
||||
|
||||
# MySQL: Table to use
|
||||
mysql_dbi_table = snmptt
|
||||
|
||||
# MySQL: Table to use for unknown traps
|
||||
# Leave blank to disable logging of unknown traps to MySQL
|
||||
# Note: unknown_trap_log_enable must be enabled.
|
||||
mysql_dbi_table_unknown = snmptt_unknown
|
||||
|
||||
# MySQL: Username to use
|
||||
mysql_dbi_username = snmpttuser
|
||||
|
||||
# MySQL: Password to use
|
||||
mysql_dbi_password = password
|
||||
|
||||
# MySQL: Whether or not to 'ping' the database before attempting an INSERT
|
||||
# to ensure the connection is still valid. If *any* error is generate by
|
||||
# the ping such as 'Unable to connect to database', it will attempt to
|
||||
# re-create the database connection.
|
||||
# Set to 0 to disable
|
||||
# Set to 1 to enable
|
||||
# Note: This has no effect on mysql_ping_interval.
|
||||
mysql_ping_on_insert = 1
|
||||
|
||||
# MySQL: How often in seconds the database should be 'pinged' to ensure the
|
||||
# connection is still valid. If *any* error is generate by the ping such as
|
||||
# 'Unable to connect to database', it will attempt to re-create the database
|
||||
# connection. Set to 0 to disable pinging.
|
||||
# Note: This has no effect on mysql_ping_on_insert.
|
||||
# disabled = 0
|
||||
# 5 minutes = 300
|
||||
# 15 minutes = 900
|
||||
# 30 minutes = 1800
|
||||
mysql_ping_interval = 300
|
||||
|
||||
# PostgreSQL: Set to 1 to enable logging to a PostgreSQL database via DBI (Linux / Windows)
|
||||
# This requires DBI:: and DBD::PgPP
|
||||
postgresql_dbi_enable = 0
|
||||
|
||||
# Set to 0 to use the DBD::PgPP module
|
||||
# Set to 1 to use the DBD::Pg module
|
||||
postgresql_dbi_module = 0
|
||||
|
||||
# Set to 0 to disable host and port network support
|
||||
# Set to 1 to enable host and port network support
|
||||
# If set to 1, ensure PostgreSQL is configured to allow connections via TCPIP by setting
|
||||
# tcpip_socket = true in the $PGDATA/postgresql.conf file, and adding the ip address of
|
||||
# the SNMPTT server to $PGDATApg_hba.conf. The common location for the config files for
|
||||
# RPM installations of PostgreSQL is /var/lib/pgsql/data.
|
||||
postgresql_dbi_hostport_enable = 0
|
||||
|
||||
# PostgreSQL: Hostname of database server (optional - default localhost)
|
||||
postgresql_dbi_host = localhost
|
||||
|
||||
# PostgreSQL: Port number of database server (optional - default 5432)
|
||||
postgresql_dbi_port = 5432
|
||||
|
||||
# PostgreSQL: Database to use
|
||||
postgresql_dbi_database = snmptt
|
||||
|
||||
# PostgreSQL: Table to use for unknown traps
|
||||
# Leave blank to disable logging of unknown traps to PostgreSQL
|
||||
# Note: unknown_trap_log_enable must be enabled.
|
||||
postgresql_dbi_table_unknown = snmptt_unknown
|
||||
|
||||
# PostgreSQL: Table to use
|
||||
postgresql_dbi_table = snmptt
|
||||
|
||||
# PostgreSQL: Username to use
|
||||
postgresql_dbi_username = snmpttuser
|
||||
|
||||
# PostgreSQL: Password to use
|
||||
postgresql_dbi_password = password
|
||||
|
||||
# PostgreSQL: Whether or not to 'ping' the database before attempting an INSERT
|
||||
# to ensure the connection is still valid. If *any* error is generate by
|
||||
# the ping such as 'Unable to connect to database', it will attempt to
|
||||
# re-create the database connection.
|
||||
# Set to 0 to disable
|
||||
# Set to 1 to enable
|
||||
# Note: This has no effect on postgresqll_ping_interval.
|
||||
postgresql_ping_on_insert = 1
|
||||
|
||||
# PostgreSQL: How often in seconds the database should be 'pinged' to ensure the
|
||||
# connection is still valid. If *any* error is generate by the ping such as
|
||||
# 'Unable to connect to database', it will attempt to re-create the database
|
||||
# connection. Set to 0 to disable pinging.
|
||||
# Note: This has no effect on postgresql_ping_on_insert.
|
||||
# disabled = 0
|
||||
# 5 minutes = 300
|
||||
# 15 minutes = 900
|
||||
# 30 minutes = 1800
|
||||
postgresql_ping_interval = 300
|
||||
|
||||
# ODBC: Set to 1 to enable logging to a database via ODBC using DBD::ODBC.
|
||||
# This requires both DBI:: and DBD::ODBC
|
||||
dbd_odbc_enable = 0
|
||||
|
||||
# DBD:ODBC: Database to use
|
||||
dbd_odbc_dsn = snmptt
|
||||
|
||||
# DBD:ODBC: Table to use
|
||||
dbd_odbc_table = snmptt
|
||||
|
||||
# DBD:ODBC: Table to use for unknown traps
|
||||
# Leave blank to disable logging of unknown traps to DBD:ODBC
|
||||
# Note: unknown_trap_log_enable must be enabled.
|
||||
dbd_odbc_table_unknown = snmptt_unknown
|
||||
|
||||
# DBD:ODBC: Username to use
|
||||
dbd_odbc_username = snmptt
|
||||
|
||||
# DBD:DBC:: Password to use
|
||||
dbd_odbc_password = password
|
||||
|
||||
|
||||
# DBD:ODBC: Whether or not to 'ping' the database before attempting an INSERT
|
||||
# to ensure the connection is still valid. If *any* error is generate by
|
||||
# the ping such as 'Unable to connect to database', it will attempt to
|
||||
# re-create the database connection.
|
||||
# Set to 0 to disable
|
||||
# Set to 1 to enable
|
||||
# Note: This has no effect on dbd_odbc_ping_interval.
|
||||
dbd_odbc_ping_on_insert = 1
|
||||
|
||||
# DBD:ODBC:: How often in seconds the database should be 'pinged' to ensure the
|
||||
# connection is still valid. If *any* error is generate by the ping such as
|
||||
# 'Unable to connect to database', it will attempt to re-create the database
|
||||
# connection. Set to 0 to disable pinging.
|
||||
# Note: This has no effect on dbd_odbc_ping_on_insert.
|
||||
# disabled = 0
|
||||
# 5 minutes = 300
|
||||
# 15 minutes = 900
|
||||
# 30 minutes = 1800
|
||||
dbd_odbc_ping_interval = 300
|
||||
|
||||
[Exec]
|
||||
|
||||
# Set to 1 to allow EXEC statements to execute. Should normally be left on unless you
|
||||
# want to temporarily disable all EXEC commands
|
||||
exec_enable = 1
|
||||
|
||||
[Debugging]
|
||||
# 0 - do not output messages
|
||||
# 1 - output some basic messages
|
||||
# 2 - out all messages
|
||||
DEBUGGING = 2
|
||||
|
||||
# Debugging file - SNMPTT
|
||||
# Location of debugging output file. Leave blank to default to STDOUT (good for
|
||||
# standalone mode, or daemon mode without forking)
|
||||
#DEBUGGING_FILE =
|
||||
DEBUGGING_FILE = /etc/snmp/debug.snmptt
|
||||
|
||||
# Debugging file - SNMPTTHANDLER
|
||||
# Location of debugging output file. Leave blank to default to STDOUT
|
||||
#DEBUGGING_FILE_HANDLER =
|
||||
DEBUGGING_FILE_HANDLER = /var/log/snmptthandler.debug
|
||||
|
||||
[TrapFiles]
|
||||
# A list of snmptt.conf files (this is NOT the snmptrapd.conf file). The COMPLETE path
|
||||
# and filename. Ex: '/etc/snmp/snmptt.conf'
|
||||
snmptt_conf_files = <<END
|
||||
/etc/snmp/oreon_traps/snmptt-cisco.conf
|
||||
/etc/snmp/oreon_traps/snmptt-hp.conf
|
||||
/etc/snmp/oreon_traps/snmptt-3com.conf
|
||||
/etc/snmp/oreon_traps/snmptt-ciscolinksys.conf
|
||||
/etc/snmp/oreon_traps/snmptt-dell.conf
|
||||
/etc/snmp/oreon_traps/snmptt-Generic.conf
|
||||
/etc/snmp/oreon_traps/snmptt-Zebra.conf
|
||||
END
|
Loading…
Reference in New Issue