1
0
mirror of https://github.com/ranl/monitor-utils.git synced 2024-11-22 07:23:42 +01:00

DISKUSED used 64bit counter if with -V 2c, fix 32bit

On big volumes (bigger then 32bit counter = 4GB) overflow to
negative values. SNMP on version 2c can transport 64bit value,
it's not necessary using Low and High 32bit part of 64bit number.
Fix DISKUSED on SNMPv1 if using more then 4GB of space.

New _ulong64() function for counting 64bit number from its high
and low 32bit parts. This function computing correct 64bit number
on 32bit operating system.
This commit is contained in:
Michal Svamberg 2015-05-30 23:32:05 +02:00
parent 53ac3aa8a4
commit f6d0d9deb9

View File

@ -85,6 +85,7 @@ my $snmpHostUptime;
### SNMP OIDs ### SNMP OIDs
### You can browse at http://www.oidview.com/mibs/789/NETAPP-MIB.html
############### ###############
my $snmpSysUpTime = '.1.3.6.1.2.1.1.3.0'; my $snmpSysUpTime = '.1.3.6.1.2.1.1.3.0';
my $snmpFailedFanCount = '.1.3.6.1.4.1.789.1.2.4.2.0'; my $snmpFailedFanCount = '.1.3.6.1.4.1.789.1.2.4.2.0';
@ -133,7 +134,10 @@ 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_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_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 $snmp_netapp_volume_id_table_df_used_prec = "$snmp_netapp_volume_id_table_df.6";
# 64bit values for SNMP v2c
my $snmp_netapp_volume_id_table_df64_total = "$snmp_netapp_volume_id_table_df.29";
my $snmp_netapp_volume_id_table_df64_used = "$snmp_netapp_volume_id_table_df.30";
my $snmp_netapp_volume_id_table_df64_free = "$snmp_netapp_volume_id_table_df.31";
my $snmp_netapp_enclNumber = '.1.3.6.1.4.1.789.1.21.1.1'; my $snmp_netapp_enclNumber = '.1.3.6.1.4.1.789.1.21.1.1';
my $snmpEnclTable = '.1.3.6.1.4.1.789.1.21.1.2.1'; my $snmpEnclTable = '.1.3.6.1.4.1.789.1.21.1.2.1';
@ -294,14 +298,14 @@ $err
PS - Power Supply Fail PS - Power Supply Fail
CPULOAD - CPU Load (-w -c) CPULOAD - CPU Load (-w -c)
NVRAM - NVram Battery Status NVRAM - NVram Battery Status
DISKUSED - Vol Usage Precentage (-w -c -v) DISKUSED - Vol Usage Percentage (-w -c -v), for big volumes (>4GB) use -V 2c
SNAPSHOT - Snapshot Config (-e volname,volname2,volname3) SNAPSHOT - Snapshot Config (-e volname,volname2,volname3)
SHELF - Shelf Health SHELF - Shelf Health
SHELFINFO - Shelf Model & Temperature Information SHELFINFO - Shelf Model & Temperature Information
NFSOPS - Nfs Ops per seconds (-w -c) NFSOPS - Nfs Ops per seconds (-w -c)
CIFSOPS - Cifs Ops per seconds (-w -c) CIFSOPS - Cifs Ops per seconds (-w -c)
ISCSIOPS - iSCSI Ops per seconds, sets -V 2c (-w -c) ISCSIOPS - iSCSI Ops per seconds, using -V 2c automatic (-w -c)
FCPOPS - FibreChannel Ops per seconds, sets -V 2c (-w -c) FCPOPS - FibreChannel Ops per seconds, using -V 2c automatic (-w -c)
NDMPSESSIONS - Number of ndmp sessions (-w -c) NDMPSESSIONS - Number of ndmp sessions (-w -c)
CIFSSESSIONS - Number of cifs sessions (-w -c) CIFSSESSIONS - Number of cifs sessions (-w -c)
GLOBALSTATUS - Global Status of the filer GLOBALSTATUS - Global Status of the filer
@ -310,7 +314,7 @@ $err
DISKSUMMARY - Status of disks DISKSUMMARY - Status of disks
FAILEDDISK - Number of failed disks FAILEDDISK - Number of failed disks
UPTIME - Only show\'s uptime UPTIME - Only show\'s uptime
CACHEAGE - Cache Age CACHEAGE - Cache Age (-w -c)
Examples: Examples:
$script_name -H netapp.mydomain -C public -T UPTIME $script_name -H netapp.mydomain -C public -T UPTIME
@ -319,8 +323,8 @@ $err
$script_name -H netapp.mydomain -C public -T FCOPS -I $script_name -H netapp.mydomain -C public -T FCOPS -I
CRIT: FCPOPS 1130 | fcpops=1130 CRIT: FCPOPS 1130 | fcpops=1130
$script_name -H netapp.mydomain -C public -T DISKUSED -v /vol/vol0/ -w 90 -c 95 $script_name -H netapp.mydomain -C public -T DISKUSED -v /vol/data/ -w 90 -c 95 -V 2c
OK: DISKUSED 5% | /vol/vol0/=8639316k 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
@ -650,8 +654,13 @@ if("$opt{'check_type'}" eq "TEMP") {
if("$$r_vol_tbl{$key}" eq "$opt{'vol'}") { if("$$r_vol_tbl{$key}" eq "$opt{'vol'}") {
my @tmp_arr = split(/\./, $key); my @tmp_arr = split(/\./, $key);
my $oid = pop(@tmp_arr); my $oid = pop(@tmp_arr);
my $used = "";
my $used = _get_oid_value($snmp_session,"$snmp_netapp_volume_id_table_df_used.$oid"); if ($opt{'version'} eq '2c') {
$used = _get_oid_value($snmp_session,"$snmp_netapp_volume_id_table_df64_used.$oid");
}
else {
$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"); 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'}); ($msg,$stat) = _clac_err_stat($used_prec,$opt{'check_type'},$opt{'warn'},$opt{'crit'});