git-svn-id: http://svn.centreon.com/Plugins/Dev@2426 6bcd3966-0018-0410-8128-fd23d134de7e
This commit is contained in:
Mat Sugumaran 2007-06-04 15:31:26 +00:00
parent 512a253e46
commit ab82e3dfb0
1 changed files with 22 additions and 15 deletions

View File

@ -1,4 +1,4 @@
#! /usr/bin/perl -w #! /usr/bin/perl
# #
# $Id: check_graph_nt.pl,v 1.3 2005/08/01 18:04:00 gollum123 Exp $ # $Id: check_graph_nt.pl,v 1.3 2005/08/01 18:04:00 gollum123 Exp $
# #
@ -24,7 +24,7 @@
use strict; use strict;
use FindBin; use FindBin;
use lib "$FindBin::Bin"; use lib "$FindBin::Bin";
use lib "@NAGIOS_PLUGINS@"; use lib "/srv/nagios/libexec";
use utils qw($TIMEOUT %ERRORS &print_revision &support); use utils qw($TIMEOUT %ERRORS &print_revision &support);
if (eval "require oreon" ) { if (eval "require oreon" ) {
@ -136,7 +136,6 @@ $name =~ s/\.pl.*//g;
my $return_code; my $return_code;
## Plugin requests ## Plugin requests
my $start=time; my $start=time;
if ($op_v) { if ($op_v) {
if ($op_v) {$op_v = "-v ".$op_v;} if ($op_v) {$op_v = "-v ".$op_v;}
@ -148,11 +147,14 @@ if ($op_v) {
if ($op_s) {$op_s = "-s ".$op_s;} else { $op_s = " ";} if ($op_s) {$op_s = "-s ".$op_s;} else { $op_s = " ";}
if ($op_d) {$op_d = "-d ".$op_d;} else { $op_d = " ";} 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"; # 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`; $_ = `$pathtolibexecnt -H $opt_H $op_v $port $warning $critical $op_l $op_t $op_s $op_d `;
my $return = $_; my $return = $_;
if (!defined($return) || $return eq "") {
print "Error in command, check your command options\n";
exit (3);
}
$return =~ s/\\//g; $return =~ s/\\//g;
$return_code = $? / 256; $return_code = $? / 256;
## CLIENTVERSION ## CLIENTVERSION
if ($op_v =~ /CLIENTVERSION/){ if ($op_v =~ /CLIENTVERSION/){
print "CLIENTVERSION impossible to Graph!\n"; print "CLIENTVERSION impossible to Graph!\n";
@ -206,8 +208,10 @@ if ($op_v) {
#$return =~ s/%/ pct/g; #$return =~ s/%/ pct/g;
## Put value in octets : Mo -> o ## Put value in octets : Mo -> o
if (defined($test[3]) && defined($test[7]) && defined($test[12])){ if (defined($test[3]) && defined($test[7]) && defined($test[12])){
$test[3] = $test[3] * 1024 * 1024; $test[3] =~ s/\,/\./g;
$test[7] = $test[7] * 1024 * 1024; $test[3] = eval($test[3] * 1024 * 1024 * 1024);
$test[7] =~ s/\,/\./g;
$test[7] = eval ($test[7] * 1024 * 1024 * 1024);
print $return_part[0] . "|total=".$test[3]."o used=".$test[7]."o\n"; print $return_part[0] . "|total=".$test[3]."o used=".$test[7]."o\n";
} else { } else {
print $return_part[0] . "\n"; print $return_part[0] . "\n";
@ -229,8 +233,10 @@ if ($op_v) {
#$return =~ s/%/ pct/g; #$return =~ s/%/ pct/g;
if ($test4[1] && $test[6] && $test[11]){ if ($test4[1] && $test[6] && $test[11]){
## Put value in octets : Mo -> o ## Put value in octets : Mo -> o
$test4[1] = $test4[1] * 1024 * 1024; $test4[1] =~ s/\,/\./g;
$test[6] = $test[6] * 1024 * 1024; $test4[1] = eval($test4[1] * 1024 * 1024);
$test[6] =~ s/\,/\./g;
$test[6] = eval($test[6] * 1024 * 1024);
print $return_data[0] . "|total=".$test4[1]."o used=".$test[6]."o\n"; print $return_data[0] . "|total=".$test4[1]."o used=".$test[6]."o\n";
} else { } else {
print $return_data[0] . "\n"; print $return_data[0] . "\n";
@ -244,7 +250,7 @@ if ($op_v) {
if (defined($etat)) { if (defined($etat)) {
$etat =~ s/\n//; $etat =~ s/\n//;
} else { } else {
$etat = "Unknow"; $etat = "Unknown";
} }
if ($etat =~ /Started/) if ($etat =~ /Started/)
{$etat=1;} {$etat=1;}
@ -271,6 +277,7 @@ if ($op_v) {
## Print Plugins Output ## Print Plugins Output
$return =~ s/\n/ /g; $return =~ s/\n/ /g;
$return =~ s/%/ pct/g; $return =~ s/%/ pct/g;
#print "---".$return ."---\n";
print $return . "|counter=".@values."\n"; print $return . "|counter=".@values."\n";
exit $return_code; exit $return_code;
} }