mirror of
https://github.com/ranl/monitor-utils.git
synced 2025-06-07 10:03:41 +02:00
Merge c9271972a6
into fc9c1902ab
This commit is contained in:
commit
f296f7465f
@ -30,8 +30,21 @@
|
|||||||
## AUTOSUPPORTSTATUS|NFSOPS|
|
## AUTOSUPPORTSTATUS|NFSOPS|
|
||||||
## CIFSOPS|SHELFINFO|...
|
## CIFSOPS|SHELFINFO|...
|
||||||
##
|
##
|
||||||
#####################################
|
##
|
||||||
#####################################
|
##
|
||||||
|
## CLARIFICATION FOR TIMEOUTS
|
||||||
|
## There are multiples timeouts we depend on
|
||||||
|
##
|
||||||
|
## Perl plugins timeout (utils.pm)--- > $TIMEOUT --- > originally 15 sec --> recommandation to raise it to 180
|
||||||
|
##
|
||||||
|
## Net::SNMP timeout --- > Used in Net::SNMP->session --- > originally 5 sec --> recommandation to raise it to 60
|
||||||
|
## Beware that the max value 60 seconds. If set above you get the error message "Can't create snmp session"
|
||||||
|
##
|
||||||
|
## Do not forget that in nagios you need to increase service_check_timeout to a value above $TIMEOUT_PLUGINS
|
||||||
|
## Nagios service check timeout (nagios.cfg) --- > service_check_timeout=240 --- > originally 30 sec
|
||||||
|
##
|
||||||
|
####################################################################################################################################################
|
||||||
|
####################################################################################################################################################
|
||||||
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
@ -47,13 +60,16 @@ use Getopt::Long;
|
|||||||
use Time::Local;
|
use Time::Local;
|
||||||
use IPC::Cmd qw(run_forked);
|
use IPC::Cmd qw(run_forked);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Getopt::Long::Configure('bundling');
|
Getopt::Long::Configure('bundling');
|
||||||
|
|
||||||
|
my $TIMEOUT_PLUGINS=$TIMEOUT;
|
||||||
my $stat = 0;
|
my $stat = 0;
|
||||||
my $msg;
|
my $msg;
|
||||||
my $perf;
|
my $perf;
|
||||||
my $script_name = basename($0);
|
my $script_name = basename($0);
|
||||||
my $script_version = 1.3;
|
my $script_version = 1.3.1;
|
||||||
|
|
||||||
my $counterFilePath="/tmp";
|
my $counterFilePath="/tmp";
|
||||||
my $counterFile;
|
my $counterFile;
|
||||||
@ -227,7 +243,7 @@ my %nvramBatteryStatus = (
|
|||||||
5 => 'near end of life',
|
5 => 'near end of life',
|
||||||
6 => 'at end of life',
|
6 => 'at end of life',
|
||||||
7 => 'unknown',
|
7 => 'unknown',
|
||||||
);
|
);
|
||||||
my %GlobalStatusIndex = (
|
my %GlobalStatusIndex = (
|
||||||
1 => 'other',
|
1 => 'other',
|
||||||
2 => 'unknown',
|
2 => 'unknown',
|
||||||
@ -235,7 +251,7 @@ my %GlobalStatusIndex = (
|
|||||||
4 => 'nonCritical',
|
4 => 'nonCritical',
|
||||||
5 => 'critical',
|
5 => 'critical',
|
||||||
6 => 'nonRecoverable',
|
6 => 'nonRecoverable',
|
||||||
);
|
);
|
||||||
|
|
||||||
my %AutoSupportStatusIndex = (
|
my %AutoSupportStatusIndex = (
|
||||||
1 => 'ok',
|
1 => 'ok',
|
||||||
@ -243,7 +259,7 @@ my %AutoSupportStatusIndex = (
|
|||||||
3 => 'postFailure',
|
3 => 'postFailure',
|
||||||
4 => 'smtpPostFailure',
|
4 => 'smtpPostFailure',
|
||||||
5 => 'unknown',
|
5 => 'unknown',
|
||||||
);
|
);
|
||||||
|
|
||||||
my %cfSettingsIndex = (
|
my %cfSettingsIndex = (
|
||||||
1 => 'notConfigured',
|
1 => 'notConfigured',
|
||||||
@ -251,7 +267,7 @@ my %cfSettingsIndex = (
|
|||||||
3 => 'disabled',
|
3 => 'disabled',
|
||||||
4 => 'takeoverByPartnerDisabled',
|
4 => 'takeoverByPartnerDisabled',
|
||||||
5 => 'thisNodeDead',
|
5 => 'thisNodeDead',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
my %cfStateIndex = (
|
my %cfStateIndex = (
|
||||||
@ -259,7 +275,7 @@ my %cfStateIndex = (
|
|||||||
2 => 'canTakeover',
|
2 => 'canTakeover',
|
||||||
3 => 'cannotTakeover',
|
3 => 'cannotTakeover',
|
||||||
4 => 'takeover',
|
4 => 'takeover',
|
||||||
);
|
);
|
||||||
|
|
||||||
my %cfCannotTakeoverCauseIndex = (
|
my %cfCannotTakeoverCauseIndex = (
|
||||||
1 => 'ok',
|
1 => 'ok',
|
||||||
@ -280,20 +296,20 @@ my %cfCannotTakeoverCauseIndex = (
|
|||||||
16 => 'alreadyInTakenoverMode',
|
16 => 'alreadyInTakenoverMode',
|
||||||
17 => 'nvramLogUnsynchronized',
|
17 => 'nvramLogUnsynchronized',
|
||||||
18 => 'backupMailboxProblems',
|
18 => 'backupMailboxProblems',
|
||||||
);
|
);
|
||||||
|
|
||||||
my %cfPartnerStatusIndex = (
|
my %cfPartnerStatusIndex = (
|
||||||
1 => 'maybeDown',
|
1 => 'maybeDown',
|
||||||
2 => 'ok',
|
2 => 'ok',
|
||||||
3 => 'dead',
|
3 => 'dead',
|
||||||
);
|
);
|
||||||
|
|
||||||
my %cfInterconnectStatusIndex = (
|
my %cfInterconnectStatusIndex = (
|
||||||
1 => 'notPresent',
|
1 => 'notPresent',
|
||||||
2 => 'down',
|
2 => 'down',
|
||||||
3 => 'partialFailure',
|
3 => 'partialFailure',
|
||||||
4 => 'up',
|
4 => 'up',
|
||||||
);
|
);
|
||||||
|
|
||||||
my %EcnlStatusIndex = (
|
my %EcnlStatusIndex = (
|
||||||
1 => 'initializing',
|
1 => 'initializing',
|
||||||
@ -302,13 +318,13 @@ my %EcnlStatusIndex = (
|
|||||||
4 => 'inactive',
|
4 => 'inactive',
|
||||||
5 => 'reconfiguring',
|
5 => 'reconfiguring',
|
||||||
6 => 'nonexistent',
|
6 => 'nonexistent',
|
||||||
);
|
);
|
||||||
|
|
||||||
my %fsOverallStatusIndex = (
|
my %fsOverallStatusIndex = (
|
||||||
1 => 'ok',
|
1 => 'ok',
|
||||||
2 => 'Nearly Full',
|
2 => 'Nearly Full',
|
||||||
3 => 'Full',
|
3 => 'Full',
|
||||||
);
|
);
|
||||||
|
|
||||||
### Functions
|
### Functions
|
||||||
###############
|
###############
|
||||||
@ -338,10 +354,8 @@ sub _create_session(@) {
|
|||||||
sub FSyntaxError($) {
|
sub FSyntaxError($) {
|
||||||
my $err = shift;
|
my $err = shift;
|
||||||
print <<EOU;
|
print <<EOU;
|
||||||
$err
|
$err
|
||||||
|
This is $script_name in version $script_version.
|
||||||
This is $script_name in version $script_version.
|
|
||||||
|
|
||||||
Syntax:
|
Syntax:
|
||||||
-H <IP_or_Hostname> Ip/Dns Name of the Filer
|
-H <IP_or_Hostname> Ip/Dns Name of the Filer
|
||||||
-C <community_name> SNMP Community Name for read
|
-C <community_name> SNMP Community Name for read
|
||||||
@ -356,7 +370,6 @@ This is $script_name in version $script_version.
|
|||||||
-e <vol1[,vol2[,...]]> Exclude volumes from snap check (SNAPSHOT/SNAPSHOTAGE)
|
-e <vol1[,vol2[,...]]> Exclude volumes from snap check (SNAPSHOT/SNAPSHOTAGE)
|
||||||
-I Inform only, return OK every time (ignore -w and -c values)
|
-I Inform only, return OK every time (ignore -w and -c values)
|
||||||
-h This help
|
-h This help
|
||||||
|
|
||||||
Available check types:
|
Available check types:
|
||||||
TEMP - Temperature
|
TEMP - Temperature
|
||||||
FAN - Fan Fail
|
FAN - Fan Fail
|
||||||
@ -382,20 +395,15 @@ This is $script_name in version $script_version.
|
|||||||
UPTIME - Only show\'s uptime
|
UPTIME - Only show\'s uptime
|
||||||
CACHEAGE - Cache Age (-w -c)
|
CACHEAGE - Cache Age (-w -c)
|
||||||
FSSTATUS - Overall file system health
|
FSSTATUS - Overall file system health
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
$script_name -H netapp.mydomain -C public -T UPTIME
|
$script_name -H netapp.mydomain -C public -T UPTIME
|
||||||
UPTIME: 2 days, 23:03:21.09 | uptime=255801s
|
UPTIME: 2 days, 23:03:21.09 | uptime=255801s
|
||||||
|
|
||||||
$script_name -H netapp.mydomain -C public -T DISKUSED -v /vol/data/ -w 90 -c 95 -V 2c
|
$script_name -H netapp.mydomain -C public -T DISKUSED -v /vol/data/ -w 90 -c 95 -V 2c
|
||||||
OK: DISKUSED 79% | /vol/data/=8104595240k
|
OK: DISKUSED 79% | /vol/data/=8104595240k
|
||||||
|
|
||||||
$script_name -H netapp.mydomain -C public -T GLOBALSTATUS
|
$script_name -H netapp.mydomain -C public -T GLOBALSTATUS
|
||||||
CRIT: GLOBALSTATUS nonCritical 4 Disk on adapter 1a, shelf 1, bay 9, failed. | globalstatus=4
|
CRIT: GLOBALSTATUS nonCritical 4 Disk on adapter 1a, shelf 1, bay 9, failed. | globalstatus=4
|
||||||
|
|
||||||
$script_name -H netapp.mydomain -C public -T DISKUSED -v wtf
|
$script_name -H netapp.mydomain -C public -T DISKUSED -v wtf
|
||||||
WARN: Unknown volume path or aggregate name 'wtf'. Available values: aggr_p1a_sas2_mirror /vol/vol0/ /vol/esx/ /vol/xen_a/
|
WARN: Unknown volume path or aggregate name 'wtf'. Available values: aggr_p1a_sas2_mirror /vol/vol0/ /vol/esx/ /vol/xen_a/
|
||||||
|
|
||||||
EOU
|
EOU
|
||||||
exit($ERRORS{'UNKNOWN'});
|
exit($ERRORS{'UNKNOWN'});
|
||||||
}
|
}
|
||||||
@ -493,6 +501,8 @@ $opt{'crit'} = 500;
|
|||||||
$opt{'warn'} = 500;
|
$opt{'warn'} = 500;
|
||||||
$opt{'version'} = 2;
|
$opt{'version'} = 2;
|
||||||
$opt{'timeout'} = 60;
|
$opt{'timeout'} = 60;
|
||||||
|
$TIMEOUT_PLUGINS = 180 ;
|
||||||
|
|
||||||
my $result = GetOptions(\%opt,
|
my $result = GetOptions(\%opt,
|
||||||
'filer|H=s',
|
'filer|H=s',
|
||||||
'community|C=s',
|
'community|C=s',
|
||||||
@ -507,6 +517,17 @@ my $result = GetOptions(\%opt,
|
|||||||
"help|h",
|
"help|h",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ( $opt{'timeout'} > 60)
|
||||||
|
{
|
||||||
|
#Set timeout for plugin to the parameter received via command line, but set snmp timeout to the max (60 seconds) if CLI timeout is above 60 seconds
|
||||||
|
$TIMEOUT_PLUGINS=$opt{'timeout'};
|
||||||
|
$opt{'timeout'}=60;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
$TIMEOUT_PLUGINS=$opt{'timeout'};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
FSyntaxError("") if defined $opt{'help'};
|
FSyntaxError("") if defined $opt{'help'};
|
||||||
FSyntaxError("Missing -H") unless defined $opt{'filer'};
|
FSyntaxError("Missing -H") unless defined $opt{'filer'};
|
||||||
FSyntaxError("Missing -C") unless defined $opt{'community'};
|
FSyntaxError("Missing -C") unless defined $opt{'community'};
|
||||||
@ -536,9 +557,16 @@ if (!defined($counterFilePath)) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Just in case of problems, let's not hang Nagios
|
||||||
|
# with "Return code of 142 is out of bounds", instead we set the message "No response in time"
|
||||||
|
|
||||||
|
$SIG{'ALRM'} = sub {
|
||||||
|
print ("CRITICAL: No response in time\n");
|
||||||
|
exit $ERRORS{"CRITICAL"};
|
||||||
|
};
|
||||||
|
|
||||||
# Starting Alarm
|
# Starting Alarm
|
||||||
alarm($TIMEOUT);
|
alarm($TIMEOUT_PLUGINS);
|
||||||
|
|
||||||
# Establish SNMP Session
|
# Establish SNMP Session
|
||||||
our $snmp_session = _create_session($opt{'filer'},$opt{'community'},$opt{'version'},$opt{'timeout'});
|
our $snmp_session = _create_session($opt{'filer'},$opt{'community'},$opt{'version'},$opt{'timeout'});
|
||||||
@ -661,7 +689,7 @@ if("$opt{'check_type'}" eq "TEMP") {
|
|||||||
$msg = "CRIT: Over $opt{'check_type'} !";
|
$msg = "CRIT: Over $opt{'check_type'} !";
|
||||||
}
|
}
|
||||||
$perf = "overtemperature=$check";
|
$perf = "overtemperature=$check";
|
||||||
### Fan ###
|
### Fan ###
|
||||||
} elsif("$opt{'check_type'}" eq "FAN") {
|
} elsif("$opt{'check_type'}" eq "FAN") {
|
||||||
my $check = _get_oid_value($snmp_session,$snmpFailedFanCount);
|
my $check = _get_oid_value($snmp_session,$snmpFailedFanCount);
|
||||||
if($check == 0) {
|
if($check == 0) {
|
||||||
@ -672,7 +700,7 @@ if("$opt{'check_type'}" eq "TEMP") {
|
|||||||
$msg = "CRIT: $opt{'check_type'} $check !";
|
$msg = "CRIT: $opt{'check_type'} $check !";
|
||||||
}
|
}
|
||||||
$perf = "failedfans=$check";
|
$perf = "failedfans=$check";
|
||||||
### PS ###
|
### PS ###
|
||||||
} elsif("$opt{'check_type'}" eq "PS") {
|
} elsif("$opt{'check_type'}" eq "PS") {
|
||||||
my $check = _get_oid_value($snmp_session,$snmpFailPowerSupplyCount);
|
my $check = _get_oid_value($snmp_session,$snmpFailPowerSupplyCount);
|
||||||
if($check == 0) {
|
if($check == 0) {
|
||||||
@ -683,12 +711,12 @@ if("$opt{'check_type'}" eq "TEMP") {
|
|||||||
$msg = "CRIT: $opt{'check_type'} Fail $check !";
|
$msg = "CRIT: $opt{'check_type'} Fail $check !";
|
||||||
}
|
}
|
||||||
$perf = "failedpowersupplies=$check";
|
$perf = "failedpowersupplies=$check";
|
||||||
### CPULOAD ###
|
### CPULOAD ###
|
||||||
} elsif("$opt{'check_type'}" eq "CPULOAD") {
|
} elsif("$opt{'check_type'}" eq "CPULOAD") {
|
||||||
my $check = _get_oid_value($snmp_session,$snmpcpuBusyTimePerCent);
|
my $check = _get_oid_value($snmp_session,$snmpcpuBusyTimePerCent);
|
||||||
($msg,$stat) = _clac_err_stat($check,$opt{'check_type'},$opt{'warn'},$opt{'crit'});
|
($msg,$stat) = _clac_err_stat($check,$opt{'check_type'},$opt{'warn'},$opt{'crit'});
|
||||||
$perf = "cpuload=$check\%;$opt{'warn'};$opt{'crit'};;";
|
$perf = "cpuload=$check\%;$opt{'warn'};$opt{'crit'};;";
|
||||||
### NFSOPS ###
|
### NFSOPS ###
|
||||||
} elsif("$opt{'check_type'}" eq "NFSOPS") {
|
} elsif("$opt{'check_type'}" eq "NFSOPS") {
|
||||||
my $nfsops_per_seconds=floor ( ($total_nfs_ops-$fileNfsOps)/$elapsedtime );
|
my $nfsops_per_seconds=floor ( ($total_nfs_ops-$fileNfsOps)/$elapsedtime );
|
||||||
|
|
||||||
@ -696,7 +724,7 @@ if("$opt{'check_type'}" eq "TEMP") {
|
|||||||
|
|
||||||
($msg,$stat) = _clac_absolute_err_stat($check,$opt{'check_type'},$opt{'warn'},$opt{'crit'});
|
($msg,$stat) = _clac_absolute_err_stat($check,$opt{'check_type'},$opt{'warn'},$opt{'crit'});
|
||||||
$perf = "nfsops=$check";
|
$perf = "nfsops=$check";
|
||||||
### CIFSOPS ###
|
### CIFSOPS ###
|
||||||
} elsif("$opt{'check_type'}" eq "CIFSOPS") {
|
} elsif("$opt{'check_type'}" eq "CIFSOPS") {
|
||||||
my $cifsops_per_seconds=floor ( ($total_cifs_ops-$fileCifsOps)/$elapsedtime );
|
my $cifsops_per_seconds=floor ( ($total_cifs_ops-$fileCifsOps)/$elapsedtime );
|
||||||
|
|
||||||
@ -704,7 +732,7 @@ if("$opt{'check_type'}" eq "TEMP") {
|
|||||||
|
|
||||||
($msg,$stat) = _clac_absolute_err_stat($check,$opt{'check_type'},$opt{'warn'},$opt{'crit'});
|
($msg,$stat) = _clac_absolute_err_stat($check,$opt{'check_type'},$opt{'warn'},$opt{'crit'});
|
||||||
$perf = "cifsops=$check";
|
$perf = "cifsops=$check";
|
||||||
### ISCSIOPS ###
|
### ISCSIOPS ###
|
||||||
} elsif("$opt{'check_type'}" eq "ISCSIOPS") {
|
} elsif("$opt{'check_type'}" eq "ISCSIOPS") {
|
||||||
my $iscsiops_per_seconds=floor ( ($blocks_iscsi_ops-$fileIscsiOps)/$elapsedtime );
|
my $iscsiops_per_seconds=floor ( ($blocks_iscsi_ops-$fileIscsiOps)/$elapsedtime );
|
||||||
my $iscsiread_per_seconds=floor ( ($blocks_iscsi_read-$fileIscsi64ReadBytes)/$elapsedtime );
|
my $iscsiread_per_seconds=floor ( ($blocks_iscsi_read-$fileIscsi64ReadBytes)/$elapsedtime );
|
||||||
@ -716,7 +744,7 @@ if("$opt{'check_type'}" eq "TEMP") {
|
|||||||
($msg,$stat) = _clac_absolute_err_stat($check,$opt{'check_type'},$opt{'warn'},$opt{'crit'});
|
($msg,$stat) = _clac_absolute_err_stat($check,$opt{'check_type'},$opt{'warn'},$opt{'crit'});
|
||||||
$msg = "$msg ops/s (iscsi read=$iscsiread_per_seconds B/s, iscsi write=$iscsiwrite_per_seconds B/s, disk read=$diskread_per_seconds B/s, disk write=$diskwrite_per_seconds B/s)";
|
$msg = "$msg ops/s (iscsi read=$iscsiread_per_seconds B/s, iscsi write=$iscsiwrite_per_seconds B/s, disk read=$diskread_per_seconds B/s, disk write=$diskwrite_per_seconds B/s)";
|
||||||
$perf = "iscsiops=$check iscsiread=$iscsiread_per_seconds iscsiwrite=$iscsiwrite_per_seconds diskread=$diskread_per_seconds diskwrite=$diskwrite_per_seconds";
|
$perf = "iscsiops=$check iscsiread=$iscsiread_per_seconds iscsiwrite=$iscsiwrite_per_seconds diskread=$diskread_per_seconds diskwrite=$diskwrite_per_seconds";
|
||||||
### FCPOPS ###
|
### FCPOPS ###
|
||||||
} elsif("$opt{'check_type'}" eq "FCPOPS") {
|
} elsif("$opt{'check_type'}" eq "FCPOPS") {
|
||||||
my $fcpops_per_seconds=floor ( ($blocks_fcp_ops-$fileFcpOps)/$elapsedtime );
|
my $fcpops_per_seconds=floor ( ($blocks_fcp_ops-$fileFcpOps)/$elapsedtime );
|
||||||
my $fcpread_per_seconds=floor ( ($blocks_fcp_read-$fileFcp64ReadBytes)/$elapsedtime );
|
my $fcpread_per_seconds=floor ( ($blocks_fcp_read-$fileFcp64ReadBytes)/$elapsedtime );
|
||||||
@ -729,7 +757,7 @@ if("$opt{'check_type'}" eq "TEMP") {
|
|||||||
($msg,$stat) = _clac_absolute_err_stat($check,$opt{'check_type'},$opt{'warn'},$opt{'crit'});
|
($msg,$stat) = _clac_absolute_err_stat($check,$opt{'check_type'},$opt{'warn'},$opt{'crit'});
|
||||||
$msg = "$msg ops/s (fcp read=$fcpread_per_seconds B/s, fcp write=$fcpwrite_per_seconds B/s, disk read=$diskread_per_seconds B/s, disk write=$diskwrite_per_seconds B/s)";
|
$msg = "$msg ops/s (fcp read=$fcpread_per_seconds B/s, fcp write=$fcpwrite_per_seconds B/s, disk read=$diskread_per_seconds B/s, disk write=$diskwrite_per_seconds B/s)";
|
||||||
$perf = "fcpops=$check fcpread=$fcpread_per_seconds fcpwrite=$fcpwrite_per_seconds diskread=$diskread_per_seconds diskwrite=$diskwrite_per_seconds";
|
$perf = "fcpops=$check fcpread=$fcpread_per_seconds fcpwrite=$fcpwrite_per_seconds diskread=$diskread_per_seconds diskwrite=$diskwrite_per_seconds";
|
||||||
### NVRAM ###
|
### NVRAM ###
|
||||||
} elsif("$opt{'check_type'}" eq "NVRAM") {
|
} elsif("$opt{'check_type'}" eq "NVRAM") {
|
||||||
my $check = _get_oid_value($snmp_session,$snmpnvramBatteryStatus);
|
my $check = _get_oid_value($snmp_session,$snmpnvramBatteryStatus);
|
||||||
if($check == 1) {
|
if($check == 1) {
|
||||||
@ -740,7 +768,7 @@ if("$opt{'check_type'}" eq "TEMP") {
|
|||||||
$msg = "CRIT: $opt{'check_type'} $nvramBatteryStatus{$check}";
|
$msg = "CRIT: $opt{'check_type'} $nvramBatteryStatus{$check}";
|
||||||
}
|
}
|
||||||
$perf = "nvrambatterystatus=$check";
|
$perf = "nvrambatterystatus=$check";
|
||||||
### DISKUSED ###
|
### DISKUSED ###
|
||||||
} elsif("$opt{'check_type'}" eq "DISKUSED") {
|
} elsif("$opt{'check_type'}" eq "DISKUSED") {
|
||||||
|
|
||||||
FSyntaxError("Missing -v") unless defined $opt{'vol'};
|
FSyntaxError("Missing -v") unless defined $opt{'vol'};
|
||||||
@ -779,7 +807,7 @@ if("$opt{'check_type'}" eq "TEMP") {
|
|||||||
$msg .= " $$r_vol_tbl{$key}"
|
$msg .= " $$r_vol_tbl{$key}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
### SNAPSHOTAGE ###
|
### SNAPSHOTAGE ###
|
||||||
} elsif("$opt{'check_type'}" eq "SNAPSHOTAGE") {
|
} elsif("$opt{'check_type'}" eq "SNAPSHOTAGE") {
|
||||||
|
|
||||||
my @exc_list = split(',',$opt{'exclude'});
|
my @exc_list = split(',',$opt{'exclude'});
|
||||||
@ -885,9 +913,9 @@ if("$opt{'check_type'}" eq "TEMP") {
|
|||||||
$stat = $ERRORS{'UNKNOWN'};
|
$stat = $ERRORS{'UNKNOWN'};
|
||||||
$msg = "UNKNOW Errors";
|
$msg = "UNKNOW Errors";
|
||||||
}
|
}
|
||||||
$perf = "outdated_snapshots=$badcount";
|
$perf = "outdated_snapshots=$badcount";
|
||||||
|
|
||||||
### SNAPSHOT ###
|
### SNAPSHOT ###
|
||||||
} elsif("$opt{'check_type'}" eq "SNAPSHOT") {
|
} elsif("$opt{'check_type'}" eq "SNAPSHOT") {
|
||||||
my @exc_list = split(',',$opt{'exclude'});
|
my @exc_list = split(',',$opt{'exclude'});
|
||||||
my @vol_err;
|
my @vol_err;
|
||||||
@ -923,7 +951,7 @@ $perf = "outdated_snapshots=$badcount";
|
|||||||
}
|
}
|
||||||
$perf = "snapoff=$err_count";
|
$perf = "snapoff=$err_count";
|
||||||
|
|
||||||
### FAILEDDISK ###
|
### FAILEDDISK ###
|
||||||
} elsif("$opt{'check_type'}" eq "FAILEDDISK") {
|
} elsif("$opt{'check_type'}" eq "FAILEDDISK") {
|
||||||
my $check = _get_oid_value($snmp_session,$snmpFailedDiskCount);
|
my $check = _get_oid_value($snmp_session,$snmpFailedDiskCount);
|
||||||
if($check == 0) {
|
if($check == 0) {
|
||||||
@ -935,7 +963,7 @@ $perf = "outdated_snapshots=$badcount";
|
|||||||
}
|
}
|
||||||
$perf = "faileddisks=$check";
|
$perf = "faileddisks=$check";
|
||||||
|
|
||||||
### DISKSUMMARY ###
|
### DISKSUMMARY ###
|
||||||
} elsif("$opt{'check_type'}" eq "DISKSUMMARY") {
|
} elsif("$opt{'check_type'}" eq "DISKSUMMARY") {
|
||||||
my $diskTotal = _get_oid_value($snmp_session,$snmp_netapp_disksummary_diskTotalCount);
|
my $diskTotal = _get_oid_value($snmp_session,$snmp_netapp_disksummary_diskTotalCount);
|
||||||
my $diskActive = _get_oid_value($snmp_session,$snmp_netapp_disksummary_diskActiveCount);
|
my $diskActive = _get_oid_value($snmp_session,$snmp_netapp_disksummary_diskActiveCount);
|
||||||
@ -958,7 +986,7 @@ $perf = "outdated_snapshots=$badcount";
|
|||||||
}
|
}
|
||||||
$perf = "faileddisks=$check total=$diskTotal active=$diskActive spare=$diskSpare reconstructing=$diskReconstructing";
|
$perf = "faileddisks=$check total=$diskTotal active=$diskActive spare=$diskSpare reconstructing=$diskReconstructing";
|
||||||
|
|
||||||
### HA ###
|
### HA ###
|
||||||
} elsif("$opt{'check_type'}" eq "HA") {
|
} elsif("$opt{'check_type'}" eq "HA") {
|
||||||
|
|
||||||
my $cfSettings = _get_oid_value($snmp_session,$snmp_netapp_cfSettings);
|
my $cfSettings = _get_oid_value($snmp_session,$snmp_netapp_cfSettings);
|
||||||
@ -991,18 +1019,18 @@ $perf = "outdated_snapshots=$badcount";
|
|||||||
$perf = "hasettings=$check";
|
$perf = "hasettings=$check";
|
||||||
|
|
||||||
|
|
||||||
### UPTIME ###
|
### UPTIME ###
|
||||||
} elsif("$opt{'check_type'}" eq "UPTIME") {
|
} elsif("$opt{'check_type'}" eq "UPTIME") {
|
||||||
my $check = _get_oid_value($snmp_session,$snmpUpTime);
|
my $check = _get_oid_value($snmp_session,$snmpUpTime);
|
||||||
$msg = "$opt{'check_type'}: $check";
|
$msg = "$opt{'check_type'}: $check";
|
||||||
$check =~ m/^\s*(\d+)\s+days,\s+(\d+):(\d+):(\d+).*$/;
|
$check =~ m/^\s*(\d+)\s+days,\s+(\d+):(\d+):(\d+).*$/;
|
||||||
$perf = "uptime=" . ($1*86400 + $2*3600 + $3*60 + $4) . "s";
|
$perf = "uptime=" . ($1*86400 + $2*3600 + $3*60 + $4) . "s";
|
||||||
### CACHEAGE ###
|
### CACHEAGE ###
|
||||||
} elsif("$opt{'check_type'}" eq "CACHEAGE") {
|
} elsif("$opt{'check_type'}" eq "CACHEAGE") {
|
||||||
my $check = _get_oid_value($snmp_session,$snmpCacheAge);
|
my $check = _get_oid_value($snmp_session,$snmpCacheAge);
|
||||||
($msg,$stat) = _clac_minutes_err_stat($check,$opt{'check_type'},$opt{'warn'},$opt{'crit'});
|
($msg,$stat) = _clac_minutes_err_stat($check,$opt{'check_type'},$opt{'warn'},$opt{'crit'});
|
||||||
$perf = "cache_age=$check";
|
$perf = "cache_age=$check";
|
||||||
### GLOBALSTATUS ###
|
### GLOBALSTATUS ###
|
||||||
} elsif("$opt{'check_type'}" eq "GLOBALSTATUS") {
|
} elsif("$opt{'check_type'}" eq "GLOBALSTATUS") {
|
||||||
my $check = _get_oid_value($snmp_session,$snmpGlobalStatus);
|
my $check = _get_oid_value($snmp_session,$snmpGlobalStatus);
|
||||||
my $global_stat_txt = _get_oid_value($snmp_session,$snmpGlobalStatus_text);
|
my $global_stat_txt = _get_oid_value($snmp_session,$snmpGlobalStatus_text);
|
||||||
@ -1014,7 +1042,7 @@ $perf = "outdated_snapshots=$badcount";
|
|||||||
$msg = "CRIT: $opt{'check_type'} $GlobalStatusIndex{$check} $check $global_stat_txt";
|
$msg = "CRIT: $opt{'check_type'} $GlobalStatusIndex{$check} $check $global_stat_txt";
|
||||||
}
|
}
|
||||||
$perf = "globalstatus=$check";
|
$perf = "globalstatus=$check";
|
||||||
### AUTOSUPPORTSTATUS ###
|
### AUTOSUPPORTSTATUS ###
|
||||||
} elsif("$opt{'check_type'}" eq "AUTOSUPPORTSTATUS") {
|
} elsif("$opt{'check_type'}" eq "AUTOSUPPORTSTATUS") {
|
||||||
my $check = _get_oid_value($snmp_session,$snmpAutoSupportStatus);
|
my $check = _get_oid_value($snmp_session,$snmpAutoSupportStatus);
|
||||||
my $autosupport_stat_txt = _get_oid_value($snmp_session,$snmpAutoSupportStatus_text);
|
my $autosupport_stat_txt = _get_oid_value($snmp_session,$snmpAutoSupportStatus_text);
|
||||||
@ -1026,17 +1054,17 @@ $perf = "outdated_snapshots=$badcount";
|
|||||||
$msg = "CRIT: $opt{'check_type'} $AutoSupportStatusIndex{$check} $check $autosupport_stat_txt";
|
$msg = "CRIT: $opt{'check_type'} $AutoSupportStatusIndex{$check} $check $autosupport_stat_txt";
|
||||||
}
|
}
|
||||||
$perf = "autosupportstatus=$check";
|
$perf = "autosupportstatus=$check";
|
||||||
### NDMPSESSIONS ###
|
### NDMPSESSIONS ###
|
||||||
} elsif("$opt{'check_type'}" eq "NDMPSESSIONS") {
|
} elsif("$opt{'check_type'}" eq "NDMPSESSIONS") {
|
||||||
my $check = _get_oid_value($snmp_session,$snmpNdmpSessions);
|
my $check = _get_oid_value($snmp_session,$snmpNdmpSessions);
|
||||||
($msg,$stat) = _clac_absolute_err_stat($check,$opt{'check_type'},$opt{'warn'},$opt{'crit'});
|
($msg,$stat) = _clac_absolute_err_stat($check,$opt{'check_type'},$opt{'warn'},$opt{'crit'});
|
||||||
$perf = "ndmpsess=$check";
|
$perf = "ndmpsess=$check";
|
||||||
### CIFSSESSIONS ###
|
### CIFSSESSIONS ###
|
||||||
} elsif("$opt{'check_type'}" eq "CIFSSESSIONS") {
|
} elsif("$opt{'check_type'}" eq "CIFSSESSIONS") {
|
||||||
my $check = _get_oid_value($snmp_session,$snmpCifsSessions);
|
my $check = _get_oid_value($snmp_session,$snmpCifsSessions);
|
||||||
($msg,$stat) = _clac_absolute_err_stat($check,$opt{'check_type'},$opt{'warn'},$opt{'crit'});
|
($msg,$stat) = _clac_absolute_err_stat($check,$opt{'check_type'},$opt{'warn'},$opt{'crit'});
|
||||||
$perf = "cifssess=$check";
|
$perf = "cifssess=$check";
|
||||||
### SHELF ###
|
### SHELF ###
|
||||||
} elsif ( ("$opt{'check_type'}" eq "SHELF") or ("$opt{'check_type'}" eq "SHELFINFO") ) {
|
} elsif ( ("$opt{'check_type'}" eq "SHELF") or ("$opt{'check_type'}" eq "SHELFINFO") ) {
|
||||||
my @errs;
|
my @errs;
|
||||||
my $r_shelf = $snmp_session->get_table($snmpEnclTableIndex);
|
my $r_shelf = $snmp_session->get_table($snmpEnclTableIndex);
|
||||||
@ -1124,7 +1152,7 @@ $perf = "outdated_snapshots=$badcount";
|
|||||||
else
|
else
|
||||||
{ $perf = "shelf=1"; }
|
{ $perf = "shelf=1"; }
|
||||||
}
|
}
|
||||||
### FSSTATUS ###
|
### FSSTATUS ###
|
||||||
} elsif("$opt{'check_type'}" eq "FSSTATUS") {
|
} elsif("$opt{'check_type'}" eq "FSSTATUS") {
|
||||||
my $check = _get_oid_value($snmp_session,$snmpfsOverallStatus);
|
my $check = _get_oid_value($snmp_session,$snmpfsOverallStatus);
|
||||||
my $global_stat_txt = _get_oid_value($snmp_session,$snmpfsOverallStatus_text);
|
my $global_stat_txt = _get_oid_value($snmp_session,$snmpfsOverallStatus_text);
|
||||||
@ -1140,7 +1168,7 @@ $perf = "outdated_snapshots=$badcount";
|
|||||||
}
|
}
|
||||||
$perf = "fsstatus=$check";
|
$perf = "fsstatus=$check";
|
||||||
|
|
||||||
### Syntax Error ###
|
### Syntax Error ###
|
||||||
} else {
|
} else {
|
||||||
FSyntaxError("$opt{'check_type'} invalid parameter !");
|
FSyntaxError("$opt{'check_type'} invalid parameter !");
|
||||||
}
|
}
|
||||||
@ -1149,3 +1177,4 @@ $msg =~ s/\n//g;
|
|||||||
$perf ? print "$msg | $perf\n" : print "$msg\n";
|
$perf ? print "$msg | $perf\n" : print "$msg\n";
|
||||||
|
|
||||||
exit($stat);
|
exit($stat);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user