mirror of
https://github.com/ranl/monitor-utils.git
synced 2026-02-05 22:55:17 +01:00
splitting IT project
This commit is contained in:
141
nagios/check-cisco-po.pl
Executable file
141
nagios/check-cisco-po.pl
Executable file
@@ -0,0 +1,141 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
# Modules
|
||||
use strict;
|
||||
use Net::SNMP;
|
||||
use Getopt::Long;
|
||||
Getopt::Long::Configure('bundling');
|
||||
|
||||
# Interfaces
|
||||
my $S_int_entry = ".1.3.6.1.2.1.2.2.1";
|
||||
my $S_int_desc = "$S_int_entry.2";
|
||||
my $S_int_operstatus = "$S_int_entry.8";
|
||||
my $S_int_speed = '.1.3.6.1.2.1.31.1.1.1.15';
|
||||
|
||||
# Status of operstatus
|
||||
my %int_status_index = (
|
||||
1 => 'up',
|
||||
2 => 'down',
|
||||
3 => 'testing',
|
||||
4 => 'unknown',
|
||||
5 => 'notPresent',
|
||||
6 => 'lowerLayerDown',
|
||||
);
|
||||
|
||||
# Nagios Exit codes
|
||||
my $OK = 0;
|
||||
my $WARNING = 1;
|
||||
my $CRITICAL = 2;
|
||||
my $UNKNOWN = 3;
|
||||
|
||||
# Output & exit code
|
||||
my $stat = $OK;
|
||||
my $msg;
|
||||
my $perf;
|
||||
|
||||
### Functions
|
||||
###############
|
||||
sub _create_session
|
||||
{
|
||||
my ($server, $comm) = @_;
|
||||
my $version = 1;
|
||||
my ($sess, $err) = Net::SNMP->session( -hostname => $server, -version => $version, -community => $comm);
|
||||
if (!defined($sess)) {
|
||||
print "Can't create SNMP session to $server\n";
|
||||
exit(1);
|
||||
}
|
||||
return $sess;
|
||||
}
|
||||
|
||||
sub _get_oid_value(@)
|
||||
{
|
||||
my $sess = shift;
|
||||
my $local_oid = shift;
|
||||
my $r_return = $sess->get_request(-varbindlist => [$local_oid]);
|
||||
return($r_return->{$local_oid});
|
||||
}
|
||||
|
||||
sub _syntax_err(@)
|
||||
{
|
||||
my $msg = shift;
|
||||
print <<EOU;
|
||||
Err: $msg
|
||||
|
||||
Syntax:
|
||||
-H [Ip/Dns Name of the Switch] -C [snmp community] -P [port-channel number] -s [speed of each interface in the po(Mbps)] -n [number of ints in the po]
|
||||
|
||||
EOU
|
||||
exit(3);
|
||||
}
|
||||
|
||||
|
||||
# User Input
|
||||
my %opt;
|
||||
my $result = GetOptions(\%opt,
|
||||
'switch|H=s',
|
||||
'community|C=s',
|
||||
'interface|P=i',
|
||||
'speed|s=i',
|
||||
'numIfInts|n=i',
|
||||
);
|
||||
|
||||
# Validate user input
|
||||
_syntax_err("Missing -H") unless defined $opt{'switch'};
|
||||
_syntax_err("Missing -C") unless defined $opt{'community'};
|
||||
_syntax_err("Missing -P") unless defined $opt{'interface'};
|
||||
_syntax_err("Missing -s") unless defined $opt{'speed'};
|
||||
_syntax_err("Missing -n") unless defined $opt{'numIfInts'};
|
||||
|
||||
# Connect to switch
|
||||
our $snmp_session = _create_session($opt{'switch'},$opt{'community'});
|
||||
|
||||
# Get port-channel snmp id
|
||||
my $snmpId;
|
||||
my $R_tbl = $snmp_session->get_table($S_int_desc);
|
||||
my $is_int_exists = 0;
|
||||
foreach my $oid ( keys %$R_tbl) {
|
||||
if($$R_tbl{$oid} =~ "[Pp]ort-channel$opt{'interface'}\$")
|
||||
{
|
||||
$snmpId = "$oid";
|
||||
$snmpId =~ s/$S_int_desc\.//;
|
||||
}
|
||||
}
|
||||
|
||||
# Exit if non-were found
|
||||
_syntax_err("Can't find Port-channel$opt{'interface'}") if($snmpId eq "");
|
||||
|
||||
# Check operstatus
|
||||
my $operationStatus = _get_oid_value($snmp_session,"$S_int_operstatus.$snmpId");
|
||||
|
||||
# Quit if po is down totally
|
||||
if($operationStatus ne 1)
|
||||
{
|
||||
$stat = $CRITICAL;
|
||||
$msg = "CRIT: Port-channel$opt{'interface'} is $int_status_index{$operationStatus}";
|
||||
$perf = "upInts=0";
|
||||
}
|
||||
|
||||
# Check speed of the po and cross reference with $opt{'numIfInts'}*$opt{'speed'};
|
||||
if($stat == $OK)
|
||||
{
|
||||
my $speed = _get_oid_value($snmp_session,"$S_int_speed.$snmpId");
|
||||
my $expectedSpeed = $opt{'numIfInts'} * $opt{'speed'};
|
||||
if($speed == $expectedSpeed) # Everthing is ok
|
||||
{
|
||||
$stat = $OK;
|
||||
$msg = "OK: Port-channel$opt{'interface'} is $int_status_index{$operationStatus}";
|
||||
$perf = "upInts=$opt{'numIfInts'}";
|
||||
}
|
||||
else # at least one or more interfaces are down, calculate how many
|
||||
{
|
||||
my $upInts = $opt{'numIfInts'} - int($speed / $opt{'speed'});
|
||||
$stat = $WARNING;
|
||||
$msg = "WARNING: $upInts/$opt{'numIfInts'} in Port-channel$opt{'interface'} are down";
|
||||
$perf = "upInts=$upInts";
|
||||
}
|
||||
}
|
||||
|
||||
# Exit
|
||||
print "$msg | $perf\n";
|
||||
exit($stat);
|
||||
|
||||
31
nagios/check-cisco.example
Normal file
31
nagios/check-cisco.example
Normal file
@@ -0,0 +1,31 @@
|
||||
Commands.cfg
|
||||
-----------------
|
||||
define command {
|
||||
command_name cisco-module
|
||||
command_line $USER1$/check-cisco.pl -H $HOSTADDRESS$ -C $ARG1$ -t module -w $ARG2$ -c $ARG3$
|
||||
}
|
||||
define command {
|
||||
command_name cisco-temp
|
||||
command_line $USER1$/check-cisco.pl -H $HOSTADDRESS$ -C $ARG1$ -t temp -w $ARG2$ -c $ARG3$
|
||||
}
|
||||
define command {
|
||||
command_name cisco-fan
|
||||
command_line $USER1$/check-cisco.pl -H $HOSTADDRESS$ -C $ARG1$ -t fan
|
||||
}
|
||||
define command {
|
||||
command_name cisco-ps
|
||||
command_line $USER1$/check-cisco.pl -H $HOSTADDRESS$ -C $ARG1$ -t ps
|
||||
}
|
||||
|
||||
define command {
|
||||
command_name cisco-int
|
||||
command_line $USER1$/check-cisco.pl -H $HOSTADDRESS$ -C $ARG1$ -t int -w $ARG2$ -c $ARG3$ -o $ARG4$
|
||||
}
|
||||
define command {
|
||||
command_name cisco-cpu
|
||||
command_line $USER1$/check-cisco.pl -H $HOSTADDRESS$ -C $ARG1$ -t cpu -w $ARG2$ -c $ARG3$
|
||||
}
|
||||
define command {
|
||||
command_name cisco-mem
|
||||
command_line $USER1$/check-cisco.pl -H $HOSTADDRESS$ -C $ARG1$ -t mem -w $ARG2$ -c $ARG3$
|
||||
}
|
||||
507
nagios/check-cisco.pl
Executable file
507
nagios/check-cisco.pl
Executable file
@@ -0,0 +1,507 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
#####################################
|
||||
#####################################
|
||||
### ______ _ =) ###
|
||||
### | ___ \ | | ###
|
||||
### | |_/ / __ _ _ __ | | ###
|
||||
### | / / _` || '_ \ | | ###
|
||||
### | |\ \| (_| || | | || |____ ###
|
||||
### \_| \_|\__,_||_| |_|\_____/ ###
|
||||
#####################################
|
||||
#####################################
|
||||
|
||||
use strict;
|
||||
use Net::SNMP;
|
||||
my $stat;
|
||||
my $msg;
|
||||
my $perf;
|
||||
my $days = 14;
|
||||
my $script_name = "check-cisco.pl";
|
||||
|
||||
### SNMP OIDs
|
||||
###############
|
||||
# Temperature
|
||||
my $S_temp = ".1.3.6.1.4.1.9.9.13.1.3.1.3";
|
||||
# Memory
|
||||
my $S_mem_used = ".1.3.6.1.4.1.9.9.48.1.1.1.5.1"; # Byte
|
||||
my $S_mem_free = ".1.3.6.1.4.1.9.9.48.1.1.1.6.1"; # Byte
|
||||
# CPU Load
|
||||
my $S_load_5s = ".1.3.6.1.4.1.9.2.1.56.0";
|
||||
my $S_load_1m = ".1.3.6.1.4.1.9.2.1.57.0";
|
||||
my $S_load_5m = ".1.3.6.1.4.1.9.2.1.58.0";
|
||||
# Power Supply
|
||||
my $S_ps = ".1.3.6.1.4.1.9.9.13.1.5.1";
|
||||
my $S_ps_name = "$S_ps.2";
|
||||
my $S_ps_stat = "$S_ps.3";
|
||||
# Fan
|
||||
my $S_fan = ".1.3.6.1.4.1.9.9.13.1.4.1";
|
||||
my $S_fan_name = "$S_fan.2";
|
||||
my $S_fan_stat = "$S_fan.3";
|
||||
# Module
|
||||
my $S_module_status = ".1.3.6.1.4.1.9.9.117.1.2.1.1.2";
|
||||
# Interfaces
|
||||
my $S_int_entry = ".1.3.6.1.2.1.2.2.1";
|
||||
my $S_int_desc = "$S_int_entry.2";
|
||||
my $S_int_adminstatus = "$S_int_entry.7";
|
||||
my $S_int_operstatus = "$S_int_entry.8";
|
||||
my $S_int_lastchange = "$S_int_entry.9";
|
||||
my $S_int_InOctets = "$S_int_entry.10";
|
||||
my $S_int_OutOctets = "$S_int_entry.16";
|
||||
my $S_int_number = ".1.3.6.1.2.1.2.1.0";
|
||||
|
||||
# SNMP Status Codes
|
||||
my %phy_dev_status = (
|
||||
1 => 'normal',
|
||||
2 => 'warning',
|
||||
3 => 'critical',
|
||||
4 => 'shutdown',
|
||||
5 => 'notPresent',
|
||||
6 => 'notFunctioning',
|
||||
);
|
||||
my %module_status_code = (
|
||||
1 => 'unknown',
|
||||
2 => 'ok',
|
||||
3 => 'disabled',
|
||||
4 => 'okButDiagFailed',
|
||||
5 => 'boot',
|
||||
6 => 'selfTest',
|
||||
7 => 'failed',
|
||||
8 => 'missing',
|
||||
9 => 'mismatchWithParent',
|
||||
10 => 'mismatchConfig',
|
||||
11 => 'diagFailed',
|
||||
12 => 'dormant',
|
||||
13 => 'outOfServiceAdmin',
|
||||
14 => 'outOfServiceEnvTemp',
|
||||
15 => 'poweredDown',
|
||||
16 => 'poweredUp',
|
||||
17 => 'powerDenied',
|
||||
18 => 'powerCycled',
|
||||
19 => 'okButPowerOverWarning',
|
||||
20 => 'okButPowerOverCritical',
|
||||
21 => 'syncInProgress',
|
||||
);
|
||||
my %int_status_index = (
|
||||
1 => 'up',
|
||||
2 => 'down',
|
||||
3 => 'testing',
|
||||
4 => 'unknown',
|
||||
5 => 'notPresent',
|
||||
6 => 'lowerLayerDown',
|
||||
);
|
||||
|
||||
### Functions
|
||||
###############
|
||||
sub _create_session {
|
||||
my ($server, $comm) = @_;
|
||||
my $version = 1;
|
||||
my ($sess, $err) = Net::SNMP->session( -hostname => $server, -version => $version, -community => $comm);
|
||||
if (!defined($sess)) {
|
||||
print "Can't create SNMP session to $server\n";
|
||||
exit(1);
|
||||
}
|
||||
return $sess;
|
||||
}
|
||||
|
||||
sub FSyntaxError {
|
||||
print "Syntax Error !\n";
|
||||
# print "$0 -H [ip|dnsname] -C [snmp community] -t [temp|fan|ps|cpu|mem|module|freeint] -w [warning value] -c [critical value] -d [days]\n";
|
||||
print "$script_name\n";
|
||||
print "-H = Ip/Dns Name of the Switch\n";
|
||||
print "-C = SNMP Community\n";
|
||||
print "-t = Check type\n";
|
||||
print "\ttemp - Temperature\n";
|
||||
print "\tfan - Fan Fail\n";
|
||||
print "\tps - Power Supply Fail\n";
|
||||
print "\tcpu - CPU Load\n";
|
||||
print "\tmem - Memory\n";
|
||||
print "\tmodule - Module Health\n";
|
||||
print "\tfreeint - Free eth interfaces for X days (-d)\n";
|
||||
print "\tint - Interface Operation Stat (use with -i or -o)\n";
|
||||
print "-w = Warning Value\n";
|
||||
print "-c = Critical Value\n";
|
||||
print "-d = number of days that th ethernet interface hasn't change state, default is 14 (only for -t freeint)\n";
|
||||
print "-i = Interface Name (only for -t int)\n";
|
||||
print "-o = Interface OID (only for -t int)\n";
|
||||
exit(3);
|
||||
}
|
||||
|
||||
if($#ARGV < 5 or $#ARGV > 11) {
|
||||
FSyntaxError;
|
||||
}
|
||||
|
||||
### Gather input from user
|
||||
#############################
|
||||
my $switch;
|
||||
my $community;
|
||||
my $check_type;
|
||||
my $warn = 0;
|
||||
my $crit = 0;
|
||||
my $int;
|
||||
my $oidint;
|
||||
|
||||
while(@ARGV) {
|
||||
my $temp = shift(@ARGV);
|
||||
if("$temp" eq '-H') {
|
||||
$switch = shift(@ARGV);
|
||||
} elsif("$temp" eq '-C') {
|
||||
$community = shift(@ARGV);
|
||||
} elsif("$temp" eq '-t') {
|
||||
$check_type = shift(@ARGV);
|
||||
} elsif("$temp" eq '-w') {
|
||||
$warn = shift(@ARGV);
|
||||
} elsif("$temp" eq '-c') {
|
||||
$crit = shift(@ARGV);
|
||||
} elsif("$temp" eq '-i') {
|
||||
$int = shift(@ARGV);
|
||||
} elsif("$temp" eq '-o') {
|
||||
$oidint = shift(@ARGV);
|
||||
} elsif("$temp" eq '-d') {
|
||||
$days = shift(@ARGV);
|
||||
if("$days" eq "") {
|
||||
$days = 14;
|
||||
}
|
||||
} else {
|
||||
FSyntaxError();
|
||||
}
|
||||
}
|
||||
|
||||
# Validate Warning
|
||||
if("$check_type" ne "temp") {
|
||||
if($warn > $crit and "$check_type" ne "freeint" and "$check_type" ne "mem") {
|
||||
print "Warning can't be larger then Critical: $warn > $crit\n";
|
||||
FSyntaxError();
|
||||
} elsif($warn < $crit and "$check_type" eq "freeint") {
|
||||
print "Warning can't be smaller then Critical: $warn < $crit in intfree check\n";
|
||||
FSyntaxError();
|
||||
} elsif($warn < $crit and "$check_type" eq "mem") {
|
||||
print "Warning can't be smaller then Critical: $warn < $crit in intfree check\n";
|
||||
FSyntaxError();
|
||||
}
|
||||
}
|
||||
|
||||
# Establish SNMP Session
|
||||
our $snmp_session = _create_session($switch,$community);
|
||||
|
||||
### Temperature ###
|
||||
if($check_type =~ /^temp/) {
|
||||
my $temp;
|
||||
my $R_tbl = $snmp_session->get_table($S_temp);
|
||||
foreach my $oid ( keys %$R_tbl) {
|
||||
$temp = "$$R_tbl{$oid}";
|
||||
last;
|
||||
}
|
||||
|
||||
if("$temp" eq "") {
|
||||
print "The switch $switch can't report temperature via SNMP\n";
|
||||
FSyntaxError();
|
||||
}
|
||||
|
||||
if($temp > 1) {
|
||||
if($warn > $crit and "$check_type") {
|
||||
print "Warning can't be larger then Critical: $warn > $crit\n";
|
||||
FSyntaxError();
|
||||
}
|
||||
if($temp <= $warn) {
|
||||
$stat = 0;
|
||||
$msg = "Temperature: OK - Tempeture is $temp Celsius";
|
||||
} elsif($temp > $warn and $temp < $crit) {
|
||||
$stat = 1;
|
||||
$msg = "Temperature: Warn - Tempeture is $temp Celsius";
|
||||
} elsif($temp >= $crit) {
|
||||
$stat = 2;
|
||||
$msg = "Temperature: CRIT - Tempeture is $temp Celsius";
|
||||
}
|
||||
$perf = "temperature=$temp;$warn;$crit";
|
||||
} else {
|
||||
if($warn > 0 or $crit > 0) {
|
||||
print "ERR:\nSome switches only show boolean value 0=OK 1=ERROR\nplease dont use -w and -c arguments\n\n";
|
||||
FSyntaxError();
|
||||
}
|
||||
if($temp == 1) {
|
||||
$stat = 0;
|
||||
$msg = "Temperature: OK";
|
||||
} else {
|
||||
$stat = 2;
|
||||
$msg = "Temperature: CRIT";
|
||||
}
|
||||
$perf = "temperature=$temp";
|
||||
}
|
||||
|
||||
### Memory ###
|
||||
|
||||
} elsif($check_type eq "mem") {
|
||||
my $R_mem_used = $snmp_session->get_request(-varbindlist => [$S_mem_used]);
|
||||
my $mem_used = "$R_mem_used->{$S_mem_used}";
|
||||
my $R_mem_free = $snmp_session->get_request(-varbindlist => [$S_mem_free]);
|
||||
my $mem_free = "$R_mem_free->{$S_mem_free}";
|
||||
my $mem_total = $mem_free + $mem_used;
|
||||
|
||||
$mem_used = int($mem_used / 1024 / 1024);
|
||||
$mem_free = int($mem_free / 1024 / 1024);
|
||||
$mem_total = int($mem_total / 1024 / 1024);
|
||||
|
||||
my $mem_free_perc = int($mem_free / $mem_total * 100);
|
||||
|
||||
if($mem_free_perc > $warn) {
|
||||
$stat = 0;
|
||||
$msg = "Memory: OK - Free Memory $mem_free_perc%";
|
||||
} elsif($mem_free_perc <= $warn and $mem_free_perc > $crit) {
|
||||
$stat = 1;
|
||||
$msg = "Memory: Warn - Free Memory $mem_free_perc %";
|
||||
} elsif($mem_free_perc <= $crit) {
|
||||
$stat = 2;
|
||||
$msg = "Memory: CRIT - Free Memory $mem_free_perc %";
|
||||
}
|
||||
|
||||
$perf = "memory_total=$mem_total\MB memory_used=$mem_used\MB";
|
||||
|
||||
### Interface Stat ###
|
||||
|
||||
} elsif($check_type eq "int") {
|
||||
my $R_tbl;
|
||||
if ($oidint) {
|
||||
$R_tbl = $snmp_session->get_request(-varbindlist => ["$oidint"]);
|
||||
$int = $$R_tbl{"$oidint"};
|
||||
} else {
|
||||
$R_tbl = $snmp_session->get_table($S_int_desc);
|
||||
}
|
||||
my $is_int_exists = 0;
|
||||
foreach my $oid ( keys %$R_tbl) {
|
||||
my $name = "$$R_tbl{$oid}";
|
||||
if($name eq $int) {
|
||||
$is_int_exists++;
|
||||
my $id = "$oid";
|
||||
$id =~ s/$S_int_desc\.//;
|
||||
my $R_stat = $snmp_session->get_request(-varbindlist => ["$S_int_operstatus.$id"]);
|
||||
my $int_stat = $R_stat->{"$S_int_operstatus.$id"};
|
||||
if($int_stat != 1) {
|
||||
$stat = 2;
|
||||
$msg = "CRIT: $int -> $int_status_index{$int_stat}";
|
||||
$perf = "int=0";
|
||||
} else {
|
||||
$stat = 0;
|
||||
$msg = "OK: $int -> $int_status_index{$int_stat}";
|
||||
$perf = "int=1";
|
||||
}
|
||||
last;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if($is_int_exists == 0) {
|
||||
$stat = 3;
|
||||
$msg = "UNKNOWN: $int does not exists";
|
||||
$perf = "int=0";
|
||||
}
|
||||
|
||||
### CPU Load ###
|
||||
|
||||
} elsif($check_type eq "cpu") {
|
||||
my $R_load_5s = $snmp_session->get_request(-varbindlist => [$S_load_5s]);
|
||||
my $load_5s = "$R_load_5s->{$S_load_5s}";
|
||||
my $R_load_1m = $snmp_session->get_request(-varbindlist => [$S_load_1m]);
|
||||
my $load_1m = "$R_load_1m->{$S_load_1m}";
|
||||
my $R_load_5m = $snmp_session->get_request(-varbindlist => [$S_load_5m]);
|
||||
my $load_5m = "$R_load_5m->{$S_load_5m}";
|
||||
|
||||
if($load_5s <= $warn) {
|
||||
$stat = 0;
|
||||
$msg = "Cpu: OK - Cpu Load $load_5s% $load_1m% $load_5m%";
|
||||
} elsif($load_5s > $warn and $load_5s < $crit) {
|
||||
$stat = 1;
|
||||
$msg = "Cpu: Warn - Cpu Load $load_5s% $load_1m% $load_5m%";
|
||||
} elsif($load_5s >= $crit) {
|
||||
$stat = 2;
|
||||
$msg = "Cpu: CRIT - Cpu Load $load_5s% $load_1m% $load_5m%";
|
||||
}
|
||||
|
||||
$perf = "cpu_5s=$load_5s\percent;$warn;$crit cpu_1m=$load_1m\percent cpu_5m=$load_5m\percent";
|
||||
|
||||
### Fan Status ###
|
||||
|
||||
} elsif($check_type eq "fan") {
|
||||
my $R_tbl = $snmp_session->get_table($S_fan_name);
|
||||
my $total_err = 0;
|
||||
my $err_msg;
|
||||
my $sum = 0;
|
||||
foreach my $oid ( keys %$R_tbl) {
|
||||
$sum = $sum + 1;
|
||||
my $name = "$$R_tbl{$oid}";
|
||||
my $id = "$oid";
|
||||
$id =~ s/$S_fan_name\.//;
|
||||
my $R_stat = $snmp_session->get_request(-varbindlist => ["$S_fan_stat.$id"]);
|
||||
my $stat = $R_stat->{"$S_fan_stat.$id"};
|
||||
if($stat != 1) {
|
||||
$total_err = $total_err + 1;
|
||||
$err_msg = "$err_msg $name -> $phy_dev_status{$stat}";
|
||||
}
|
||||
}
|
||||
|
||||
if($total_err != 0) {
|
||||
$err_msg = ", $err_msg have an error";
|
||||
} else {
|
||||
$err_msg = "all good";
|
||||
}
|
||||
|
||||
if($total_err <= $warn) {
|
||||
$stat = 0;
|
||||
$msg = "Fans: OK - $sum Fans are running $err_msg";
|
||||
} elsif($total_err > $warn and $total_err < $crit) {
|
||||
$stat = 1;
|
||||
$msg = "Fans: Warn - $sum Fans are running $err_msg";
|
||||
} elsif($total_err >= $crit) {
|
||||
$stat = 2;
|
||||
$msg = "Fans: Crit - $sum Fans are running $err_msg";
|
||||
}
|
||||
|
||||
$perf = "total=$sum err=$total_err";
|
||||
|
||||
### Power Supplies ###
|
||||
|
||||
} elsif($check_type eq "ps") {
|
||||
my $R_tbl = $snmp_session->get_table($S_ps_name);
|
||||
my $total_err = 0;
|
||||
my $err_msg;
|
||||
my $sum = 0;
|
||||
foreach my $oid ( keys %$R_tbl) {
|
||||
$sum = $sum + 1;
|
||||
my $name = "$$R_tbl{$oid}";
|
||||
my $id = "$oid";
|
||||
$id =~ s/$S_ps_name\.//;
|
||||
my $R_stat = $snmp_session->get_request(-varbindlist => ["$S_ps_stat.$id"]);
|
||||
my $stat = $R_stat->{"$S_ps_stat.$id"};
|
||||
if($stat != 1) {
|
||||
$total_err = $total_err + 1;
|
||||
$err_msg = "$err_msg $name -> $phy_dev_status{$stat}";
|
||||
}
|
||||
}
|
||||
|
||||
if($total_err != 0) {
|
||||
$err_msg = ", $err_msg have an error";
|
||||
} else {
|
||||
$err_msg = "all good";
|
||||
}
|
||||
|
||||
if($total_err <= $warn) {
|
||||
$stat = 0;
|
||||
$msg = "PS: OK - $sum PS are running $err_msg";
|
||||
} elsif($total_err > $warn and $total_err < $crit) {
|
||||
$stat = 1;
|
||||
$msg = "PS: Warn - $sum PS are running $err_msg";
|
||||
} elsif($total_err >= $crit) {
|
||||
$stat = 2;
|
||||
$msg = "PS: Crit - $sum PS are running $err_msg";
|
||||
}
|
||||
|
||||
$perf = "total=$sum err=$total_err";
|
||||
|
||||
### Module Status ###
|
||||
|
||||
} elsif($check_type eq "module") {
|
||||
my $R_tbl = $snmp_session->get_table($S_module_status);
|
||||
my $total_err = 0;
|
||||
my $err_msg;
|
||||
my $sum = 0;
|
||||
foreach my $oid ( keys %$R_tbl) {
|
||||
$sum = $sum + 1;
|
||||
my $module_status = "$$R_tbl{$oid}";
|
||||
my $id = "$oid";
|
||||
$id =~ s/$S_module_status\.//;
|
||||
if($module_status != 2) {
|
||||
$total_err = $total_err + 1;
|
||||
$err_msg = "$err_msg $id -> $module_status_code{$module_status}";
|
||||
}
|
||||
}
|
||||
|
||||
if($sum == 0) {
|
||||
print "The switch $switch doesn't have any modules\n";
|
||||
FSyntaxError();
|
||||
}
|
||||
|
||||
if($total_err != 0) {
|
||||
$err_msg = ", $err_msg have an error";
|
||||
} else {
|
||||
$err_msg = "all good";
|
||||
}
|
||||
|
||||
if($total_err <= $warn) {
|
||||
$stat = 0;
|
||||
$msg = "Modules: OK - $sum Modules are running $err_msg";
|
||||
} elsif($total_err > $warn and $total_err < $crit) {
|
||||
$stat = 1;
|
||||
$msg = "Modules: Warn - $sum Modules are running $err_msg";
|
||||
} elsif($total_err >= $crit) {
|
||||
$stat = 2;
|
||||
$msg = "Modules: Crit - $sum Modules are running $err_msg";
|
||||
}
|
||||
|
||||
$perf = "total=$sum err=$total_err";
|
||||
|
||||
### Free Interfaces ###
|
||||
|
||||
} elsif($check_type eq "freeint") {
|
||||
|
||||
my $R_int_number = $snmp_session->get_request(-varbindlist => [$S_int_number]);
|
||||
my $int_number = $R_int_number->{$S_int_number};
|
||||
|
||||
my $R_tbl = $snmp_session->get_table($S_int_desc);
|
||||
my @ints;
|
||||
my $down = 0;
|
||||
my $sum = 0;
|
||||
|
||||
foreach my $oid ( keys %$R_tbl) {
|
||||
if($$R_tbl{$oid} =~ /Ethernet/) {
|
||||
$sum++;
|
||||
my $id = "$oid";
|
||||
$id =~ s/$S_int_desc\.//;
|
||||
|
||||
# Admin Status
|
||||
my $R_int_adminstatus = $snmp_session->get_request(-varbindlist => ["$S_int_adminstatus.$id"]);
|
||||
my $int_adminstatus = $R_int_adminstatus->{"$S_int_adminstatus.$id"};
|
||||
# Oper Status
|
||||
my $R_int_operstatus = $snmp_session->get_request(-varbindlist => ["$S_int_operstatus.$id"]);
|
||||
my $int_operstatus = $R_int_operstatus->{"$S_int_operstatus.$id"};
|
||||
# Inbout
|
||||
my $R_int_InOctets = $snmp_session->get_request(-varbindlist => ["$S_int_InOctets.$id"]);
|
||||
my $int_InOctets = $R_int_InOctets->{"$S_int_InOctets.$id"};
|
||||
# Outbound
|
||||
my $R_int_OutOctets = $snmp_session->get_request(-varbindlist => ["$S_int_OutOctets.$id"]);
|
||||
my $int_OutOctets = $R_int_OutOctets->{"$S_int_OutOctets.$id"};
|
||||
# Last Change
|
||||
my $R_int_lastchange = $snmp_session->get_request(-varbindlist => ["$S_int_lastchange.$id"]);
|
||||
my $int_lastchange = $R_int_lastchange->{"$S_int_lastchange.$id"};
|
||||
my @lastchanged = split(" ",$int_lastchange);
|
||||
|
||||
if($int_adminstatus == 2 or $int_operstatus == 2) {
|
||||
if(("$lastchanged[1]" eq "days," and $lastchanged[1] => $days) or ($int_OutOctets == 0 and $int_InOctets == 0)) {
|
||||
$down++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if($down >= $warn) {
|
||||
$stat = 0;
|
||||
$msg = "Free Interfaces: OK - $down/$sum free interfaces for $days days";
|
||||
} elsif($down < $warn and $down > $crit) {
|
||||
$stat = 1;
|
||||
$msg = "Free Interfaces: Warn - $down/$sum free interfaces for $days days";
|
||||
} elsif($down <= $crit) {
|
||||
$stat = 2;
|
||||
$msg = "Free Interfaces: CRIT - $down/$sum free interfaces for $days days";
|
||||
}
|
||||
|
||||
$perf = "total_int=$int_number total_eth=$sum total_eth_free=$down";
|
||||
|
||||
### Bad Syntax ###
|
||||
|
||||
} else {
|
||||
FSyntaxError();
|
||||
}
|
||||
|
||||
|
||||
print "$msg | $perf\n";
|
||||
exit($stat);
|
||||
103
nagios/check-file-exists.pl
Executable file
103
nagios/check-file-exists.pl
Executable file
@@ -0,0 +1,103 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# Modules
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
Getopt::Long::Configure('bundling');
|
||||
|
||||
# Functions
|
||||
sub _syntax_err(@)
|
||||
{
|
||||
my $msg = shift;
|
||||
print <<EOU;
|
||||
Err: $msg
|
||||
|
||||
Syntax:
|
||||
-f [/path/to/file] -w [time in seconds] -c [time in seconds] -v
|
||||
|
||||
-v option will cause the check to return UNKNOWN exit status in case of the file doesn't exists
|
||||
|
||||
Information:
|
||||
This script will check the modification time of a file,
|
||||
If it is [time in seconds] older an error status will be generated according to the -w and -c arguments
|
||||
If the file doesn't exists no error will be generated
|
||||
Its primary purpose is to check that lock files doesn't exists for too much time
|
||||
|
||||
EOU
|
||||
exit(3);
|
||||
}
|
||||
|
||||
# User input
|
||||
my %opt;
|
||||
my $result = GetOptions(\%opt,
|
||||
'file|f=s',
|
||||
'warn|w=i',
|
||||
'crit|c=i',
|
||||
'verify|v',
|
||||
);
|
||||
|
||||
# Validate arguments
|
||||
_syntax_err("Missing -f") unless defined $opt{'file'};
|
||||
_syntax_err("Missing -w") unless defined $opt{'warn'};
|
||||
_syntax_err("Missing -c") unless defined $opt{'crit'};
|
||||
_syntax_err("-w can't be >= than -c") if ($opt{'warn'} >= $opt{'crit'});
|
||||
|
||||
# Variables
|
||||
my $OK = 0;
|
||||
my $WARNING = 1;
|
||||
my $CRITICAL = 2;
|
||||
my $UNKNOWN = 3;
|
||||
my $status = $OK;
|
||||
my $msg;
|
||||
my $perf;
|
||||
|
||||
# Take mtime and systems's epoc if file exists
|
||||
if( -f $opt{'file'})
|
||||
{
|
||||
my $filestat = (stat($opt{'file'}))[9];
|
||||
my $epoc = time;
|
||||
my $timediff = $epoc - $filestat;
|
||||
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
|
||||
$year += 1900;
|
||||
$mon += 1;
|
||||
my $timestamp = "$mday/$mon/$year $hour:$min:$sec";
|
||||
|
||||
# Decide exit status
|
||||
if ($timediff < $opt{'warn'})
|
||||
{
|
||||
$msg = "OK: look's good";
|
||||
$status = $OK;
|
||||
}
|
||||
elsif ($timediff >= $opt{'warn'} && $timediff < $opt{'crit'})
|
||||
{
|
||||
$msg = "WARN: $opt{'file'} mtime is $timestamp";
|
||||
$status = $WARNING;
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = "CRIT: $opt{'file'} mtime is $timestamp";
|
||||
$status = $CRITICAL;
|
||||
}
|
||||
|
||||
$perf = "mtime=$timediff"."s".";$opt{'warn'};$opt{'crit'}";
|
||||
}
|
||||
# If file doesn't exists exit OK nothing to check (or UNKNOWN in case of -v)
|
||||
else
|
||||
{
|
||||
if($opt{'verify'})
|
||||
{
|
||||
$msg = "UNKNOWN: $opt{'file'} doesn't exists";
|
||||
$perf = "mtime=0s;$opt{'warn'};$opt{'crit'}";
|
||||
$status = $UNKNOWN;
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = "OK: $opt{'file'} doesn't exists, nothing to check";
|
||||
$perf = "mtime=0s;$opt{'warn'};$opt{'crit'}";
|
||||
$status = $OK;
|
||||
}
|
||||
}
|
||||
|
||||
# Exit
|
||||
print "$msg | $perf\n";
|
||||
exit($status);
|
||||
225
nagios/check-juniper-vpn.pl
Executable file
225
nagios/check-juniper-vpn.pl
Executable file
@@ -0,0 +1,225 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
#####################################
|
||||
#####################################
|
||||
### ______ _ =) ###
|
||||
### | ___ \ | | ###
|
||||
### | |_/ / __ _ _ __ | | ###
|
||||
### | / / _` || '_ \ | | ###
|
||||
### | |\ \| (_| || | | || |____ ###
|
||||
### \_| \_|\__,_||_| |_|\_____/ ###
|
||||
#####################################
|
||||
#####################################
|
||||
|
||||
use strict;
|
||||
use lib "/path/to/nagios/libexec";
|
||||
use utils qw($TIMEOUT %ERRORS);
|
||||
use Net::SNMP;
|
||||
use Getopt::Long;
|
||||
Getopt::Long::Configure('bundling');
|
||||
|
||||
my $stat = 0;
|
||||
my $msg;
|
||||
my $perf;
|
||||
my $script_name = "check-juniper-vpn.pl";
|
||||
|
||||
### SNMP OIDs
|
||||
###############
|
||||
# IVE
|
||||
my $snmp_juniper_ive = '.1.3.6.1.4.1.12532';
|
||||
my $snmp_juniper_logFullPercent = "$snmp_juniper_ive.1.0";
|
||||
my $snmp_juniper_WebUsers = "$snmp_juniper_ive.2.0";
|
||||
my $snmp_juniper_MailUsers = "$snmp_juniper_ive.3.0";
|
||||
my $snmp_juniper_MeetingUsers = "$snmp_juniper_ive.9.0";
|
||||
my $snmp_juniper_iveCpuUtil = "$snmp_juniper_ive.10.0";
|
||||
my $snmp_juniper_iveMemoryUtil = "$snmp_juniper_ive.11.0";
|
||||
my $snmp_juniper_iveConcurrentUsers = "$snmp_juniper_ive.12.0";
|
||||
my $snmp_juniper_MeetingCount = "$snmp_juniper_ive.22.0";
|
||||
my $snmp_juniper_iveSwapUtil = "$snmp_juniper_ive.24.0";
|
||||
my $snmp_juniper_fanDescription = "$snmp_juniper_ive.32.0";
|
||||
my $snmp_juniper_psDescription = "$snmp_juniper_ive.33.0";
|
||||
my $snmp_juniper_raidDescription = "$snmp_juniper_ive.34.0";
|
||||
|
||||
my $snmp_juniper_ucdavis = '.1.3.6.1.4.1.2021';
|
||||
# Memory
|
||||
my $snmp_juniper_Memory = "$snmp_juniper_ucdavis.4";
|
||||
my $snmp_juniper_Memory_TotalSwap = "$snmp_juniper_Memory.3.0";
|
||||
my $snmp_juniper_Memory_AvailSwap = "$snmp_juniper_Memory.4.0";
|
||||
my $snmp_juniper_Memory_TotalMem = "$snmp_juniper_Memory.5.0";
|
||||
my $snmp_juniper_Memory_AvailMem = "$snmp_juniper_Memory.6.0";
|
||||
my $snmp_juniper_Memory_TotalFree = "$snmp_juniper_Memory.11.0";
|
||||
my $snmp_juniper_Memory_Shared = "$snmp_juniper_Memory.13.0";
|
||||
my $snmp_juniper_Memory_Buffer = "$snmp_juniper_Memory.14.0";
|
||||
my $snmp_juniper_Memory_Cached = "$snmp_juniper_Memory.15.0";
|
||||
# Disk
|
||||
my $snmp_juniper_Disk = "$snmp_juniper_ucdavis.9.1";
|
||||
my $snmp_juniper_Disk_Index = "$snmp_juniper_Disk.1";
|
||||
my $snmp_juniper_Disk_Total = "$snmp_juniper_Disk.6.1";
|
||||
my $snmp_juniper_Disk_Avail = "$snmp_juniper_Disk.7.1";
|
||||
my $snmp_juniper_Disk_Used = "$snmp_juniper_Disk.8.1";
|
||||
my $snmp_juniper_Disk_Used_Percent = "$snmp_juniper_Disk.9.1";
|
||||
# Load
|
||||
my $snmp_juniper_Load = "$snmp_juniper_ucdavis.10.1";
|
||||
my $snmp_juniper_Load_Index = "$snmp_juniper_Load.1";
|
||||
my $snmp_juniper_Load_Load = "$snmp_juniper_Load.3";
|
||||
my $snmp_juniper_Load_Load_1 = "$snmp_juniper_Load_Load.1";
|
||||
my $snmp_juniper_Load_Load_5 = "$snmp_juniper_Load_Load.2";
|
||||
my $snmp_juniper_Load_Load_15 = "$snmp_juniper_Load_Load.3";
|
||||
|
||||
|
||||
|
||||
### Functions
|
||||
###############
|
||||
sub _create_session(@) {
|
||||
my ($server, $comm) = @_;
|
||||
my $version = 1;
|
||||
my ($sess, $err) = Net::SNMP->session( -hostname => $server, -version => $version, -community => $comm);
|
||||
if (!defined($sess)) {
|
||||
print "Can't create SNMP session to $server\n";
|
||||
exit(1);
|
||||
}
|
||||
return $sess;
|
||||
}
|
||||
|
||||
sub FSyntaxError($) {
|
||||
my $err = shift;
|
||||
print <<EOU;
|
||||
$err
|
||||
|
||||
Syntax:
|
||||
$script_name
|
||||
-H = Ip/Dns Name of the Juniper -w = Warning Value
|
||||
-C = SNMP Community -c = Critical Value
|
||||
-T = Check type
|
||||
|
||||
## Check Types
|
||||
LOG - Log File Size
|
||||
USERS - Signed Users
|
||||
MEETINGS - Active Meetings
|
||||
CPULOAD - CPU Load
|
||||
MEM - Memory Usage
|
||||
SWAP - Swap Usage
|
||||
DISK - Disk Usage Percentage
|
||||
|
||||
# Not Implemented
|
||||
FAN - Fan Fail
|
||||
PS - Power Supply Fail
|
||||
RAID - Raid Status
|
||||
EOU
|
||||
exit($ERRORS{'UNKNOWN'});
|
||||
}
|
||||
|
||||
sub _get_oid_value(@) {
|
||||
my $sess = shift;
|
||||
my $local_oid = shift;
|
||||
my $r_return = $sess->get_request(-varbindlist => [$local_oid]);
|
||||
return($r_return->{$local_oid});
|
||||
}
|
||||
|
||||
sub _clac_err_stat(@) {
|
||||
my $value = shift;
|
||||
my $value_type = shift;
|
||||
my $tmp_warn = shift;
|
||||
my $tmp_crit = shift;
|
||||
my $unit = shift;
|
||||
my $r_msg;
|
||||
my $r_stat;
|
||||
if($value <= $tmp_warn) {
|
||||
$r_stat = $ERRORS{'OK'};
|
||||
$r_msg = "OK: $value_type $value$unit";
|
||||
} elsif($value > $tmp_warn and $value < $tmp_crit) {
|
||||
$r_stat = $ERRORS{'WARNING'};
|
||||
$r_msg = "WARN: $value_type $value$unit";
|
||||
} elsif($value >= $tmp_crit) {
|
||||
$r_stat = $ERRORS{'CRITICAL'};
|
||||
$r_msg = "CRIT: $value_type $value$unit";
|
||||
}
|
||||
return($r_msg,$r_stat);
|
||||
}
|
||||
|
||||
### Gather input from user
|
||||
#############################
|
||||
my %opt;
|
||||
$opt{'crit'} = 500;
|
||||
$opt{'warn'} = 500;
|
||||
my $result = GetOptions(\%opt,
|
||||
'host|H=s',
|
||||
'community|C=s',
|
||||
'check_type|T=s',
|
||||
'warn|w=f',
|
||||
'crit|c=f',
|
||||
);
|
||||
|
||||
FSyntaxError("Missing -H") unless defined $opt{'host'};
|
||||
FSyntaxError("Missing -C") unless defined $opt{'community'};
|
||||
FSyntaxError("Missing -T") unless defined $opt{'check_type'};
|
||||
if($opt{'warn'} > $opt{'crit'}) {
|
||||
FSyntaxError("Warning can't be larger then Critical: $opt{'warn'} > $opt{'crit'}");
|
||||
}
|
||||
|
||||
# Starting Alaram
|
||||
alarm($TIMEOUT);
|
||||
|
||||
# Establish SNMP Session
|
||||
our $snmp_session = _create_session($opt{'host'},$opt{'community'});
|
||||
|
||||
### LOG ###
|
||||
if("$opt{'check_type'}" eq "LOG") {
|
||||
my $check = _get_oid_value($snmp_session,$snmp_juniper_logFullPercent);
|
||||
($msg,$stat) = _clac_err_stat($check,$opt{'check_type'},$opt{'warn'},$opt{'crit'},'%');
|
||||
$perf = "logsize=$check\%";
|
||||
### Users ###
|
||||
} elsif("$opt{'check_type'}" eq "USERS") {
|
||||
my $check = _get_oid_value($snmp_session,$snmp_juniper_iveConcurrentUsers);
|
||||
my $u_web = _get_oid_value($snmp_session,$snmp_juniper_WebUsers);
|
||||
my $u_mail = _get_oid_value($snmp_session,$snmp_juniper_MailUsers);
|
||||
my $u_meet = _get_oid_value($snmp_session,$snmp_juniper_MeetingUsers);
|
||||
|
||||
unless($u_web) { $u_web = 0; }
|
||||
unless($u_mail) { $u_mail = 0; }
|
||||
unless($u_meet) { $u_meet = 0; }
|
||||
|
||||
($msg,$stat) = _clac_err_stat($check,$opt{'check_type'},$opt{'warn'},$opt{'crit'});
|
||||
$perf = "all_users=$check web_users=$u_web mail_users=$u_mail meeting_users=$u_meet";
|
||||
### MEETINGS ###
|
||||
} elsif("$opt{'check_type'}" eq "MEETINGS") {
|
||||
my $check = _get_oid_value($snmp_session,$snmp_juniper_MeetingCount);
|
||||
unless($check) { $check = 0; }
|
||||
($msg,$stat) = _clac_err_stat($check,$opt{'check_type'},$opt{'warn'},$opt{'crit'});
|
||||
$perf = "meetings=$check";
|
||||
### CPULOAD ###
|
||||
} elsif("$opt{'check_type'}" eq "CPULOAD") {
|
||||
my $load1 = _get_oid_value($snmp_session,$snmp_juniper_Load_Load_1);
|
||||
my $load5 = _get_oid_value($snmp_session,$snmp_juniper_Load_Load_5);
|
||||
my $load15 = _get_oid_value($snmp_session,$snmp_juniper_Load_Load_15);
|
||||
|
||||
($msg,$stat) = _clac_err_stat($load1,$opt{'check_type'},$opt{'warn'},$opt{'crit'});
|
||||
$perf = "load1min=$load1 load5min=$load5 load15min=$load15";
|
||||
### MEM ###
|
||||
} elsif("$opt{'check_type'}" eq "MEM") {
|
||||
my $r_mem_tbl = $snmp_session->get_table($snmp_juniper_Memory);
|
||||
my $Used_Mem = $$r_mem_tbl{$snmp_juniper_Memory_TotalMem} - $$r_mem_tbl{$snmp_juniper_Memory_AvailMem};
|
||||
my $Used_Percent = int(($Used_Mem / $$r_mem_tbl{$snmp_juniper_Memory_TotalMem}) * 100);
|
||||
($msg,$stat) = _clac_err_stat($Used_Percent,$opt{'check_type'},$opt{'warn'},$opt{'crit'},'%');
|
||||
$perf = "total=$$r_mem_tbl{$snmp_juniper_Memory_TotalMem}\k used=$Used_Mem shared=$$r_mem_tbl{$snmp_juniper_Memory_Shared}\k buffer=$$r_mem_tbl{$snmp_juniper_Memory_Buffer}\k cached=$$r_mem_tbl{$snmp_juniper_Memory_Cached}\k";
|
||||
### SWAP ###
|
||||
} elsif("$opt{'check_type'}" eq "SWAP") {
|
||||
my $r_mem_tbl = $snmp_session->get_table($snmp_juniper_Memory);
|
||||
my $Used_Mem = $$r_mem_tbl{$snmp_juniper_Memory_TotalSwap} - $$r_mem_tbl{$snmp_juniper_Memory_AvailSwap};
|
||||
my $Used_Percent = int(($Used_Mem / $$r_mem_tbl{$snmp_juniper_Memory_TotalSwap}) * 100);
|
||||
($msg,$stat) = _clac_err_stat($Used_Percent,$opt{'check_type'},$opt{'warn'},$opt{'crit'},'%');
|
||||
$perf = "total=$$r_mem_tbl{$snmp_juniper_Memory_TotalSwap}\k used=$Used_Mem\k";
|
||||
### DISK ###
|
||||
} elsif("$opt{'check_type'}" eq "DISK") {
|
||||
my $r_disk_tbl = $snmp_session->get_table($snmp_juniper_Disk);
|
||||
($msg,$stat) = _clac_err_stat($$r_disk_tbl{$snmp_juniper_Disk_Used_Percent},$opt{'check_type'},$opt{'warn'},$opt{'crit'},'%');
|
||||
$perf = "total=$$r_disk_tbl{$snmp_juniper_Disk_Total} used=$$r_disk_tbl{$snmp_juniper_Disk_Used}";
|
||||
### Syntax Error ###
|
||||
} else {
|
||||
FSyntaxError("$opt{'check_type'} invalid parameter !");
|
||||
}
|
||||
|
||||
|
||||
print "$msg | $perf\n";
|
||||
exit($stat);
|
||||
|
||||
399
nagios/check-netapp-ng.pl
Executable file
399
nagios/check-netapp-ng.pl
Executable file
@@ -0,0 +1,399 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
#####################################
|
||||
#####################################
|
||||
### ______ _ =) ###
|
||||
### | ___ \ | | ###
|
||||
### | |_/ / __ _ _ __ | | ###
|
||||
### | / / _` || '_ \ | | ###
|
||||
### | |\ \| (_| || | | || |____ ###
|
||||
### \_| \_|\__,_||_| |_|\_____/ ###
|
||||
#####################################
|
||||
#####################################
|
||||
|
||||
use strict;
|
||||
use lib "/path/to/nagios/libexec";
|
||||
use utils qw($TIMEOUT %ERRORS);
|
||||
use Net::SNMP;
|
||||
use Getopt::Long;
|
||||
Getopt::Long::Configure('bundling');
|
||||
|
||||
my $stat = 0;
|
||||
my $msg;
|
||||
my $perf;
|
||||
my $script_name = "check-netapp-ng.pl";
|
||||
|
||||
### SNMP OIDs
|
||||
###############
|
||||
my $snmpFailedFanCount = '.1.3.6.1.4.1.789.1.2.4.2.0';
|
||||
my $snmpFailPowerSupplyCount = '.1.3.6.1.4.1.789.1.2.4.4.0';
|
||||
my $snmpcpuBusyTimePerCent = '.1.3.6.1.4.1.789.1.2.1.3.0';
|
||||
my $snmpenvOverTemperature = '.1.3.6.1.4.1.789.1.2.4.1.0';
|
||||
my $snmpnvramBatteryStatus = '.1.3.6.1.4.1.789.1.2.5.1.0';
|
||||
my $snmpFailedDiskCount = '.1.3.6.1.4.1.789.1.6.4.7.0';
|
||||
my $snmpUpTime = '.1.3.6.1.2.1.1.3.0';
|
||||
my $snmpCacheAge = '.1.3.6.1.4.1.789.1.2.2.23.0';
|
||||
my $snmpGlobalStatus = '.1.3.6.1.4.1.789.1.2.2.4.0';
|
||||
my $snmpGlobalStatus_text = '.1.3.6.1.4.1.789.1.2.2.25.0';
|
||||
my $snmpNdmpSessions = '.1.3.6.1.4.1.789.1.10.2.0';
|
||||
|
||||
my $snmpfilesysvolTable = '.1.3.6.1.4.1.789.1.5.8';
|
||||
my $snmpfilesysvolTablevolEntryOptions = "$snmpfilesysvolTable.1.7";
|
||||
my $snmpfilesysvolTablevolEntryvolName = "$snmpfilesysvolTable.1.2";
|
||||
|
||||
my $snmp_netapp_volume_id_table_df = ".1.3.6.1.4.1.789.1.5.4.1";
|
||||
my $snmp_netapp_volume_id_table_df_name = "$snmp_netapp_volume_id_table_df.2";
|
||||
my $snmp_netapp_volume_id_table_df_total = "$snmp_netapp_volume_id_table_df.3";
|
||||
my $snmp_netapp_volume_id_table_df_used = "$snmp_netapp_volume_id_table_df.4";
|
||||
my $snmp_netapp_volume_id_table_df_free = "$snmp_netapp_volume_id_table_df.5";
|
||||
my $snmp_netapp_volume_id_table_df_used_prec = "$snmp_netapp_volume_id_table_df.6";
|
||||
|
||||
my $snmpEnclTable = '.1.3.6.1.4.1.789.1.21.1.2.1';
|
||||
my $snmpEnclTableIndex = "$snmpEnclTable.1";
|
||||
my $snmpEnclTableState = "$snmpEnclTable.2";
|
||||
my $snmpEnclTableShelfAddr = "$snmpEnclTable.3";
|
||||
my $snmpEnclTablePsFailed = "$snmpEnclTable.15";
|
||||
my $snmpEnclTableFanFailed = "$snmpEnclTable.18";
|
||||
my $snmpEnclTableTempOverFail = "$snmpEnclTable.21";
|
||||
my $snmpEnclTableTempOverWarn = "$snmpEnclTable.22";
|
||||
my $snmpEnclTableTempUnderFail = "$snmpEnclTable.23";
|
||||
my $snmpEnclTableTempUnderWarn = "$snmpEnclTable.24";
|
||||
my $snmpEnclTableElectronicFailed = "$snmpEnclTable.33";
|
||||
my $snmpEnclTableVoltOverFail = "$snmpEnclTable.36";
|
||||
my $snmpEnclTableVoltOverWarn = "$snmpEnclTable.37";
|
||||
my $snmpEnclTableVoltUnderFail = "$snmpEnclTable.38";
|
||||
my $snmpEnclTableVoltUnderWarn = "$snmpEnclTable.39";
|
||||
|
||||
|
||||
# SNMP Status Codes
|
||||
my %nvramBatteryStatus = (
|
||||
1 => 'ok',
|
||||
2 => 'partially discharged',
|
||||
3 => 'fully discharged',
|
||||
4 => 'not present',
|
||||
5 => 'near end of life',
|
||||
6 => 'at end of life',
|
||||
7 => 'unknown',
|
||||
);
|
||||
my %GlobalStatusIndex = (
|
||||
1 => 'other',
|
||||
2 => 'unknown',
|
||||
3 => 'ok',
|
||||
4 => 'nonCritical',
|
||||
5 => 'critical',
|
||||
6 => 'nonRecoverable',
|
||||
);
|
||||
my %EcnlStatusIndex = (
|
||||
1 => 'initializing',
|
||||
2 => 'transitioning',
|
||||
3 => 'active',
|
||||
4 => 'inactive',
|
||||
5 => 'reconfiguring',
|
||||
6 => 'nonexistent',
|
||||
);
|
||||
### Functions
|
||||
###############
|
||||
sub _create_session(@) {
|
||||
my ($server, $comm) = @_;
|
||||
my $version = 1;
|
||||
my ($sess, $err) = Net::SNMP->session( -hostname => $server, -version => $version, -community => $comm);
|
||||
if (!defined($sess)) {
|
||||
print "Can't create SNMP session to $server\n";
|
||||
exit(1);
|
||||
}
|
||||
return $sess;
|
||||
}
|
||||
|
||||
sub FSyntaxError($) {
|
||||
my $err = shift;
|
||||
print <<EOU;
|
||||
$err
|
||||
|
||||
Syntax:
|
||||
$script_name
|
||||
-H = Ip/Dns Name of the Filer -w = Warning Value
|
||||
-C = SNMP Community -c = Critical Value
|
||||
-T = Check type --vol = Volume Name
|
||||
-e = vol exclude from snap check
|
||||
TEMP - Temperature
|
||||
FAN - Fan Fail
|
||||
PS - Power Supply Fail
|
||||
CPULOAD - CPU Load (-w -c)
|
||||
NVRAM - NVram Battery Status
|
||||
DISKUSED - Vol Usage Precentage (-w -c --vol)
|
||||
SNAPSHOT - Snapshot Config (-e volname,volname2,volname3)
|
||||
SHELF - Shelf Health
|
||||
NDMPSESSIONS - Number of ndmp sessions (-w -c)
|
||||
GLOBALSTATUS - Global Status of the filer
|
||||
FAILEDDISK - Number of failed disks
|
||||
UPTIME - only show's uptime
|
||||
CACHEAGE - Cache Age
|
||||
|
||||
|
||||
EOU
|
||||
exit($ERRORS{'UNKNOWN'});
|
||||
}
|
||||
|
||||
sub _get_oid_value(@) {
|
||||
my $sess = shift;
|
||||
my $local_oid = shift;
|
||||
my $r_return = $sess->get_request(-varbindlist => [$local_oid]);
|
||||
return($r_return->{$local_oid});
|
||||
}
|
||||
|
||||
sub _clac_err_stat(@) {
|
||||
my $value = shift;
|
||||
my $value_type = shift;
|
||||
my $tmp_warn = shift;
|
||||
my $tmp_crit = shift;
|
||||
my $r_msg;
|
||||
my $r_stat;
|
||||
if($value <= $tmp_warn) {
|
||||
$r_stat = $ERRORS{'OK'};
|
||||
$r_msg = "OK: $value_type $value%";
|
||||
} elsif($value > $tmp_warn and $value < $tmp_crit) {
|
||||
$r_stat = $ERRORS{'WARNING'};
|
||||
$r_msg = "WARN: $value_type $value%";
|
||||
} elsif($value >= $tmp_crit) {
|
||||
$r_stat = $ERRORS{'CRITICAL'};
|
||||
$r_msg = "CRIT: $value_type $value%";
|
||||
}
|
||||
return($r_msg,$r_stat);
|
||||
}
|
||||
|
||||
### Gather input from user
|
||||
#############################
|
||||
my %opt;
|
||||
$opt{'crit'} = 500;
|
||||
$opt{'warn'} = 500;
|
||||
my $result = GetOptions(\%opt,
|
||||
'filer|H=s',
|
||||
'community|C=s',
|
||||
'check_type|T=s',
|
||||
'warn|w=i',
|
||||
'crit|c=i',
|
||||
'vol|v=s',
|
||||
'exclude|e=s',
|
||||
);
|
||||
|
||||
FSyntaxError("Missing -H") unless defined $opt{'filer'};
|
||||
FSyntaxError("Missing -C") unless defined $opt{'community'};
|
||||
FSyntaxError("Missing -T") unless defined $opt{'check_type'};
|
||||
if($opt{'vol'}) {
|
||||
if($opt{'vol'} !~ /^\/.*\/$/) {
|
||||
FSyntaxError("$opt{'vol'} format is /vol/volname/ !");
|
||||
}
|
||||
}
|
||||
if($opt{'crit'} and $opt{'warn'}) {
|
||||
if($opt{'warn'} > $opt{'crit'}) {
|
||||
FSyntaxError("Warning can't be larger then Critical: $opt{'warn'} > $opt{'crit'}");
|
||||
}
|
||||
}
|
||||
|
||||
# Starting Alaram
|
||||
alarm($TIMEOUT);
|
||||
|
||||
# Establish SNMP Session
|
||||
our $snmp_session = _create_session($opt{'filer'},$opt{'community'});
|
||||
|
||||
### Temperature ###
|
||||
if("$opt{'check_type'}" eq "TEMP") {
|
||||
my $check = _get_oid_value($snmp_session,$snmpenvOverTemperature);
|
||||
if($check == 1) {
|
||||
$stat = $ERRORS{'OK'};
|
||||
$msg = "OK: $opt{'check_type'} is ok";
|
||||
} else {
|
||||
$stat = $ERRORS{'CRITICAL'};
|
||||
$msg = "CRIT: Over $opt{'check_type'} !";
|
||||
}
|
||||
$perf = "overtemperature=$check";
|
||||
### Fan ###
|
||||
} elsif("$opt{'check_type'}" eq "FAN") {
|
||||
my $check = _get_oid_value($snmp_session,$snmpFailedFanCount);
|
||||
if($check == 0) {
|
||||
$stat = $ERRORS{'OK'};
|
||||
$msg = "OK: $opt{'check_type'} $check";
|
||||
} else {
|
||||
$stat = $ERRORS{'CRITICAL'};
|
||||
$msg = "CRIT: $opt{'check_type'} $check !";
|
||||
}
|
||||
$perf = "failedfans=$check";
|
||||
### PS ###
|
||||
} elsif("$opt{'check_type'}" eq "PS") {
|
||||
my $check = _get_oid_value($snmp_session,$snmpFailPowerSupplyCount);
|
||||
if($check == 0) {
|
||||
$stat = $ERRORS{'OK'};
|
||||
$msg = "OK: $opt{'check_type'} Fail $check";
|
||||
} else {
|
||||
$stat = $ERRORS{'CRITICAL'};
|
||||
$msg = "CRIT: $opt{'check_type'} Fail $check !";
|
||||
}
|
||||
$perf = "failedpowersupplies=$check";
|
||||
### CPULOAD ###
|
||||
} elsif("$opt{'check_type'}" eq "CPULOAD") {
|
||||
my $check = _get_oid_value($snmp_session,$snmpcpuBusyTimePerCent);
|
||||
($msg,$stat) = _clac_err_stat($check,$opt{'check_type'},$opt{'warn'},$opt{'crit'});
|
||||
$perf = "cpuload=$check\percent";
|
||||
### NVRAM ###
|
||||
} elsif("$opt{'check_type'}" eq "NVRAM") {
|
||||
my $check = _get_oid_value($snmp_session,$snmpnvramBatteryStatus);
|
||||
if($check == 1) {
|
||||
$stat = $ERRORS{'OK'};
|
||||
$msg = "OK: $opt{'check_type'} $nvramBatteryStatus{$check}";
|
||||
} else {
|
||||
$stat = $ERRORS{'CRITICAL'};
|
||||
$msg = "CRIT: $opt{'check_type'} $nvramBatteryStatus{$check}";
|
||||
}
|
||||
$perf = "nvrambatterystatus=$check";
|
||||
### DISKUSED ###
|
||||
} elsif("$opt{'check_type'}" eq "DISKUSED") {
|
||||
|
||||
FSyntaxError("Missing -vol") unless defined $opt{'vol'};
|
||||
|
||||
my $r_vol_tbl = $snmp_session->get_table($snmp_netapp_volume_id_table_df_name);
|
||||
foreach my $key ( keys %$r_vol_tbl) {
|
||||
if("$$r_vol_tbl{$key}" eq "$opt{'vol'}") {
|
||||
my @tmp_arr = split(/\./, $key);
|
||||
my $oid = pop(@tmp_arr);
|
||||
|
||||
my $used = _get_oid_value($snmp_session,"$snmp_netapp_volume_id_table_df_used.$oid");
|
||||
my $used_prec = _get_oid_value($snmp_session,"$snmp_netapp_volume_id_table_df_used_prec.$oid");
|
||||
|
||||
($msg,$stat) = _clac_err_stat($used_prec,$opt{'check_type'},$opt{'warn'},$opt{'crit'});
|
||||
|
||||
$perf = "$$r_vol_tbl{$key}=$used\k";
|
||||
}
|
||||
}
|
||||
### SNAPSHOT ###
|
||||
} elsif("$opt{'check_type'}" eq "SNAPSHOT") {
|
||||
my @exc_list = split(',',$opt{'exclude'});
|
||||
my @vol_err;
|
||||
my $r_vol_tbl = $snmp_session->get_table($snmpfilesysvolTablevolEntryvolName);
|
||||
foreach my $key ( keys %$r_vol_tbl) {
|
||||
my @tmp_arr = split(/\./, $key);
|
||||
my $oid = pop(@tmp_arr);
|
||||
my $vol_tmp = "$$r_vol_tbl{$key}";
|
||||
|
||||
my $volopt = _get_oid_value($snmp_session,"$snmpfilesysvolTablevolEntryOptions.$oid");
|
||||
|
||||
if($volopt !~ /nosnap=off/) {
|
||||
my $volcheck = 0;
|
||||
foreach my $exvol (@exc_list) {
|
||||
if($exvol eq $vol_tmp) {
|
||||
$volcheck++;
|
||||
last;
|
||||
}
|
||||
}
|
||||
if($volcheck == 0) {
|
||||
push(@vol_err,"$vol_tmp");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my $err_count = $#vol_err + 1;
|
||||
if($err_count == 0) {
|
||||
$stat = $ERRORS{'OK'};
|
||||
$msg = "OK: $opt{'check_type'} all ok";
|
||||
} else {
|
||||
$stat = $ERRORS{'CRITICAL'};
|
||||
$msg = "CRIT: $opt{'check_type'} @vol_err not configured";
|
||||
}
|
||||
$perf = "snapoff=$err_count";
|
||||
### FAILEDDISK ###
|
||||
} elsif("$opt{'check_type'}" eq "FAILEDDISK") {
|
||||
my $check = _get_oid_value($snmp_session,$snmpFailedDiskCount);
|
||||
if($check == 0) {
|
||||
$stat = $ERRORS{'OK'};
|
||||
$msg = "OK: $opt{'check_type'} $check";
|
||||
} else {
|
||||
$stat = $ERRORS{'CRITICAL'};
|
||||
$msg = "CRIT: $opt{'check_type'} $check";
|
||||
}
|
||||
$perf = "faileddisks=$check";
|
||||
|
||||
### UPTIME ###
|
||||
} elsif("$opt{'check_type'}" eq "UPTIME") {
|
||||
my $check = _get_oid_value($snmp_session,$snmpUpTime);
|
||||
$msg = "$opt{'check_type'}: $check";
|
||||
### CACHEAGE ###
|
||||
} elsif("$opt{'check_type'}" eq "CACHEAGE") {
|
||||
my $check = _get_oid_value($snmp_session,$snmpCacheAge);
|
||||
($msg,$stat) = _clac_err_stat($check,$opt{'check_type'},$opt{'warn'},$opt{'crit'});
|
||||
$perf = "cache_age=$check";
|
||||
### GLOBALSTATUS ###
|
||||
} elsif("$opt{'check_type'}" eq "GLOBALSTATUS") {
|
||||
my $check = _get_oid_value($snmp_session,$snmpGlobalStatus);
|
||||
my $global_stat_txt = _get_oid_value($snmp_session,$snmpGlobalStatus_text);
|
||||
if($check == 3) {
|
||||
$stat = $ERRORS{'OK'};
|
||||
$msg = "OK: $opt{'check_type'} $GlobalStatusIndex{$check} $check $global_stat_txt";
|
||||
} else {
|
||||
$stat = $ERRORS{'CRITICAL'};
|
||||
$msg = "CRIT: $opt{'check_type'} $GlobalStatusIndex{$check} $check $global_stat_txt";
|
||||
}
|
||||
$perf = "globalstatus=$check";
|
||||
### NDMPSESSIONS ###
|
||||
} elsif("$opt{'check_type'}" eq "NDMPSESSIONS") {
|
||||
my $check = _get_oid_value($snmp_session,$snmpNdmpSessions);
|
||||
($msg,$stat) = _clac_err_stat($check,$opt{'check_type'},$opt{'warn'},$opt{'crit'});
|
||||
$perf = "ndmpsess=$check";
|
||||
### SHELF ###
|
||||
} elsif("$opt{'check_type'}" eq "SHELF") {
|
||||
my @errs;
|
||||
my $r_shelf = $snmp_session->get_table($snmpEnclTableIndex);
|
||||
foreach my $key ( keys %$r_shelf) {
|
||||
my @tmp_arr = split(/\./, $key);
|
||||
my $oid = pop(@tmp_arr);
|
||||
|
||||
my %shelf;
|
||||
my @shelf_err;
|
||||
my $addr = _get_oid_value($snmp_session,"$snmpEnclTableShelfAddr.$oid");
|
||||
|
||||
my $shelf_state = _get_oid_value($snmp_session,"$snmpEnclTableState.$oid");
|
||||
|
||||
if($shelf_state != 3) {
|
||||
push(@shelf_err,"$addr state $EcnlStatusIndex{$shelf_state},");
|
||||
}
|
||||
|
||||
$shelf{'PsFail'} = _get_oid_value($snmp_session,"$snmpEnclTablePsFailed.$oid");
|
||||
$shelf{'FanFail'} = _get_oid_value($snmp_session,"$snmpEnclTableFanFailed.$oid");
|
||||
$shelf{'ElectFail'} = _get_oid_value($snmp_session,"$snmpEnclTableElectronicFailed.$oid");
|
||||
$shelf{'TempOverFail'} = _get_oid_value($snmp_session,"$snmpEnclTableTempOverFail.$oid");
|
||||
$shelf{'TempOver'} = _get_oid_value($snmp_session,"$snmpEnclTableTempOverWarn.$oid");
|
||||
$shelf{'TempUnderFail'} = _get_oid_value($snmp_session,"$snmpEnclTableTempUnderFail.$oid");
|
||||
$shelf{'TempUnderWarn'} = _get_oid_value($snmp_session,"$snmpEnclTableTempUnderWarn.$oid");
|
||||
$shelf{'VoltOverFail'} = _get_oid_value($snmp_session,"$snmpEnclTableVoltOverFail.$oid");
|
||||
$shelf{'VoltOverWarn'} = _get_oid_value($snmp_session,"$snmpEnclTableVoltOverWarn.$oid");
|
||||
$shelf{'VoltUnderFail'} = _get_oid_value($snmp_session,"$snmpEnclTableVoltUnderFail.$oid");
|
||||
$shelf{'VoltUnderWarn'} = _get_oid_value($snmp_session,"$snmpEnclTableVoltUnderWarn.$oid");
|
||||
|
||||
foreach my $subkey ( keys %shelf) {
|
||||
print "$subkey\t$shelf{$subkey}\n";
|
||||
if($shelf{$subkey}) { push(@shelf_err,"$addr $subkey,") }
|
||||
}
|
||||
if($#shelf_err != -1) {
|
||||
push(@errs,@shelf_err)
|
||||
}
|
||||
}
|
||||
|
||||
if($#errs == -1) {
|
||||
$stat = $ERRORS{'OK'};
|
||||
$msg = "OK: $opt{'check_type'} ok";
|
||||
$perf = "shelf=0";
|
||||
} else {
|
||||
$stat = $ERRORS{'CRITICAL'};
|
||||
$msg = "CRIT: $opt{'check_type'} Errors -";
|
||||
foreach(@errs) {
|
||||
$msg = "$msg $_";
|
||||
}
|
||||
$perf = "shelf=1";
|
||||
}
|
||||
### Syntax Error ###
|
||||
} else {
|
||||
FSyntaxError("$opt{'check_type'} invalid parameter !");
|
||||
}
|
||||
|
||||
|
||||
print "$msg | $perf\n";
|
||||
exit($stat);
|
||||
|
||||
117
nagios/check-paloalto-A500.pl
Executable file
117
nagios/check-paloalto-A500.pl
Executable file
@@ -0,0 +1,117 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
#####################################
|
||||
#####################################
|
||||
### ______ _ =) ###
|
||||
### | ___ \ | | ###
|
||||
### | |_/ / __ _ _ __ | | ###
|
||||
### | / / _` || '_ \ | | ###
|
||||
### | |\ \| (_| || | | || |____ ###
|
||||
### \_| \_|\__,_||_| |_|\_____/ ###
|
||||
#####################################
|
||||
#####################################
|
||||
|
||||
use strict;
|
||||
use Net::SNMP;
|
||||
my $stat;
|
||||
my $msg;
|
||||
my $perf;
|
||||
my $script_name = "check-paloalto-A500.pl";
|
||||
|
||||
### SNMP OIDs
|
||||
###############
|
||||
my $s_cpu_mgmt = '.1.3.6.1.2.1.25.3.3.1.2.1';
|
||||
my $s_cpu_data = '.1.3.6.1.2.1.25.3.3.1.2.2';
|
||||
|
||||
### Functions
|
||||
###############
|
||||
sub _create_session {
|
||||
my ($server, $comm) = @_;
|
||||
my $version = 1;
|
||||
my ($sess, $err) = Net::SNMP->session( -hostname => $server, -version => $version, -community => $comm);
|
||||
if (!defined($sess)) {
|
||||
print "Can't create SNMP session to $server\n";
|
||||
exit(1);
|
||||
}
|
||||
return $sess;
|
||||
}
|
||||
|
||||
sub FSyntaxError {
|
||||
print "Syntax Error !\n";
|
||||
# print "$0 -H [ip|dnsname] -C [snmp community] -t [temp|fan|ps|cpu|mem|module|freeint] -w [warning value] -c [critical value] -d [days]\n";
|
||||
print "$script_name\n";
|
||||
print "-H = Ip/Dns Name of the FW\n";
|
||||
print "-C = SNMP Community\n";
|
||||
print "-t = Check type (currently only cpu)\n";
|
||||
print "-w = Warning Value\n";
|
||||
print "-c = Critical Value\n";
|
||||
exit(3);
|
||||
}
|
||||
|
||||
if($#ARGV != 9) {
|
||||
FSyntaxError;
|
||||
}
|
||||
|
||||
### Gather input from user
|
||||
#############################
|
||||
my $switch;
|
||||
my $community;
|
||||
my $check_type;
|
||||
my $warn = 0;
|
||||
my $crit = 0;
|
||||
my $int;
|
||||
|
||||
while(@ARGV) {
|
||||
my $temp = shift(@ARGV);
|
||||
if("$temp" eq '-H') {
|
||||
$switch = shift(@ARGV);
|
||||
} elsif("$temp" eq '-C') {
|
||||
$community = shift(@ARGV);
|
||||
} elsif("$temp" eq '-t') {
|
||||
$check_type = shift(@ARGV);
|
||||
} elsif("$temp" eq '-w') {
|
||||
$warn = shift(@ARGV);
|
||||
} elsif("$temp" eq '-c') {
|
||||
$crit = shift(@ARGV);
|
||||
} else {
|
||||
FSyntaxError();
|
||||
}
|
||||
}
|
||||
|
||||
# Validate Warning
|
||||
if($warn > $crit) {
|
||||
print "Warning can't be larger then Critical: $warn > $crit\n";
|
||||
FSyntaxError();
|
||||
}
|
||||
|
||||
# Establish SNMP Session
|
||||
our $snmp_session = _create_session($switch,$community);
|
||||
|
||||
### CPU ###
|
||||
if($check_type eq "cpu") {
|
||||
my $R_mgmt = $snmp_session->get_request(-varbindlist => [$s_cpu_mgmt]);
|
||||
my $mgmt = "$R_mgmt->{$s_cpu_mgmt}";
|
||||
my $R_data = $snmp_session->get_request(-varbindlist => [$s_cpu_data]);
|
||||
my $data = "$R_data->{$s_cpu_data}";
|
||||
|
||||
if($mgmt > $crit or $data > $crit) {
|
||||
$msg = "CRIT: Mgmt - $mgmt, Data - $data";
|
||||
$stat = 2;
|
||||
} elsif($mgmt > $warn or $data > $warn) {
|
||||
$msg = "WARN: Mgmt - $mgmt, Data - $data";
|
||||
$stat = 1;
|
||||
} else {
|
||||
$msg = "OK: Mgmt - $mgmt, Data - $data";
|
||||
$stat = 0;
|
||||
}
|
||||
$perf = "mgmt=$mgmt;data=$data;$warn;$crit";
|
||||
|
||||
### Bad Syntax ###
|
||||
|
||||
} else {
|
||||
FSyntaxError();
|
||||
}
|
||||
|
||||
|
||||
print "$msg | $perf\n";
|
||||
exit($stat);
|
||||
208
nagios/check-pineapp.pl
Executable file
208
nagios/check-pineapp.pl
Executable file
@@ -0,0 +1,208 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
#####################################
|
||||
#####################################
|
||||
### ______ _ =) ###
|
||||
### | ___ \ | | ###
|
||||
### | |_/ / __ _ _ __ | | ###
|
||||
### | / / _` || '_ \ | | ###
|
||||
### | |\ \| (_| || | | || |____ ###
|
||||
### \_| \_|\__,_||_| |_|\_____/ ###
|
||||
#####################################
|
||||
#####################################
|
||||
|
||||
use strict;
|
||||
use lib "/path/to/nagios/libexec";
|
||||
use utils qw($TIMEOUT %ERRORS);
|
||||
use Net::SNMP;
|
||||
use Getopt::Long;
|
||||
Getopt::Long::Configure('bundling');
|
||||
|
||||
my $stat = $ERRORS{'OK'};
|
||||
my $msg;
|
||||
my $perf;
|
||||
my $script_name = "check-pineapp.pl";
|
||||
|
||||
### SNMP OIDs
|
||||
###############
|
||||
# CPULOAD
|
||||
my $snmp_pineapp_cpuload = '.1.3.6.1.4.1.19801.1.1.3';
|
||||
my $snmp_pineapp_cpuload_1min = "$snmp_pineapp_cpuload.1.0";
|
||||
my $snmp_pineapp_cpuload_5min = "$snmp_pineapp_cpuload.2.0";
|
||||
my $snmp_pineapp_cpuload_15min = "$snmp_pineapp_cpuload.3.0";
|
||||
# Services
|
||||
my $snmp_pineapp_services = '.1.3.6.1.4.1.19801.2.1';
|
||||
my $snmp_pineapp_services_smtp = "$snmp_pineapp_services.1.0";
|
||||
my $snmp_pineapp_services_pop3 = "$snmp_pineapp_services.2.0";
|
||||
my $snmp_pineapp_services_imap4 = "$snmp_pineapp_services.3.0";
|
||||
my $snmp_pineapp_services_av = '.1.3.6.1.4.1.19801.2.5.1.0';
|
||||
# Queue
|
||||
my $snmp_pineapp_queues = "$snmp_pineapp_services.10";
|
||||
my $snmp_pineapp_queues_in = "$snmp_pineapp_queues.1.0";
|
||||
my $snmp_pineapp_queues_out = "$snmp_pineapp_queues.2.0";
|
||||
my $snmp_pineapp_queues_high = "$snmp_pineapp_queues.3.1.0";
|
||||
my $snmp_pineapp_queues_normal = "$snmp_pineapp_queues.3.2.0";
|
||||
my $snmp_pineapp_queues_low = "$snmp_pineapp_queues.3.3.0";
|
||||
my $snmp_pineapp_queues_total = "$snmp_pineapp_queues.3.4.0";
|
||||
my $snmp_pineapp_averageProcessingTimePerMsg = ".1.3.6.1.4.1.19801.2.2.1.4.0";
|
||||
# Misc
|
||||
my $snmp_pineapp_storage = '.1.3.6.1.4.1.19801.1.4.0';
|
||||
|
||||
### Functions
|
||||
###############
|
||||
sub _create_session(@) {
|
||||
my ($server, $comm) = @_;
|
||||
my $version = 1;
|
||||
my ($sess, $err) = Net::SNMP->session( -hostname => $server, -version => $version, -community => $comm);
|
||||
if (!defined($sess)) {
|
||||
print "Can't create SNMP session to $server\n";
|
||||
exit(1);
|
||||
}
|
||||
return $sess;
|
||||
}
|
||||
|
||||
sub FSyntaxError($) {
|
||||
my $err = shift;
|
||||
print <<EOU;
|
||||
$err
|
||||
|
||||
Syntax:
|
||||
$script_name
|
||||
-H = Ip/Dns Name of the Pineapp -w = Warning Value
|
||||
-C = SNMP Community -c = Critical Value
|
||||
-T = Check type
|
||||
|
||||
## Check Types
|
||||
SERVICES - Check if smtp,imap4,pop3,av are up
|
||||
CPULOAD - CPU Load
|
||||
DISK - Check the storage status
|
||||
MSGPERSEC - Average Time in seconds of proccesing 1 Msg
|
||||
INOUT - Queue Inbound/Outbound status (in=+ out=-) (no -w -c)
|
||||
QUEUE - Queue Priority Status (-w and -c apply to total amount of msg in the queue)
|
||||
EOU
|
||||
exit($ERRORS{'UNKNOWN'});
|
||||
}
|
||||
|
||||
sub _get_oid_value(@) {
|
||||
my $sess = shift;
|
||||
my $local_oid = shift;
|
||||
my $r_return = $sess->get_request(-varbindlist => [$local_oid]);
|
||||
return($r_return->{$local_oid});
|
||||
}
|
||||
|
||||
sub _clac_err_stat(@) {
|
||||
my $value = shift;
|
||||
my $value_type = shift;
|
||||
my $tmp_warn = shift;
|
||||
my $tmp_crit = shift;
|
||||
my $unit = shift;
|
||||
my $r_msg;
|
||||
my $r_stat;
|
||||
if($value <= $tmp_warn) {
|
||||
$r_stat = $ERRORS{'OK'};
|
||||
$r_msg = "OK: $value_type $value$unit";
|
||||
} elsif($value > $tmp_warn and $value < $tmp_crit) {
|
||||
$r_stat = $ERRORS{'WARNING'};
|
||||
$r_msg = "WARN: $value_type $value$unit";
|
||||
} elsif($value >= $tmp_crit) {
|
||||
$r_stat = $ERRORS{'CRITICAL'};
|
||||
$r_msg = "CRIT: $value_type $value$unit";
|
||||
}
|
||||
return($r_msg,$r_stat);
|
||||
}
|
||||
|
||||
### Gather input from user
|
||||
#############################
|
||||
my %opt;
|
||||
$opt{'crit'} = 500;
|
||||
$opt{'warn'} = 500;
|
||||
my $result = GetOptions(\%opt,
|
||||
'host|H=s',
|
||||
'community|C=s',
|
||||
'check_type|T=s',
|
||||
'warn|w=f',
|
||||
'crit|c=f',
|
||||
);
|
||||
|
||||
FSyntaxError("Missing -H") unless defined $opt{'host'};
|
||||
FSyntaxError("Missing -C") unless defined $opt{'community'};
|
||||
FSyntaxError("Missing -T") unless defined $opt{'check_type'};
|
||||
if($opt{'warn'} > $opt{'crit'}) {
|
||||
FSyntaxError("Warning can't be larger then Critical: $opt{'warn'} > $opt{'crit'}");
|
||||
}
|
||||
|
||||
# Starting Alaram
|
||||
alarm($TIMEOUT);
|
||||
|
||||
# Establish SNMP Session
|
||||
our $snmp_session = _create_session($opt{'host'},$opt{'community'});
|
||||
|
||||
# Start Check !
|
||||
### CPULOAD ###
|
||||
if("$opt{'check_type'}" eq "CPULOAD") {
|
||||
my $check = $snmp_session->get_table($snmp_pineapp_cpuload);
|
||||
($msg,$stat) = _clac_err_stat($$check{$snmp_pineapp_cpuload_1min},$opt{'check_type'},$opt{'warn'},$opt{'crit'});
|
||||
$perf = "load1=$$check{$snmp_pineapp_cpuload_1min} load5=$$check{$snmp_pineapp_cpuload_5min} load15=$$check{$snmp_pineapp_cpuload_15min}";
|
||||
### SERVICES ###
|
||||
} elsif("$opt{'check_type'}" eq "SERVICES") {
|
||||
my %check = (
|
||||
'smtp' => _get_oid_value($snmp_session,$snmp_pineapp_services_smtp),
|
||||
'pop3' => _get_oid_value($snmp_session,$snmp_pineapp_services_pop3),
|
||||
'imap4' => _get_oid_value($snmp_session,$snmp_pineapp_services_imap4),
|
||||
'av' => _get_oid_value($snmp_session,$snmp_pineapp_services_av)
|
||||
);
|
||||
|
||||
my $count = 0;
|
||||
foreach my $srv ( keys %check) {
|
||||
if($check{$srv} == 0 ){
|
||||
$msg = "$msg, $srv is down";
|
||||
$stat = $ERRORS{'CRITICAL'};
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
if($count == 0) {
|
||||
$msg = "OK: All Services Ok !";
|
||||
} else {
|
||||
$msg = "CRIT: $msg";
|
||||
}
|
||||
|
||||
$perf = "down_srv=$count";
|
||||
### DISK ###
|
||||
} elsif("$opt{'check_type'}" eq "DISK") {
|
||||
my $check = _get_oid_value($snmp_session,$snmp_pineapp_storage);
|
||||
if($check eq "OK") {
|
||||
$stat = $ERRORS{'OK'};
|
||||
$msg = "OK: $opt{'check_type'} $check";
|
||||
$perf = "disk_err=0";
|
||||
} else {
|
||||
$stat = $ERRORS{'CRITICAL'};
|
||||
$msg = "CRIT: $opt{'check_type'} $check";
|
||||
$perf = "disk_err=1";
|
||||
}
|
||||
### MSGPERSEC ###
|
||||
} elsif("$opt{'check_type'}" eq "MSGPERSEC") {
|
||||
my $check = _get_oid_value($snmp_session,$snmp_pineapp_averageProcessingTimePerMsg);
|
||||
($msg,$stat) = _clac_err_stat($check,$opt{'check_type'},$opt{'warn'},$opt{'crit'},"sec");
|
||||
$perf = "msgPersec=$check\sec";
|
||||
### INOUT ###
|
||||
} elsif("$opt{'check_type'}" eq "INOUT") {
|
||||
my $in = _get_oid_value($snmp_session,$snmp_pineapp_queues_in);
|
||||
my $out = _get_oid_value($snmp_session,$snmp_pineapp_queues_out);
|
||||
$msg = "OK: $opt{'check_type'} (Preformance Only)";
|
||||
$perf = "in=$in\msg out=-$out\msg";
|
||||
### QUEUE ###
|
||||
} elsif("$opt{'check_type'}" eq "QUEUE") {
|
||||
my $high = _get_oid_value($snmp_session,$snmp_pineapp_queues_high);
|
||||
my $normal = _get_oid_value($snmp_session,$snmp_pineapp_queues_normal);
|
||||
my $low = _get_oid_value($snmp_session,$snmp_pineapp_queues_low);
|
||||
my $total = _get_oid_value($snmp_session,$snmp_pineapp_queues_total);
|
||||
($msg,$stat) = _clac_err_stat($total,$opt{'check_type'},$opt{'warn'},$opt{'crit'},"msg");
|
||||
$perf = "total=$total\msg low=$low\msg normal=$normal\msg high=$high\msg";
|
||||
} else {
|
||||
FSyntaxError("$opt{'check_type'} invalid parameter !");
|
||||
}
|
||||
|
||||
|
||||
print "$msg | $perf\n";
|
||||
exit($stat);
|
||||
131
nagios/check-roomalert.pl
Executable file
131
nagios/check-roomalert.pl
Executable file
@@ -0,0 +1,131 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
#####################################
|
||||
#####################################
|
||||
### ______ _ =) ###
|
||||
### | ___ \ | | ###
|
||||
### | |_/ / __ _ _ __ | | ###
|
||||
### | / / _` || '_ \ | | ###
|
||||
### | |\ \| (_| || | | || |____ ###
|
||||
### \_| \_|\__,_||_| |_|\_____/ ###
|
||||
#####################################
|
||||
#####################################
|
||||
|
||||
# Info
|
||||
# Checks AVTECH Room alert devices tempeture via SNMP
|
||||
|
||||
use strict;
|
||||
use Net::SNMP;
|
||||
use Getopt::Long; Getopt::Long::Configure('bundling');
|
||||
|
||||
my $stat = 0;
|
||||
my $msg = "RoomAlert";
|
||||
my $perf;
|
||||
my $script_name = "check-roomalert.pl";
|
||||
|
||||
### SNMP OIDs
|
||||
###############
|
||||
my $s_internal = '.1.3.6.1.4.1.20916.1.6.1.1.1.2.0';
|
||||
my $s_external = '.1.3.6.1.4.1.20916.1.6.1.2.1.1.0';
|
||||
|
||||
### Functions
|
||||
###############
|
||||
sub _create_session {
|
||||
my ($server, $comm) = @_;
|
||||
my $version = 1;
|
||||
my ($sess, $err) = Net::SNMP->session( -hostname => $server, -version => $version, -community => $comm);
|
||||
if (!defined($sess)) {
|
||||
print "Can't create SNMP session to $server\n";
|
||||
exit(1);
|
||||
}
|
||||
return $sess;
|
||||
}
|
||||
|
||||
sub _get_oid_value(@) {
|
||||
my $sess = shift;
|
||||
my $local_oid = shift;
|
||||
my $r_return = $sess->get_request(-varbindlist => [$local_oid]);
|
||||
return($r_return->{$local_oid});
|
||||
}
|
||||
|
||||
sub FSyntaxError($) {
|
||||
my $err = shift;
|
||||
print <<EOU;
|
||||
$err
|
||||
|
||||
-H = Ip/Dns Name of the FW
|
||||
-C = SNMP Community
|
||||
-w = Warning Value -> internal,external
|
||||
-c = Critical Value -> internal,external
|
||||
EOU
|
||||
exit(1);
|
||||
}
|
||||
|
||||
my %opt;
|
||||
my $result = GetOptions(\%opt,
|
||||
'host|H=s',
|
||||
'com|C=s',
|
||||
'warn|w=s',
|
||||
'crit|c=s',
|
||||
);
|
||||
|
||||
FSyntaxError("Missing -H") unless defined $opt{'host'};
|
||||
FSyntaxError("Missing -C") unless defined $opt{'com'};
|
||||
FSyntaxError("Missing -w") unless defined $opt{'warn'};
|
||||
FSyntaxError("Missing -c") unless defined $opt{'crit'};
|
||||
|
||||
|
||||
# Validate Warning
|
||||
my @warn = split(",",$opt{'warn'});
|
||||
my @crit = split(",",$opt{'crit'});
|
||||
if($warn[0] > $crit[0]) {
|
||||
FSyntaxError("Warning can't be larger then Critical: $warn[0] > $crit[0]");
|
||||
}
|
||||
if($warn[1] > $crit[1]) {
|
||||
FSyntaxError("Warning can't be larger then Critical: $warn[1] > $crit[1]");
|
||||
}
|
||||
|
||||
# Establish SNMP Session
|
||||
our $snmp_session = _create_session($opt{'host'},$opt{'com'});
|
||||
my $internal = _get_oid_value($snmp_session,$s_internal);
|
||||
my $external = _get_oid_value($snmp_session,$s_external);
|
||||
$internal = int(substr($internal,0,2) . "." . substr($internal,2,2));
|
||||
$external = int(substr($external,0,2) . "." . substr($external,2,2));
|
||||
|
||||
my $istat = 0;
|
||||
my $estat = 0;
|
||||
|
||||
# Check Internal
|
||||
if($internal >= $crit[0]) {
|
||||
$istat=2;
|
||||
} elsif($internal >= $warn[0] and $internal < $crit[0]) {
|
||||
$istat=1;
|
||||
} else {
|
||||
$istat=0;
|
||||
}
|
||||
|
||||
# Check External
|
||||
if($external >= $crit[1]) {
|
||||
$estat=2;
|
||||
} elsif($external >= $warn[1] and $external < $crit[1]) {
|
||||
$estat=1;
|
||||
} else {
|
||||
$estat=0;
|
||||
}
|
||||
|
||||
if($istat == 2 or $estat == 2) {
|
||||
$stat = 2;
|
||||
$msg = "CRIT: $msg";
|
||||
} elsif($istat == 1 or $estat == 1) {
|
||||
$stat = 1;
|
||||
$msg = "WARN: $msg";
|
||||
} else {
|
||||
$stat = 0;
|
||||
$msg = "OK: $msg";
|
||||
}
|
||||
|
||||
# Perf Data
|
||||
$perf="internal=$internal external=$external";
|
||||
|
||||
print "$msg | $perf\n";
|
||||
exit($stat);
|
||||
43
nagios/check_flexlm.pl
Executable file
43
nagios/check_flexlm.pl
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
#####################################
|
||||
#####################################
|
||||
### ______ _ =) ###
|
||||
### | ___ \ | | ###
|
||||
### | |_/ / __ _ _ __ | | ###
|
||||
### | / / _` || '_ \ | | ###
|
||||
### | |\ \| (_| || | | || |____ ###
|
||||
### \_| \_|\__,_||_| |_|\_____/ ###
|
||||
#####################################
|
||||
#####################################
|
||||
|
||||
# Info
|
||||
# This script is mainly for performance graph using pnp the usage of the license
|
||||
|
||||
use strict;
|
||||
|
||||
sub FSyntaxError {
|
||||
print "Syntax Error !\n";
|
||||
print "$0 [absolute path to lmutil] [absolute path to license file] [feature full name (from lmstat)]\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if($#ARGV != 3) {
|
||||
FSyntaxError;
|
||||
}
|
||||
|
||||
# General Settings
|
||||
my $lmutil = "$ARGV[0]"; chomp($lmutil);
|
||||
my $lm_file = "$ARGV[1]"; chomp($lm_file);
|
||||
my $feature = "$ARGV[2]"; chomp($feature);
|
||||
my $daemon = "$ARGV[3]";
|
||||
my $vendor = `basename $lm_file | sed 's/.lic//g'`; chomp($vendor);
|
||||
|
||||
my @lmstat_out = split(";",`$lmutil lmstat -c $lm_file -S $daemon | grep ^Users\\ of\\ $feature: | sed -e 's/:/;/g' -e 's/ (Total of //g' -e 's/ Total of //g' -e 's/ licenses issued//g' -e 's/ licenses in use)\$//g' -e 's/ license issued//g' -e 's/ license in use)\$//g' -e 's/^Users of //g'`);
|
||||
if($#lmstat_out < 1) {
|
||||
print "$vendor $daemon Is Down\n";
|
||||
exit(2);
|
||||
}
|
||||
|
||||
print "$vendor $daemon $feature | total=$lmstat_out[1] used=$lmstat_out[2]\n";
|
||||
exit(0);
|
||||
41
nagios/check_flexlm_up.sh
Executable file
41
nagios/check_flexlm_up.sh
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
|
||||
#####################################
|
||||
#####################################
|
||||
### ______ _ =) ###
|
||||
### | ___ \ | | ###
|
||||
### | |_/ / __ _ _ __ | | ###
|
||||
### | / / _` || '_ \ | | ###
|
||||
### | |\ \| (_| || | | || |____ ###
|
||||
### \_| \_|\__,_||_| |_|\_____/ ###
|
||||
#####################################
|
||||
#####################################
|
||||
|
||||
# Settings
|
||||
|
||||
lmutil="/path/to/lmutil"
|
||||
|
||||
function FError() {
|
||||
echo "Syntax:"
|
||||
echo "$0 [licesnse server dns name] [port #]"
|
||||
exit 3
|
||||
}
|
||||
|
||||
if [ $# != 2 ]
|
||||
then
|
||||
FError
|
||||
fi
|
||||
|
||||
server=$1
|
||||
port=$2
|
||||
|
||||
$lmutil lmstat -c ${port}@${server} &> /dev/null
|
||||
ERR=$?
|
||||
if [ $ERR == 0 ]
|
||||
then
|
||||
echo "Flexlm: OK - ${port}@${server}| flexlm=1"
|
||||
exit 0
|
||||
else
|
||||
echo "Flexlm: Crit - ${port}@${server} | flexlm=0"
|
||||
exit 2
|
||||
fi
|
||||
58
nagios/check_internet.sh
Executable file
58
nagios/check_internet.sh
Executable file
@@ -0,0 +1,58 @@
|
||||
#!/bin/bash
|
||||
|
||||
#####################################
|
||||
#####################################
|
||||
### ______ _ =) ###
|
||||
### | ___ \ | | ###
|
||||
### | |_/ / __ _ _ __ | | ###
|
||||
### | / / _` || '_ \ | | ###
|
||||
### | |\ \| (_| || | | || |____ ###
|
||||
### \_| \_|\__,_||_| |_|\_____/ ###
|
||||
#####################################
|
||||
#####################################
|
||||
|
||||
# Checking User Input
|
||||
function FError()
|
||||
{
|
||||
echo "Syntax:"
|
||||
echo "$0 [url] [number of tries] [time out]"
|
||||
echo "Example:"
|
||||
echo "$0 www.google.com 2 5"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ $# != 3 ]
|
||||
then
|
||||
FError
|
||||
fi
|
||||
|
||||
url="$1"
|
||||
|
||||
if [ `echo $2 | grep -q ^[[:digit:]]*$ ; echo $?` == 0 ]
|
||||
then
|
||||
tries="$2"
|
||||
else
|
||||
FError
|
||||
fi
|
||||
|
||||
if [ `echo $3 | grep -q ^[[:digit:]]*$ ; echo $?` == 0 ]
|
||||
then
|
||||
timeout="$3"
|
||||
else
|
||||
FError
|
||||
fi
|
||||
|
||||
wget=`which wget`
|
||||
|
||||
|
||||
wget_code=`$wget $url -q -O /dev/null -t $tries --timeout $timeout ; echo $?`
|
||||
|
||||
if [ $wget_code == 0 ]
|
||||
then
|
||||
echo "Internet Access Ok - $url | internet=1;0;0"
|
||||
exit 0
|
||||
else
|
||||
echo "Internet Access Failed - $url | internet=0;0;0"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
116
nagios/check_sgeexec.pl
Executable file
116
nagios/check_sgeexec.pl
Executable file
@@ -0,0 +1,116 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
#####################################
|
||||
#####################################
|
||||
### ______ _ =) ###
|
||||
### | ___ \ | | ###
|
||||
### | |_/ / __ _ _ __ | | ###
|
||||
### | / / _` || '_ \ | | ###
|
||||
### | |\ \| (_| || | | || |____ ###
|
||||
### \_| \_|\__,_||_| |_|\_____/ ###
|
||||
#####################################
|
||||
#####################################
|
||||
|
||||
use strict;
|
||||
use XML::Simple;
|
||||
|
||||
sub FSyntaxError {
|
||||
print "Syntax Error !\n";
|
||||
print "$0 [s|q] [absolute path to settings.sh] [hostname] [queue name]\n";
|
||||
print "s = Status of the exec hosts: check for Error status, and if he has a queue instance enabled\n";
|
||||
print "q = check via qrsh is the host accepts jobs (you can configure a queue for all the exec hosts with access list only to nagios for the sake of this check)\n\n"
|
||||
print "Example:\n";
|
||||
print "$0 q /path/to/settings.sh quad-8g1 nagios.q\n";
|
||||
print "$0 s /path/to/settings.sh quad-8g1 [queues,to,exclude]\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
# User Input
|
||||
if($#ARGV < 2) {
|
||||
FSyntaxError;
|
||||
}
|
||||
my $check_type = shift(@ARGV);
|
||||
my $sge_settings = shift(@ARGV);
|
||||
my $sgeexecd = shift(@ARGV);
|
||||
|
||||
|
||||
# General Settings
|
||||
my $exit = 0;
|
||||
my $perf;
|
||||
my $msg;
|
||||
|
||||
if("$check_type" eq "q") {
|
||||
# Check via qrsh
|
||||
my $queue = shift(@ARGV);
|
||||
my $qrsh = `source $sge_settings ; qrsh -q $queue\@$sgeexecd hostname &> /dev/null ; echo \$?`;
|
||||
chomp($qrsh);
|
||||
if($qrsh != 0) {
|
||||
$exit = 2;
|
||||
$perf = "qrsh=0";
|
||||
$msg = "$queue\@$sgeexecd cant execute jobs";
|
||||
} else {
|
||||
$perf = "qrsh=1";
|
||||
$msg = "$queue\@$sgeexecd can execute jobs";
|
||||
}
|
||||
} elsif("$check_type" eq "s") {
|
||||
# Check Host's queue instance Status
|
||||
my $queue_list_2_exclude = shift(@ARGV);
|
||||
my @queues2ex = split(',',$queue_list_2_exclude);
|
||||
my $queue_instances = 0;
|
||||
my $queue_instances_err = 0;
|
||||
$perf = "qstatus=1";
|
||||
my @qstat_out = split("\n",`source $sge_settings ; qhost -q -h $sgeexecd`); shift(@qstat_out);shift(@qstat_out);shift(@qstat_out);shift(@qstat_out);
|
||||
|
||||
foreach my $line (@qstat_out) {
|
||||
my @cline = split(" ",$line);
|
||||
my $yes_exclude = 0;
|
||||
foreach my $q (@queues2ex) {
|
||||
if($q eq $cline[0]) {
|
||||
$yes_exclude++;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
if($yes_exclude == 0) {
|
||||
if($cline[3] =~ /E/) {
|
||||
$msg = "$msg $cline[0]\@$sgeexecd in Error status.";
|
||||
$queue_instances_err++;
|
||||
}
|
||||
unless($cline[3] =~ /d/) {
|
||||
$queue_instances++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($queue_instances == 0 or $queue_instances_err > 0) {
|
||||
if($queue_instances_err > 0) {
|
||||
$perf = "qstatus=$queue_instances_err";
|
||||
} else {
|
||||
$perf = "qstatus=0";
|
||||
}
|
||||
if($queue_instances == 0) {
|
||||
$perf = "$perf qconfigured=0";
|
||||
$msg = "$msg $sgeexecd dont have any queue configured.";
|
||||
} else {
|
||||
$perf = "$perf qconfigured=$queue_instances";
|
||||
}
|
||||
$exit = 2;
|
||||
} else {
|
||||
$exit = 0;
|
||||
$msg = "$sgeexecd is OK";
|
||||
$perf = "qstatus=0 qconfigured=$queue_instances";
|
||||
}
|
||||
} else {
|
||||
FSyntaxError;
|
||||
}
|
||||
|
||||
|
||||
# Display Message
|
||||
if($exit == 0) {
|
||||
$msg = "OK: $msg";
|
||||
} else {
|
||||
$msg = "Error: $msg";
|
||||
}
|
||||
print "$msg | $perf\n";
|
||||
exit($exit);
|
||||
|
||||
129
nagios/check_svn.sh
Executable file
129
nagios/check_svn.sh
Executable file
@@ -0,0 +1,129 @@
|
||||
#!/bin/bash
|
||||
|
||||
#####################################
|
||||
#####################################
|
||||
### ______ _ =) ###
|
||||
### | ___ \ | | ###
|
||||
### | |_/ / __ _ _ __ | | ###
|
||||
### | / / _` || '_ \ | | ###
|
||||
### | |\ \| (_| || | | || |____ ###
|
||||
### \_| \_|\__,_||_| |_|\_____/ ###
|
||||
#####################################
|
||||
#####################################
|
||||
|
||||
function FError()
|
||||
{
|
||||
echo "Syntax:"
|
||||
echo "$0 [svn server] [http | svn | https] [repos path] [location to check-out] [username] [password]"
|
||||
echo "for this check you'll need to create a repository name nagios"
|
||||
echo "Example:"
|
||||
echo "$0 svnsrv http,https CM ${RANDOM}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
function FCheckHttps()
|
||||
{
|
||||
mkdir -p $WORKINGCOPY
|
||||
cd $WORKINGCOPY
|
||||
svn co https://${SVNSRV}/${REPOPATH}/nagios --no-auth-cache --config-dir /home/nagios/.subversion --username $SVNUSER --password $SVNPASS $WORKINGCOPY &> /dev/null
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
rm -rf $WORKINGCOPY
|
||||
ERR=`expr $ERR + 1`
|
||||
MSG="$MSG https: Error"
|
||||
PERF="$PERF https=0;0;0;;"
|
||||
else
|
||||
rm -rf $WORKINGCOPY
|
||||
ERR=`expr $ERR + 0`
|
||||
MSG="$MSG https: ok"
|
||||
PERF="$PERF https=1;0;0;;"
|
||||
fi
|
||||
}
|
||||
|
||||
function FCheckHttp()
|
||||
{
|
||||
mkdir -p $WORKINGCOPY
|
||||
cd $WORKINGCOPY
|
||||
svn co http://${SVNSRV}/${REPOPATH}/nagios --no-auth-cache --config-dir /home/nagios/.subversion --username $SVNUSER --password $SVNPASS $WORKINGCOPY &> /dev/null
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
rm -rf $WORKINGCOPY
|
||||
ERR=`expr $ERR + 1`
|
||||
MSG="$MSG http: Error"
|
||||
PERF="$PERF http=0;0;0;;"
|
||||
else
|
||||
rm -rf $WORKINGCOPY
|
||||
ERR=`expr $ERR + 0`
|
||||
MSG="$MSG http: ok"
|
||||
PERF="$PERF http=1;0;0;;"
|
||||
fi
|
||||
}
|
||||
|
||||
function FCheckSvn()
|
||||
{
|
||||
mkdir -p $WORKINGCOPY
|
||||
cd $WORKINGCOPY
|
||||
svn co svn://${SVNSRV}/nagios --no-auth-cache --config-dir /home/nagios/.subversion --username $SVNUSER --password $SVNPASS $WORKINGCOPY &> /dev/null
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
rm -rf $WORKINGCOPY
|
||||
ERR=`expr $ERR + 1`
|
||||
MSG="$MSG svn: Error"
|
||||
PERF="$PERF svn=0;0;0;;"
|
||||
else
|
||||
rm -rf $WORKINGCOPY
|
||||
ERR=`expr $ERR + 0`
|
||||
MSG="$MSG svn: ok"
|
||||
PERF="$PERF svn=1;0;0;;"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ $# != 4 ]
|
||||
then
|
||||
FError
|
||||
fi
|
||||
|
||||
SVNSRV="$1"
|
||||
PROTOCOL=`echo $2 | sed 's/,/ /g'`
|
||||
REPOPATH="$3"
|
||||
WORKINGCOPY="$4"
|
||||
SVNPORT="3690"
|
||||
HTTPPORT="80"
|
||||
HTTPSPORT="443"
|
||||
SVNUSER="$5"
|
||||
SVNPASS="$6"
|
||||
MSG=""
|
||||
PREF=""
|
||||
ERR="0"
|
||||
|
||||
for proto in $PROTOCOL
|
||||
do
|
||||
case $proto in
|
||||
"https" )
|
||||
FCheckHttps
|
||||
;;
|
||||
"http" )
|
||||
FCheckHttp
|
||||
;;
|
||||
"svn" )
|
||||
FCheckSvn
|
||||
;;
|
||||
* )
|
||||
FError
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
|
||||
if [ $ERR = 0 ]
|
||||
then
|
||||
echo "$MSG = OK | $PERF"
|
||||
exit 0
|
||||
else
|
||||
echo "$MSG = CRITICAL | $PERF"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
echo "Looking OK | Server:$SVNSRV Protocols:$PROTOCOL"
|
||||
|
||||
117
nagios/check_w32_mem.pl
Executable file
117
nagios/check_w32_mem.pl
Executable file
@@ -0,0 +1,117 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
#####################################
|
||||
#####################################
|
||||
### ______ _ =) ###
|
||||
### | ___ \ | | ###
|
||||
### | |_/ / __ _ _ __ | | ###
|
||||
### | / / _` || '_ \ | | ###
|
||||
### | |\ \| (_| || | | || |____ ###
|
||||
### \_| \_|\__,_||_| |_|\_____/ ###
|
||||
#####################################
|
||||
#####################################
|
||||
|
||||
use strict;
|
||||
use Net::SNMP;
|
||||
my $stat;
|
||||
my $msg;
|
||||
my $perf;
|
||||
|
||||
### SNMP OIDs
|
||||
###############
|
||||
my $S_Mem_Total = ".1.3.6.1.2.1.25.2.2.0"; # Byte
|
||||
my $S_Process_Mem_Util = ".1.3.6.1.2.1.25.5.1.1.2";
|
||||
|
||||
### Functions
|
||||
###############
|
||||
|
||||
sub _create_session {
|
||||
my ($server, $comm) = @_;
|
||||
my $version = 1;
|
||||
my ($sess, $err) = Net::SNMP->session( -hostname => $server, -version => $version, -community => $comm);
|
||||
if (!defined($sess)) {
|
||||
print "Can't create SNMP session to $server\n";
|
||||
exit(1);
|
||||
}
|
||||
return $sess;
|
||||
}
|
||||
|
||||
sub FSyntaxError {
|
||||
print "Syntax Error !\n";
|
||||
print "$0 -H [ip|dnsname] -C [snmp community] -w [warning value] -c [critical value]\n";
|
||||
print "To disable warning and critical values type 200 as the value";
|
||||
exit(3);
|
||||
}
|
||||
|
||||
if($#ARGV != 7) {
|
||||
FSyntaxError;
|
||||
}
|
||||
|
||||
### Gather input from user
|
||||
#############################
|
||||
my $switch;
|
||||
my $community;
|
||||
my $check_type;
|
||||
my $warn;
|
||||
my $crit;
|
||||
|
||||
while(@ARGV) {
|
||||
my $temp = shift(@ARGV);
|
||||
if("$temp" eq '-H') {
|
||||
$switch = shift(@ARGV);
|
||||
} elsif("$temp" eq '-C') {
|
||||
$community = shift(@ARGV);
|
||||
} elsif("$temp" eq '-w') {
|
||||
$warn = shift(@ARGV);
|
||||
} elsif("$temp" eq '-c') {
|
||||
$crit = shift(@ARGV);
|
||||
} else {
|
||||
FSyntaxError();
|
||||
}
|
||||
}
|
||||
|
||||
if($warn > $crit) {
|
||||
print "Warning can't be larger then Critical: $warn > $crit\n";
|
||||
FSyntaxError();
|
||||
}
|
||||
|
||||
# Establish SNMP Session
|
||||
our $snmp_session = _create_session($switch,$community);
|
||||
|
||||
# Total Memory
|
||||
my $R_Mem_Total = $snmp_session->get_request(-varbindlist => [$S_Mem_Total]);
|
||||
my $Mem_Total = "$R_Mem_Total->{$S_Mem_Total}";
|
||||
|
||||
# Used Memory
|
||||
my $R_proc_tbl = $snmp_session->get_table($S_Process_Mem_Util);
|
||||
my $Mem_Used = 0;
|
||||
foreach my $oid ( keys %$R_proc_tbl) {
|
||||
# print "$oid\t$$R_proc_tbl{$oid}\n";
|
||||
$Mem_Used = $Mem_Used + $$R_proc_tbl{$oid};
|
||||
}
|
||||
|
||||
# Free Memory
|
||||
my $Mem_Free = $Mem_Total - $Mem_Used;
|
||||
my $Mem_Free_P = int($Mem_Free / $Mem_Total * 100);
|
||||
|
||||
# Humen Readable
|
||||
my $Mem_Total_H = int($Mem_Total / 1024);
|
||||
my $Mem_Used_H = int($Mem_Used / 1024);
|
||||
my $Mem_Free_H = int($Mem_Free / 1024);
|
||||
|
||||
# Calculate Exit Status
|
||||
if($Mem_Free_P < $warn) {
|
||||
$stat = 0;
|
||||
$msg = "Memory: OK - Free Memory $Mem_Free_P%";
|
||||
} elsif($Mem_Free_P > $warn and $Mem_Free_P < $crit) {
|
||||
$stat = 1;
|
||||
$msg = "Memory: Warn - Free Memory $Mem_Free_P%";
|
||||
} elsif($Mem_Free_P > $crit) {
|
||||
$stat = 2;
|
||||
$msg = "Memory: CRIT - Free Memory $Mem_Free_P%";
|
||||
}
|
||||
|
||||
$perf = "total=$Mem_Total_H used=$Mem_Used_H";
|
||||
|
||||
print "$msg | $perf\n";
|
||||
exit($stat);
|
||||
47
nagios/perf-linux-cpu.pl
Executable file
47
nagios/perf-linux-cpu.pl
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env perl
|
||||
#####################################
|
||||
#####################################
|
||||
### ______ _ =) ###
|
||||
### | ___ \ | | ###
|
||||
### | |_/ / __ _ _ __ | | ###
|
||||
### | / / _` || '_ \ | | ###
|
||||
### | |\ \| (_| || | | || |____ ###
|
||||
### \_| \_|\__,_||_| |_|\_____/ ###
|
||||
#####################################
|
||||
#####################################
|
||||
|
||||
# Info
|
||||
#
|
||||
# Used only for performance monitoring via check_by_ssh
|
||||
|
||||
my $msg = "MPSTAT Performance |";
|
||||
my $x = 0;
|
||||
my %header;
|
||||
my $fcount = -1;
|
||||
my $mpstat = `which mpstat`; chomp($mpstat);
|
||||
my @out = split("\n",`$mpstat |tail -n 2`);
|
||||
foreach my $line (@out) {
|
||||
my @chopped = split(" ",$line);
|
||||
shift(@chopped);shift(@chopped);shift(@chopped);
|
||||
|
||||
my $count = 0;
|
||||
if($x == 0) {
|
||||
foreach my $field (@chopped) {
|
||||
if($field =~ /^%/) {
|
||||
$field =~ s/^%//; chomp($field);
|
||||
$fcount++;
|
||||
$header{"$fcount"} = $field;
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for(my $i=0;$i<=$fcount;$i++) {
|
||||
my $tmp = int($chopped[$i]); chomp($tmp);
|
||||
$msg = "$msg $header{$i}=$tmp;0;0;0";
|
||||
}
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
|
||||
print "$msg\n";
|
||||
exit(0);
|
||||
132
nagios/perf-sge.pl
Executable file
132
nagios/perf-sge.pl
Executable file
@@ -0,0 +1,132 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
#####################################
|
||||
#####################################
|
||||
### ______ _ =) ###
|
||||
### | ___ \ | | ###
|
||||
### | |_/ / __ _ _ __ | | ###
|
||||
### | / / _` || '_ \ | | ###
|
||||
### | |\ \| (_| || | | || |____ ###
|
||||
### \_| \_|\__,_||_| |_|\_____/ ###
|
||||
#####################################
|
||||
#####################################
|
||||
|
||||
use strict;
|
||||
use Time::Local;
|
||||
|
||||
# Used only for performance via pnp4Nagios
|
||||
|
||||
sub FSyntaxError {
|
||||
print "Syntax Error !\n";
|
||||
print "$0 cjs \n";
|
||||
print "\tcjs = Cell Job Summary\n";
|
||||
print "$0 qjs \"queue name\"\n";
|
||||
print "\tqjs = Queue Job Summary\n";
|
||||
exit(3);
|
||||
}
|
||||
|
||||
if($#ARGV < 0) {
|
||||
FSyntaxError;
|
||||
}
|
||||
|
||||
my $sge_settings = "/path/to/sge/settings.sh";
|
||||
my $perf_data;
|
||||
my $msg;
|
||||
my $queue;
|
||||
|
||||
sub cjs {
|
||||
my @qstat_grid_jobs = split("\n",`source $sge_settings ; qstat | sed '1,2d' | awk '{print \$5}' | sort`);
|
||||
my %sum_grid_jobs;
|
||||
$sum_grid_jobs{'r'} = 0;
|
||||
$sum_grid_jobs{'Eqw'} = 0;
|
||||
$sum_grid_jobs{'qw'} = 0;
|
||||
$sum_grid_jobs{'t'} = 0;
|
||||
$sum_grid_jobs{'other'} = 0;
|
||||
my $grid_job_sum = 0;
|
||||
$msg = "Cell Job Summary";
|
||||
|
||||
foreach my $state (@qstat_grid_jobs) {
|
||||
chomp($state);
|
||||
$grid_job_sum++;
|
||||
if($state eq "r") {
|
||||
$sum_grid_jobs{'r'}++;
|
||||
} elsif($state eq "Eqw") {
|
||||
$sum_grid_jobs{'Eqw'}++;
|
||||
} elsif($state eq "qw") {
|
||||
$sum_grid_jobs{'qw'}++;
|
||||
} elsif($state eq "t") {
|
||||
$sum_grid_jobs{'t'}++;
|
||||
} else {
|
||||
$sum_grid_jobs{'other'}++;
|
||||
}
|
||||
}
|
||||
|
||||
$perf_data = "Sum=$grid_job_sum;0;0 r=$sum_grid_jobs{'r'};0;0 qw=$sum_grid_jobs{'qw'};0;0 Eqw=$sum_grid_jobs{'Eqw'};0;0 t=$sum_grid_jobs{'t'};0;0 others=$sum_grid_jobs{'other'};0;0";
|
||||
}
|
||||
|
||||
sub qjs {
|
||||
my @months = ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
|
||||
my @qstat_queue_info = split(" ",`source $sge_settings ; qstat -g c | sed '1,2d' | grep ^$queue\\ `);
|
||||
my @jobs_id = split("\n",`source $sge_settings ; qstat | sed '1,2d' | grep $queue\@ | awk '{print \$1" "\$6" "\$7}'`);
|
||||
my %diff;
|
||||
$diff{'count'} = 0;
|
||||
$diff{'sum'} = 0;
|
||||
$msg = "$queue monitor";
|
||||
|
||||
foreach my $jobsid (@jobs_id) {
|
||||
$diff{'count'}++;
|
||||
chomp($jobsid);
|
||||
my @jobsid_arr = split(" ",$jobsid);
|
||||
my @submit_time_raw = split(" ",`source $sge_settings ; qstat -j $jobsid_arr[0] | grep ^submission_time: | awk '{print \$3" "\$4" "\$5" "\$6}'`);
|
||||
my $mon_submit;
|
||||
my $x = 1;
|
||||
foreach my $month (@months) {
|
||||
if($month eq $submit_time_raw[0]) {
|
||||
$mon_submit = "$x";
|
||||
}
|
||||
$x = $x + 1;
|
||||
}
|
||||
|
||||
my @submit_time_raw2 = split(":",$submit_time_raw[2]);
|
||||
my @exec_time_raw2 = split(":",$jobsid_arr[2]);
|
||||
my @exec_date_raw2 = split("/",$jobsid_arr[1]);
|
||||
|
||||
###time=timelocal($sec, $min, $hours, $day, $mon, $year)
|
||||
my $submit_time=timelocal($submit_time_raw2[2], $submit_time_raw2[1], $submit_time_raw2[0], $submit_time_raw[1], $mon_submit, $submit_time_raw[3]);
|
||||
my $exec_time=timelocal($exec_time_raw2[2], $exec_time_raw2[1], $exec_time_raw2[0], $exec_date_raw2[1], $exec_date_raw2[0], $exec_date_raw2[2]);
|
||||
my $diff = $exec_time - $submit_time;
|
||||
$diff{'sum'} = $diff{'sum'} + $diff;
|
||||
}
|
||||
my $job_avg;
|
||||
if($diff{'sum'} == 0) {
|
||||
$job_avg = 0;
|
||||
} else {
|
||||
$job_avg = $diff{'sum'} / $diff{'count'};
|
||||
}
|
||||
my $avail = $qstat_queue_info[2] + $qstat_queue_info[4];
|
||||
$perf_data = "$perf_data $qstat_queue_info[0]_used=$qstat_queue_info[2];0;0 $qstat_queue_info[0]_total=$avail;0;0 job_waiting_avg=$job_avg\sec;0;0";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if("$ARGV[0]" eq "cjs") {
|
||||
cjs();
|
||||
} elsif("$ARGV[0]" eq "qjs") {
|
||||
if($#ARGV < 1) {
|
||||
FSyntaxError;
|
||||
}
|
||||
$queue = "$ARGV[1]";
|
||||
my $is_queue_exists = `source $sge_settings ; qstat -g c | sed '1,2d' | grep -q ^$queue\\ ; echo \$?`;
|
||||
chomp($is_queue_exists);
|
||||
if("0" ne "$is_queue_exists") {
|
||||
FSyntaxError;
|
||||
}
|
||||
qjs();
|
||||
|
||||
} else {
|
||||
FSyntaxError;
|
||||
}
|
||||
|
||||
print "$msg | $perf_data \n";
|
||||
exit(0);
|
||||
110
nagios/perf_ghs-float.sh
Executable file
110
nagios/perf_ghs-float.sh
Executable file
@@ -0,0 +1,110 @@
|
||||
#!/bin/bash
|
||||
|
||||
#####################################
|
||||
#####################################
|
||||
### ______ _ =) ###
|
||||
### | ___ \ | | ###
|
||||
### | |_/ / __ _ _ __ | | ###
|
||||
### | / / _` || '_ \ | | ###
|
||||
### | |\ \| (_| || | | || |____ ###
|
||||
### \_| \_|\__,_||_| |_|\_____/ ###
|
||||
#####################################
|
||||
#####################################
|
||||
|
||||
# Info
|
||||
#
|
||||
# Get usage data from a GHS license server via the web managment console
|
||||
# use mainly for performance monitoring
|
||||
|
||||
function FError() {
|
||||
echo "Syntax Error !"
|
||||
echo "$0 [license server name] [port] [feature name] [/path/to/ghs/log/file]"
|
||||
echo "port = port of the license web port"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ $# != 4 ]
|
||||
then
|
||||
FError
|
||||
fi
|
||||
|
||||
if [ `echo $2 | grep -q ^[[:digit:]]*$ ; echo $?` != 0 ]
|
||||
then
|
||||
FError
|
||||
fi
|
||||
|
||||
if [ ! -f "$4" ]
|
||||
then
|
||||
FError
|
||||
fi
|
||||
|
||||
server="$1"
|
||||
port="$2"
|
||||
feature="$3"
|
||||
log_file="$4"
|
||||
|
||||
min=`date +%M | cut -c 2`
|
||||
log_date_search="`date +%d``date +%b``date +%y` `date +%H`:`date +%M | cut -c 1`"
|
||||
if [ $min -lt 5 ]
|
||||
then
|
||||
min_list="0 1 2 3 4"
|
||||
else
|
||||
min_list="5 6 7 8 9 10"
|
||||
fi
|
||||
|
||||
random_file=/tmp/$RANDOM
|
||||
while_file=/tmp/$RANDOM
|
||||
denied_file=/tmp/$RANDOM
|
||||
export msg="$server:$port is up"
|
||||
export perf_data=""
|
||||
|
||||
if [ ! -f $log_file ]
|
||||
then
|
||||
echo "$log_file doesn't exists !"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
wget http://$server:$port -q -O $random_file
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
msg="$server:$port is down"
|
||||
echo "$msg"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
cat $random_file | grep -v ^\< | grep -v ^$ | grep -v ^\ | sed -n '1,4!p' | sed -e 's/<A HREF.*//g' -e 's/\s*<TD ALIGN=\"CENTER\">//g' -e 's/<\/TD>//g' | sed -n /^$feature\$/,+2p > $while_file
|
||||
|
||||
feature_exists=`head -n 1 $while_file | grep -q ^$feature$ ; echo $?`
|
||||
|
||||
if [ $feature_exists != 0 ]
|
||||
then
|
||||
FError
|
||||
fi
|
||||
|
||||
export counter=0
|
||||
while read line
|
||||
do
|
||||
counter=`expr $counter + 1`
|
||||
case $counter in
|
||||
2 )
|
||||
export total="$line"
|
||||
;;
|
||||
3 )
|
||||
export used="$line"
|
||||
|
||||
# Missed Licensed request
|
||||
for m in $min_list
|
||||
do
|
||||
grep "^${log_date_search}${m}" $log_file | grep "license denied: no $feature licenses available"$ | awk '{print $3}' >> $denied_file
|
||||
done
|
||||
miss_count=`awk '{print $1}' $denied_file | sort | uniq | wc -l`
|
||||
|
||||
perf_data="total=${total};0;0 used=${used};0;0 missed_users=${miss_count};0;0"
|
||||
;;
|
||||
esac
|
||||
|
||||
done < $while_file
|
||||
|
||||
rm -rf $random_file $denied_file $while_file
|
||||
echo "$msg | ${perf_data}"
|
||||
exit 0
|
||||
33
nagios/pnp/check-cisco-cpu.php
Executable file
33
nagios/pnp/check-cisco-cpu.php
Executable file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
#
|
||||
# Copyright (c) 2006-2008 Joerg Linge (http://www.pnp4nagios.org)
|
||||
# Plugin: check_load
|
||||
# $Id: check_load.php 627 2009-04-23 11:14:06Z pitchfork $
|
||||
#
|
||||
#
|
||||
$opt[1] = "--vertical-label Load -l0 --title \"CPU Load for $hostname / $servicedesc\" ";
|
||||
#
|
||||
#
|
||||
#
|
||||
$def[1] = "DEF:var1=$rrdfile:$DS[1]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var2=$rrdfile:$DS[2]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var3=$rrdfile:$DS[3]:AVERAGE " ;
|
||||
if ($WARN[1] != "") {
|
||||
$def[1] .= "HRULE:$WARN[1]#FFFF00 ";
|
||||
}
|
||||
if ($CRIT[1] != "") {
|
||||
$def[1] .= "HRULE:$CRIT[1]#FF0000 ";
|
||||
}
|
||||
$def[1] .= "AREA:var3#FF0000:\"Load 5m\" " ;
|
||||
$def[1] .= "GPRINT:var3:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var3:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var3:MAX:\"%6.2lf max\\n\" " ;
|
||||
$def[1] .= "AREA:var2#EA8F00:\"Load 1m \" " ;
|
||||
$def[1] .= "GPRINT:var2:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var2:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var2:MAX:\"%6.2lf max\\n\" " ;
|
||||
$def[1] .= "AREA:var1#EACC00:\"load 5s \" " ;
|
||||
$def[1] .= "GPRINT:var1:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var1:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var1:MAX:\"%6.2lf max\\n\" ";
|
||||
?>
|
||||
19
nagios/pnp/check-cisco-fan.php
Executable file
19
nagios/pnp/check-cisco-fan.php
Executable file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
$opt[1] = '--title ' . $NAGIOS_SERVICEDESC;
|
||||
|
||||
$def[1] = "DEF:var1=$rrdfile:$DS[1]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var2=$rrdfile:$DS[2]:AVERAGE " ;
|
||||
|
||||
$def[1] .= "AREA:var1#FFCC99:\"Total Sum Fan \" ";
|
||||
$def[1] .= "GPRINT:var1:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var1:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var1:MAX:\"%6.2lf max\\n\" " ;
|
||||
$def[1] .= 'COMMENT:"Check Command ' . $TEMPLATE[1] . '\r" ';
|
||||
|
||||
$def[1] .= "AREA:var2#00FF00:\"Fan Errors\" " ;
|
||||
$def[1] .= "LINE:var2#000000 " ;
|
||||
$def[1] .= "GPRINT:var2:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var2:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var2:MAX:\"%6.2lf max\\n\" ";
|
||||
?>
|
||||
48
nagios/pnp/check-cisco-freeint.php
Executable file
48
nagios/pnp/check-cisco-freeint.php
Executable file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
#
|
||||
# Copyright (c) 2006-2008 Joerg Linge (http://www.pnp4nagios.org)
|
||||
# Default Template used if no other template is found.
|
||||
# Don`t delete this file !
|
||||
# $Id: default.php 555 2008-11-16 16:35:59Z pitchfork $
|
||||
#
|
||||
#
|
||||
# Define some colors ..
|
||||
#
|
||||
// define("_WARNRULE", '#FFFF00');
|
||||
// define("_CRITRULE", '#FF0000');
|
||||
// define("_AREA", '#EACC00');
|
||||
// define("_LINE", '#000000');
|
||||
#
|
||||
# Initial Logic ...
|
||||
#
|
||||
|
||||
$opt[1] = "--title \"$servicedesc\" ";
|
||||
#
|
||||
#
|
||||
#
|
||||
$def[1] = "DEF:var1=$rrdfile:$DS[1]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var2=$rrdfile:$DS[2]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var3=$rrdfile:$DS[3]:AVERAGE " ;
|
||||
// if ($WARN[1] != "") {
|
||||
// $def[1] .= "HRULE:$WARN[1]#FFFF00 ";
|
||||
// }
|
||||
// if ($CRIT[1] != "") {
|
||||
// $def[1] .= "HRULE:$CRIT[1]#FF0000 ";
|
||||
// }
|
||||
$def[1] .= "AREA:var1#FFCC99:\"All Interfaces \" " ;
|
||||
$def[1] .= "LINE:var1#000000 " ;
|
||||
$def[1] .= "GPRINT:var1:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var1:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var1:MAX:\"%6.2lf max\\n\" ";
|
||||
|
||||
$def[1] .= "AREA:var2#00FF00:\"Sum Ethernet Interfaces \" " ;
|
||||
$def[1] .= "GPRINT:var2:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var2:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var2:MAX:\"%6.2lf max\\n\" " ;
|
||||
|
||||
$def[1] .= "AREA:var3#FF0000:\"Free Ethernet Interfaces\" " ;
|
||||
$def[1] .= "GPRINT:var3:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var3:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var3:MAX:\"%6.2lf max\\n\" " ;
|
||||
|
||||
?>
|
||||
19
nagios/pnp/check-cisco-mem.php
Executable file
19
nagios/pnp/check-cisco-mem.php
Executable file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
$opt[1] = '--title ' . $NAGIOS_SERVICEDESC;
|
||||
|
||||
$def[1] = "DEF:var1=$rrdfile:$DS[1]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var2=$rrdfile:$DS[2]:AVERAGE " ;
|
||||
|
||||
$def[1] .= "AREA:var1#FFCC99:\"Total Memory\" ";
|
||||
$def[1] .= "GPRINT:var1:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var1:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var1:MAX:\"%6.2lf max\\n\" " ;
|
||||
$def[1] .= 'COMMENT:"Check Command ' . $TEMPLATE[1] . '\r" ';
|
||||
|
||||
$def[1] .= "AREA:var2#00FF00:\"Used Memory\" " ;
|
||||
$def[1] .= "LINE:var2#000000 " ;
|
||||
$def[1] .= "GPRINT:var2:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var2:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var2:MAX:\"%6.2lf max\\n\" ";
|
||||
?>
|
||||
19
nagios/pnp/check-cisco-module.php
Executable file
19
nagios/pnp/check-cisco-module.php
Executable file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
$opt[1] = '--title ' . $NAGIOS_SERVICEDESC;
|
||||
|
||||
$def[1] = "DEF:var1=$rrdfile:$DS[1]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var2=$rrdfile:$DS[2]:AVERAGE " ;
|
||||
|
||||
$def[1] .= "AREA:var1#FFCC99:\"Total Sum Modules \" ";
|
||||
$def[1] .= "GPRINT:var1:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var1:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var1:MAX:\"%6.2lf max\\n\" " ;
|
||||
$def[1] .= 'COMMENT:"Check Command ' . $TEMPLATE[1] . '\r" ';
|
||||
|
||||
$def[1] .= "AREA:var2#00FF00:\"Modules Errors\" " ;
|
||||
$def[1] .= "LINE:var2#000000 " ;
|
||||
$def[1] .= "GPRINT:var2:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var2:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var2:MAX:\"%6.2lf max\\n\" ";
|
||||
?>
|
||||
19
nagios/pnp/check-cisco-ps.php
Executable file
19
nagios/pnp/check-cisco-ps.php
Executable file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
$opt[1] = '--title ' . $NAGIOS_SERVICEDESC;
|
||||
|
||||
$def[1] = "DEF:var1=$rrdfile:$DS[1]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var2=$rrdfile:$DS[2]:AVERAGE " ;
|
||||
|
||||
$def[1] .= "AREA:var1#FFCC99:\"Total Sum PS \" ";
|
||||
$def[1] .= "GPRINT:var1:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var1:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var1:MAX:\"%6.2lf max\\n\" " ;
|
||||
$def[1] .= 'COMMENT:"Check Command ' . $TEMPLATE[1] . '\r" ';
|
||||
|
||||
$def[1] .= "AREA:var2#00FF00:\"PS Errors\" " ;
|
||||
$def[1] .= "LINE:var2#000000 " ;
|
||||
$def[1] .= "GPRINT:var2:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var2:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var2:MAX:\"%6.2lf max\\n\" ";
|
||||
?>
|
||||
37
nagios/pnp/check-cisco-totalbw.php
Executable file
37
nagios/pnp/check-cisco-totalbw.php
Executable file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
#
|
||||
# Copyright (c) 2006-2008 Joerg Linge (http://www.pnp4nagios.org)
|
||||
# Default Template used if no other template is found.
|
||||
# Don`t delete this file !
|
||||
# $Id: default.php 555 2008-11-16 16:35:59Z pitchfork $
|
||||
#
|
||||
#
|
||||
# Define some colors ..
|
||||
#
|
||||
// define("_WARNRULE", '#FFFF00');
|
||||
// define("_CRITRULE", '#FF0000');
|
||||
// define("_AREA", '#EACC00');
|
||||
// define("_LINE", '#000000');
|
||||
#
|
||||
# Initial Logic ...
|
||||
#
|
||||
|
||||
$opt[1] = "--vertical-label bit --title \"$servicedesc\" --lower-limit 0 ";
|
||||
#
|
||||
#
|
||||
#
|
||||
$def[1] = "DEF:var1=$rrdfile:$DS[1]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var2=$rrdfile:$DS[2]:AVERAGE " ;
|
||||
|
||||
$def[1] .= "AREA:var1#00FF00:\"In \" " ;
|
||||
$def[1] .= "LINE:var1#000000 " ;
|
||||
$def[1] .= "GPRINT:var1:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var1:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var1:MAX:\"%6.2lf max\\n\" ";
|
||||
|
||||
$def[1] .= "LINE3:var2#0000FF:\"Out \" " ;
|
||||
$def[1] .= "GPRINT:var2:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var2:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var2:MAX:\"%6.2lf max\\n\" " ;
|
||||
|
||||
?>
|
||||
33
nagios/pnp/check-juniper-vpn-load.php
Executable file
33
nagios/pnp/check-juniper-vpn-load.php
Executable file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
#
|
||||
# Copyright (c) 2006-2008 Joerg Linge (http://www.pnp4nagios.org)
|
||||
# Plugin: check_load
|
||||
# $Id: check_load.php 627 2009-04-23 11:14:06Z pitchfork $
|
||||
#
|
||||
#
|
||||
$opt[1] = "--vertical-label Load -l0 --title \"CPU Load for $hostname / $servicedesc\" --lower-limit 0 ";
|
||||
#
|
||||
#
|
||||
#
|
||||
$def[1] = "DEF:var1=$rrdfile:$DS[1]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var2=$rrdfile:$DS[2]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var3=$rrdfile:$DS[3]:AVERAGE " ;
|
||||
if ($WARN[1] != "") {
|
||||
$def[1] .= "HRULE:$WARN[1]#FFFF00 ";
|
||||
}
|
||||
if ($CRIT[1] != "") {
|
||||
$def[1] .= "HRULE:$CRIT[1]#FF0000 ";
|
||||
}
|
||||
$def[1] .= "AREA:var3#FF0000:\"Load 15\" " ;
|
||||
$def[1] .= "GPRINT:var3:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var3:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var3:MAX:\"%6.2lf max\\n\" " ;
|
||||
$def[1] .= "AREA:var2#EA8F00:\"Load 5 \" " ;
|
||||
$def[1] .= "GPRINT:var2:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var2:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var2:MAX:\"%6.2lf max\\n\" " ;
|
||||
$def[1] .= "AREA:var1#EACC00:\"load 1 \" " ;
|
||||
$def[1] .= "GPRINT:var1:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var1:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var1:MAX:\"%6.2lf max\\n\" ";
|
||||
?>
|
||||
55
nagios/pnp/check-juniper-vpn-mem.php
Executable file
55
nagios/pnp/check-juniper-vpn-mem.php
Executable file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
#
|
||||
# Copyright (c) 2006-2008 Joerg Linge (http://www.pnp4nagios.org)
|
||||
# Default Template used if no other template is found.
|
||||
# Don`t delete this file !
|
||||
# $Id: default.php 555 2008-11-16 16:35:59Z pitchfork $
|
||||
#
|
||||
#
|
||||
# Define some colors ..
|
||||
#
|
||||
// define("_WARNRULE", '#FFFF00');
|
||||
// define("_CRITRULE", '#FF0000');
|
||||
// define("_AREA", '#EACC00');
|
||||
// define("_LINE", '#000000');
|
||||
#
|
||||
# Initial Logic ...
|
||||
#
|
||||
|
||||
$opt[1] = "--vertical-label Memory -l0 --title \"$servicedesc\" ";
|
||||
#
|
||||
#
|
||||
#
|
||||
$def[1] = "DEF:var1=$rrdfile:$DS[1]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var2=$rrdfile:$DS[2]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var3=$rrdfile:$DS[3]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var4=$rrdfile:$DS[4]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var5=$rrdfile:$DS[5]:AVERAGE " ;
|
||||
|
||||
$def[1] .= "AREA:var1#FFCC99:\"$NAME[1] \" " ;
|
||||
$def[1] .= "GPRINT:var1:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var1:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var1:MAX:\"%6.2lf max\\n\" ";
|
||||
|
||||
$def[1] .= "LINE2:var2#00FF00:\"$NAME[2] \" " ;
|
||||
$def[1] .= "GPRINT:var2:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var2:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var2:MAX:\"%6.2lf max\\n\" " ;
|
||||
|
||||
$def[1] .= "LINE2:var3#FF0000:\"$NAME[3] \" " ;
|
||||
$def[1] .= "GPRINT:var3:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var3:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var3:MAX:\"%6.2lf max\\n\" " ;
|
||||
|
||||
$def[1] .= "LINE2:var4#0000FF:\"$NAME[4] \" " ;
|
||||
$def[1] .= "GPRINT:var4:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var4:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var4:MAX:\"%6.2lf max\\n\" " ;
|
||||
|
||||
$def[1] .= "LINE2:var5#FFFF00:\"$NAME[5] \" " ;
|
||||
$def[1] .= "GPRINT:var5:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var5:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var5:MAX:\"%6.2lf max\\n\" " ;
|
||||
|
||||
$def[$i] .= 'COMMENT:"Check Command ' . $TEMPLATE[$i] . '\r" ';
|
||||
?>
|
||||
39
nagios/pnp/check-juniper-vpn-swap.php
Executable file
39
nagios/pnp/check-juniper-vpn-swap.php
Executable file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
#
|
||||
# Copyright (c) 2006-2008 Joerg Linge (http://www.pnp4nagios.org)
|
||||
# Default Template used if no other template is found.
|
||||
# Don`t delete this file !
|
||||
# $Id: default.php 555 2008-11-16 16:35:59Z pitchfork $
|
||||
#
|
||||
#
|
||||
# Define some colors ..
|
||||
#
|
||||
// define("_WARNRULE", '#FFFF00');
|
||||
// define("_CRITRULE", '#FF0000');
|
||||
// define("_AREA", '#EACC00');
|
||||
// define("_LINE", '#000000');
|
||||
#
|
||||
# Initial Logic ...
|
||||
#
|
||||
|
||||
$opt[1] = "--vertical-label Swap -l0 --title \"$servicedesc\" ";
|
||||
#
|
||||
#
|
||||
#
|
||||
$def[1] = "DEF:var1=$rrdfile:$DS[1]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var2=$rrdfile:$DS[2]:AVERAGE " ;
|
||||
|
||||
$def[1] .= "AREA:var1#FFCC99:\"$NAME[1] \" " ;
|
||||
$def[1] .= "GPRINT:var1:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var1:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var1:MAX:\"%6.2lf max\\n\" ";
|
||||
|
||||
$def[1] .= "AREA:var2#00FF00:\"$NAME[2] \" " ;
|
||||
$def[1] .= "GPRINT:var2:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var2:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var2:MAX:\"%6.2lf max\\n\" " ;
|
||||
|
||||
|
||||
|
||||
$def[$i] .= 'COMMENT:"Check Command ' . $TEMPLATE[$i] . '\r" ';
|
||||
?>
|
||||
37
nagios/pnp/check-pineapp-inout.php
Executable file
37
nagios/pnp/check-pineapp-inout.php
Executable file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
#
|
||||
# Copyright (c) 2006-2008 Joerg Linge (http://www.pnp4nagios.org)
|
||||
# Default Template used if no other template is found.
|
||||
# Don`t delete this file !
|
||||
# $Id: default.php 555 2008-11-16 16:35:59Z pitchfork $
|
||||
#
|
||||
#
|
||||
# Define some colors ..
|
||||
#
|
||||
// define("_WARNRULE", '#FFFF00');
|
||||
// define("_CRITRULE", '#FF0000');
|
||||
// define("_AREA", '#EACC00');
|
||||
// define("_LINE", '#000000');
|
||||
#
|
||||
# Initial Logic ...
|
||||
#
|
||||
|
||||
$opt[1] = "--vertical-label In/Out -l0 --title \"$servicedesc\" ";
|
||||
#
|
||||
#
|
||||
#
|
||||
$def[1] = "DEF:var1=$rrdfile:$DS[1]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var2=$rrdfile:$DS[2]:AVERAGE " ;
|
||||
|
||||
$def[1] .= "AREA:var1#FFCC99:\"$NAME[1] \" " ;
|
||||
$def[1] .= "GPRINT:var1:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var1:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var1:MAX:\"%6.2lf max\\n\" ";
|
||||
|
||||
$def[1] .= "AREA:var2#00FF00:\"$NAME[2] \" " ;
|
||||
$def[1] .= "GPRINT:var2:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var2:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var2:MAX:\"%6.2lf max\\n\" " ;
|
||||
|
||||
$def[$i] .= 'COMMENT:"Check Command ' . $TEMPLATE[$i] . '\r" ';
|
||||
?>
|
||||
33
nagios/pnp/check-pineapp-load.php
Executable file
33
nagios/pnp/check-pineapp-load.php
Executable file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
#
|
||||
# Copyright (c) 2006-2008 Joerg Linge (http://www.pnp4nagios.org)
|
||||
# Plugin: check_load
|
||||
# $Id: check_load.php 627 2009-04-23 11:14:06Z pitchfork $
|
||||
#
|
||||
#
|
||||
$opt[1] = "--vertical-label Load -l0 --title \"CPU Load for $hostname / $servicedesc\" ";
|
||||
#
|
||||
#
|
||||
#
|
||||
$def[1] = "DEF:var1=$rrdfile:$DS[1]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var2=$rrdfile:$DS[2]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var3=$rrdfile:$DS[3]:AVERAGE " ;
|
||||
if ($WARN[1] != "") {
|
||||
$def[1] .= "HRULE:$WARN[1]#FFFF00 ";
|
||||
}
|
||||
if ($CRIT[1] != "") {
|
||||
$def[1] .= "HRULE:$CRIT[1]#FF0000 ";
|
||||
}
|
||||
$def[1] .= "AREA:var3#FF0000:\"Load 15\" " ;
|
||||
$def[1] .= "GPRINT:var3:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var3:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var3:MAX:\"%6.2lf max\\n\" " ;
|
||||
$def[1] .= "AREA:var2#EA8F00:\"Load 5 \" " ;
|
||||
$def[1] .= "GPRINT:var2:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var2:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var2:MAX:\"%6.2lf max\\n\" " ;
|
||||
$def[1] .= "AREA:var1#EACC00:\"load 1 \" " ;
|
||||
$def[1] .= "GPRINT:var1:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var1:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var1:MAX:\"%6.2lf max\\n\" ";
|
||||
?>
|
||||
49
nagios/pnp/check-pineapp-queue.php
Executable file
49
nagios/pnp/check-pineapp-queue.php
Executable file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
#
|
||||
# Copyright (c) 2006-2008 Joerg Linge (http://www.pnp4nagios.org)
|
||||
# Default Template used if no other template is found.
|
||||
# Don`t delete this file !
|
||||
# $Id: default.php 555 2008-11-16 16:35:59Z pitchfork $
|
||||
#
|
||||
#
|
||||
# Define some colors ..
|
||||
#
|
||||
// define("_WARNRULE", '#FFFF00');
|
||||
// define("_CRITRULE", '#FF0000');
|
||||
// define("_AREA", '#EACC00');
|
||||
// define("_LINE", '#000000');
|
||||
#
|
||||
# Initial Logic ...
|
||||
#
|
||||
|
||||
$opt[1] = "--vertical-label Queue -l0 --title \"$servicedesc\" ";
|
||||
#
|
||||
#
|
||||
#
|
||||
$def[1] = "DEF:var1=$rrdfile:$DS[1]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var2=$rrdfile:$DS[2]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var3=$rrdfile:$DS[3]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var4=$rrdfile:$DS[4]:AVERAGE " ;
|
||||
|
||||
$def[1] .= "AREA:var1#FFCC99:\"$NAME[1] \" " ;
|
||||
$def[1] .= "GPRINT:var1:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var1:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var1:MAX:\"%6.2lf max\\n\" ";
|
||||
|
||||
$def[1] .= "LINE2:var2#00FF00:\"$NAME[2] \" " ;
|
||||
$def[1] .= "GPRINT:var2:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var2:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var2:MAX:\"%6.2lf max\\n\" " ;
|
||||
|
||||
$def[1] .= "LINE2:var3#FF0000:\"$NAME[3] \" " ;
|
||||
$def[1] .= "GPRINT:var3:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var3:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var3:MAX:\"%6.2lf max\\n\" " ;
|
||||
|
||||
$def[1] .= "LINE2:var4#0000FF:\"$NAME[4] \" " ;
|
||||
$def[1] .= "GPRINT:var4:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var4:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var4:MAX:\"%6.2lf max\\n\" " ;
|
||||
|
||||
$def[$i] .= 'COMMENT:"Check Command ' . $TEMPLATE[$i] . '\r" ';
|
||||
?>
|
||||
66
nagios/pnp/check_cpus_linux.php
Executable file
66
nagios/pnp/check_cpus_linux.php
Executable file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
#
|
||||
# Copyright (c) 2006-2008 Joerg Linge (http://www.pnp4nagios.org)
|
||||
# Default Template used if no other template is found.
|
||||
# Don`t delete this file !
|
||||
# $Id: default.php 555 2008-11-16 16:35:59Z pitchfork $
|
||||
#
|
||||
#
|
||||
# Define some colors ..
|
||||
#
|
||||
define("_WARNRULE", '#FFFF00');
|
||||
define("_CRITRULE", '#FF0000');
|
||||
define("_AREA", '#EACC00');
|
||||
define("_LINE", '#000000');
|
||||
#
|
||||
# Initial Logic ...
|
||||
#
|
||||
|
||||
$colors = array(
|
||||
'user' => '#00CC00',
|
||||
'nice' => '#000000',
|
||||
'sys' => '#6600FF',
|
||||
'system' => '#6600FF',
|
||||
'iowait' => '#FF0000',
|
||||
'irq' => '#663300',
|
||||
'soft' => '#FFFF00',
|
||||
'steal' => '#4596DD',
|
||||
'idle' => '#4557DD',
|
||||
'guest' => '#A445DD',
|
||||
'idle' => '#66FFCC',
|
||||
);
|
||||
|
||||
|
||||
$current = 0;
|
||||
$var = 0;
|
||||
|
||||
foreach ($DS as $i) {
|
||||
if($NAME[$i] == 'user' ) {
|
||||
$current = $i;
|
||||
$var = 1;
|
||||
$vlabel = "";
|
||||
if ($UNIT[$i] == "%%") {
|
||||
$vlabel = "%";
|
||||
}
|
||||
else {
|
||||
$vlabel = $UNIT[$i];
|
||||
}
|
||||
|
||||
$opt[$current] = '--lower-limit 0 --upper-limit 100 --vertical-label "' . $vlabel . '" --title "' . $hostname . ' / ' . $servicedesc . '"' . $lower;
|
||||
|
||||
$def[$current] = "DEF:var$var=$rrdfile:$DS[$i]:AVERAGE ";
|
||||
// $def[$current] .= "AREA:var$var" . _AREA . ":\"$NAME[$i] \" ";
|
||||
$def[$current] .= "LINE3:var$var" . $colors[$NAME[$i]] . ":\"$NAME[$i] \" ";
|
||||
$def[$current] .= "GPRINT:var$var:LAST:\"%3.4lf $UNIT[$i] LAST \" ";
|
||||
$def[$current] .= "GPRINT:var$var:MAX:\"%3.4lf $UNIT[$i] MAX \" ";
|
||||
$def[$current] .= "GPRINT:var$var:AVERAGE:\"%3.4lf $UNIT[$i] AVERAGE \\n\" ";
|
||||
} else {
|
||||
$var = $var + 1;
|
||||
$def[$current] .= "DEF:var$var=$rrdfile:$DS[$i]:AVERAGE ";
|
||||
$def[$current] .= "LINE3:var$var" . $colors[$NAME[$i]] . ":\"$NAME[$i] \" ";
|
||||
$def[$current] .= "GPRINT:var$var:LAST:\"%3.4lf $UNIT[$i] LAST \" ";
|
||||
$def[$current] .= "GPRINT:var$var:MAX:\"%3.4lf $UNIT[$i] MAX \" ";
|
||||
$def[$current] .= "GPRINT:var$var:AVERAGE:\"%3.4lf $UNIT[$i] AVERAGE \\n\" ";
|
||||
}
|
||||
}
|
||||
?>
|
||||
19
nagios/pnp/check_flexlm_new.php
Executable file
19
nagios/pnp/check_flexlm_new.php
Executable file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
$opt[1] = '--title ' . $NAGIOS_SERVICEDESC;
|
||||
|
||||
$def[1] = "DEF:var1=$rrdfile:$DS[1]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var2=$rrdfile:$DS[2]:AVERAGE " ;
|
||||
|
||||
$def[1] .= "AREA:var1#FFCC99:Total ";
|
||||
$def[1] .= "GPRINT:var1:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var1:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var1:MAX:\"%6.2lf max\\n\" " ;
|
||||
$def[1] .= 'COMMENT:"Check Command ' . $TEMPLATE[1] . '\r" ';
|
||||
|
||||
$def[1] .= "AREA:var2#00FF00:\"Used \" " ;
|
||||
$def[1] .= "LINE:var2#000000 " ;
|
||||
$def[1] .= "GPRINT:var2:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var2:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var2:MAX:\"%6.2lf max\\n\" ";
|
||||
?>
|
||||
33
nagios/pnp/check_load_srv.php
Executable file
33
nagios/pnp/check_load_srv.php
Executable file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
#
|
||||
# Copyright (c) 2006-2008 Joerg Linge (http://www.pnp4nagios.org)
|
||||
# Plugin: check_load
|
||||
# $Id: check_load.php 627 2009-04-23 11:14:06Z pitchfork $
|
||||
#
|
||||
#
|
||||
$opt[1] = "--vertical-label Load -l0 --title \"CPU Load for $hostname / $servicedesc\" ";
|
||||
#
|
||||
#
|
||||
#
|
||||
$def[1] = "DEF:var1=$rrdfile:$DS[1]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var2=$rrdfile:$DS[2]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var3=$rrdfile:$DS[3]:AVERAGE " ;
|
||||
if ($WARN[1] != "") {
|
||||
$def[1] .= "HRULE:$WARN[1]#FFFF00 ";
|
||||
}
|
||||
if ($CRIT[1] != "") {
|
||||
$def[1] .= "HRULE:$CRIT[1]#FF0000 ";
|
||||
}
|
||||
$def[1] .= "AREA:var3#FF0000:\"Load 15\" " ;
|
||||
$def[1] .= "GPRINT:var3:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var3:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var3:MAX:\"%6.2lf max\\n\" " ;
|
||||
$def[1] .= "AREA:var2#EA8F00:\"Load 5 \" " ;
|
||||
$def[1] .= "GPRINT:var2:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var2:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var2:MAX:\"%6.2lf max\\n\" " ;
|
||||
$def[1] .= "AREA:var1#EACC00:\"load 1 \" " ;
|
||||
$def[1] .= "GPRINT:var1:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var1:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var1:MAX:\"%6.2lf max\\n\" ";
|
||||
?>
|
||||
30
nagios/pnp/perf-ghs-float.php
Executable file
30
nagios/pnp/perf-ghs-float.php
Executable file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
$opt[1] = '--title ' . $NAGIOS_SERVICEDESC . '" Usage"';
|
||||
|
||||
$def[1] = "DEF:var1=$rrdfile:$DS[1]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var2=$rrdfile:$DS[2]:AVERAGE " ;
|
||||
|
||||
$def[1] .= "AREA:var1#FFCC99:Total ";
|
||||
$def[1] .= "GPRINT:var1:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var1:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var1:MAX:\"%6.2lf max\\n\" " ;
|
||||
$def[1] .= 'COMMENT:"Check Command ' . $TEMPLATE[1] . '\r" ';
|
||||
|
||||
$def[1] .= "AREA:var2#00FF00:\"Used \" " ;
|
||||
$def[1] .= "LINE:var2#000000 " ;
|
||||
$def[1] .= "GPRINT:var2:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var2:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var2:MAX:\"%6.2lf max\\n\" ";
|
||||
|
||||
$opt[2] = '--title ' . $NAGIOS_SERVICEDESC . '" Missed Users"';
|
||||
|
||||
$def[2] = "DEF:var3=$rrdfile:$DS[3]:AVERAGE " ;
|
||||
|
||||
$def[2] .= "AREA:var3#00FF00:missed_users ";
|
||||
$def[2] .= "LINE:var3#000000 " ;
|
||||
$def[2] .= "GPRINT:var3:LAST:\"%6.2lf last\" " ;
|
||||
$def[2] .= "GPRINT:var3:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[2] .= "GPRINT:var3:MAX:\"%6.2lf max\\n\" " ;
|
||||
$def[2] .= 'COMMENT:"Check Command ' . $TEMPLATE[2] . '\r" ';
|
||||
?>
|
||||
67
nagios/pnp/perf-sge-cjs.php
Executable file
67
nagios/pnp/perf-sge-cjs.php
Executable file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
#
|
||||
# Copyright (c) 2006-2008 Joerg Linge (http://www.pnp4nagios.org)
|
||||
# Default Template used if no other template is found.
|
||||
# Don`t delete this file !
|
||||
# $Id: default.php 555 2008-11-16 16:35:59Z pitchfork $
|
||||
#
|
||||
#
|
||||
# Define some colors ..
|
||||
#
|
||||
// define("_WARNRULE", '#FFFF00');
|
||||
// define("_CRITRULE", '#FF0000');
|
||||
// define("_AREA", '#EACC00');
|
||||
// define("_LINE", '#000000');
|
||||
#
|
||||
# Initial Logic ...
|
||||
#
|
||||
|
||||
$opt[1] = "--vertical-label Load -l0 --title \"$servicedesc\" ";
|
||||
#
|
||||
#
|
||||
#
|
||||
$def[1] = "DEF:var1=$rrdfile:$DS[1]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var2=$rrdfile:$DS[2]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var3=$rrdfile:$DS[3]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var4=$rrdfile:$DS[4]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var5=$rrdfile:$DS[5]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var6=$rrdfile:$DS[6]:AVERAGE " ;
|
||||
// if ($WARN[1] != "") {
|
||||
// $def[1] .= "HRULE:$WARN[1]#FFFF00 ";
|
||||
// }
|
||||
// if ($CRIT[1] != "") {
|
||||
// $def[1] .= "HRULE:$CRIT[1]#FF0000 ";
|
||||
// }
|
||||
$def[1] .= "AREA:var1#FFCC99:\"All Jobs \" " ;
|
||||
$def[1] .= "GPRINT:var1:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var1:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var1:MAX:\"%6.2lf max\\n\" ";
|
||||
|
||||
$def[1] .= "LINE3:var2#00FF00:\"Running \" " ;
|
||||
$def[1] .= "GPRINT:var2:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var2:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var2:MAX:\"%6.2lf max\\n\" " ;
|
||||
|
||||
$def[1] .= "LINE3:var3#FF0000:\"Queue Waiting\" " ;
|
||||
$def[1] .= "GPRINT:var3:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var3:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var3:MAX:\"%6.2lf max\\n\" " ;
|
||||
|
||||
$def[1] .= "LINE3:var4#0000FF:\"Error Queue Waiting\" " ;
|
||||
$def[1] .= "GPRINT:var4:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var4:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var4:MAX:\"%6.2lf max\\n\" " ;
|
||||
|
||||
$def[1] .= "LINE3:var5#FFFF00:\"Transfering\" " ;
|
||||
$def[1] .= "GPRINT:var5:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var5:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var5:MAX:\"%6.2lf max\\n\" " ;
|
||||
|
||||
$def[1] .= "LINE3:var6#FF00FF:\"Others\" " ;
|
||||
$def[1] .= "GPRINT:var6:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var6:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var6:MAX:\"%6.2lf max\\n\" " ;
|
||||
|
||||
$def[$i] .= 'COMMENT:"perf-sge-cjs Template\r" ';
|
||||
$def[$i] .= 'COMMENT:"Check Command ' . $TEMPLATE[$i] . '\r" ';
|
||||
?>
|
||||
43
nagios/pnp/perf-sge-qjs.php
Executable file
43
nagios/pnp/perf-sge-qjs.php
Executable file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
#
|
||||
# Copyright (c) 2006-2008 Joerg Linge (http://www.pnp4nagios.org)
|
||||
# Default Template used if no other template is found.
|
||||
# Don`t delete this file !
|
||||
# $Id: default.php 555 2008-11-16 16:35:59Z pitchfork $
|
||||
#
|
||||
#
|
||||
# Define some colors ..
|
||||
#
|
||||
|
||||
$queue_temp = explode("_", $NAME[1]);
|
||||
$queue = "$queue_temp[0]";
|
||||
|
||||
$opt[1] = '--vertical-label "' . $vlabel . '" --title "' . $queue . ' Usage"' . $lower;
|
||||
|
||||
$def[1] = "DEF:var1=$rrdfile:$DS[1]:AVERAGE " ;
|
||||
$def[1] .= "DEF:var2=$rrdfile:$DS[2]:AVERAGE " ;
|
||||
|
||||
$def[1] .= "AREA:var2#FFCC99:\"Total \" " ;
|
||||
$def[1] .= "GPRINT:var2:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var2:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var2:MAX:\"%6.2lf max\\n\" ";
|
||||
|
||||
$def[1] .= "AREA:var1#00FF00:Used ";
|
||||
$def[1] .= "LINE:var1#000000 " ;
|
||||
$def[1] .= "GPRINT:var1:LAST:\"%6.2lf last\" " ;
|
||||
$def[1] .= "GPRINT:var1:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[1] .= "GPRINT:var1:MAX:\"%6.2lf max\\n\" " ;
|
||||
|
||||
$def[1] .= 'COMMENT:"Default Template\r" ';
|
||||
$def[1] .= 'COMMENT:"Check Command ' . $TEMPLATE[1] . '\r" ';
|
||||
|
||||
$opt[2] = '--vertical-label "' . $vlabel . '" --title "' . $queue . ' Job Average Waiting Time"' . $lower;
|
||||
$def[2] = "DEF:var3=$rrdfile:$DS[3]:AVERAGE " ;
|
||||
$def[2] .= "AREA:var3#00FF00:seconds ";
|
||||
$def[2] .= "LINE:var3#000000 " ;
|
||||
$def[2] .= "GPRINT:var3:LAST:\"%6.2lf last\" " ;
|
||||
$def[2] .= "GPRINT:var3:AVERAGE:\"%6.2lf avg\" " ;
|
||||
$def[2] .= "GPRINT:var3:MAX:\"%6.2lf max\\n\" " ;
|
||||
$def[2] .= 'COMMENT:"Check Command ' . $TEMPLATE[2] . '\r" ';
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user