Fellow Toasters:
So after plowing around I found that it was probly time for me to actually learn SNMP alittle better than I previously had. I'll summerize my conclusions for postarity.
So the first step is getting that MIB from NetApp. Then putting it in your /usr/local/share/snmp/mibs/ directory (yes, there is a way around this, but...). Then you can get cracking. By supplying a "-m netapp-mib-file" helped get around any problem I originally had. My biggest problem was getting the MIB file correctly loading. True you can walk the tree without it, but as most of the people who replied to me suggested, walking from .1 really sucks. (No offense, it's just alot of data)
I found that all OID's can start at enterprises, rather than .iso. That helped. Then I found that restricting walking to the main arteries of the Filer MIB's groups was best, namely thoughs found in this document: http://now.netapp.com/NOW/knowledge/docs/ontap/rel60/html/sag/snmp3.htm# top
Several commands that I liked were: # snmpwalk -m NETWORK-APPLIANCE-MIB -v 1 myfilerhost1 public .iso.org.dod.internet.private.enterprises.netapp.netapp1.raid # snmpget -m NETWORK-APPLIANCE-MIB -v 1 -Ov ralph public enterprises.netapp.netapp1.sysStat.environment.envFailedPowerSupplyMessa ge.0
The earlier command searching the RaidGroup information, which is IMHO the most intersting stuff from the Filers. The second grabbing a specific OID value. The "-Ov" arguement to snmpget says to suppress its natural urge to display the OID with the value, giving us JUST the value itself.
Anyway, I mentioned that I was interested in all this stuff in order to find an easy and automated way to check for failed disks. I built a script to do just that. I'm attach it below. It's _really_ basic, but should help anyone interested in building such a script get a head start. I wanted this to be super straightforward, so don't get too down on my PERL.
Thanx for all replies from the Guru Toasters out there.
Ben Rockwood UNIX Systems Admin brockwood@homestead-inc.com
------------------------------------------------------------------------ ---- #!/usr/bin/perl
#Usage: nacheckfilers toaster1 toaster2 toaster3 ...... # nacheckfilers v0.5 # Dependancies: PERL 5, UCD SNMP, NetApp MIB
# Copyright (C) 2001 Homestead Inc. # Written by Ben Rockwood brockwood@homestead-inc.com # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
## NOTES: This is an UNPOLISHED script for reference and modification. ## All SNMP gets are intended to be as simple to follow as possible. ## This script was inspired loosely (namely 2 lines, but...) on an earlier ## script by Daniel Quinlan posted to the Toasters group. ## In its current for this script does NO host checking and can therefore ## create pages of rubbish by supplying a non-existant or non-Filer host.
###################################### ## User Changable Config Parameters ## ######################################
#Set the path for UCD-SNMP $ENV{'PATH'}="/bin:/usr/bin:/usr/sbin:/usr/bin:/usr/local/bin"; #Make sure UCD-SNMP knows which MIB we wanna use #Note, the _actual_ file name is NETWORK-APPLIANCE-MIB.txt, the .txt should not be supplied below. #Note, the NetApp supplied MIB file is normally netapp_1_5.mib, link or rename it to NETWORK-APPLIANCE-MIB.txt $ENV{'MIBS'}="+NETWORK-APPLIANCE-MIB"; #Set the community string $COMMUNITY = "public";
#################### ## Main Run Loop ## ####################
$ARGS = @ARGV;
unless ($ARGS > 0) { die "Usage: nacheckfilers toaster1 toaster2 toaster3 ...\n"; }
for ($i = 0; $i < $ARGS; $i++) { $TARGETHOST = $ARGV[$i];
__gen_filer_report();
}
############################# # Now do the heavy lifting ## #############################
sub __gen_filer_report {
## Setup some common stuff for convience
$SNMPGET = "snmpget -v 1 -Ov $TARGETHOST $COMMUNITY "; $DATE = `date`;
## Heres where we get all the goods.
chomp($failedfans = `$SNMPGET enterprises.netapp.netapp1.sysStat.environment.envFailedFanCount.0`); chomp($failedfansmsg = `$SNMPGET enterprises.netapp.netapp1.sysStat.environment.envFailedFanMessage.0`);
chomp($failedps = `$SNMPGET enterprises.netapp.netapp1.sysStat.environment.envFailedPowerSupplyCount .0`); chomp($failedpsmsg = `$SNMPGET enterprises.netapp.netapp1.sysStat.environment.envFailedPowerSupplyMessa ge.0`);
chomp($batterystat = `$SNMPGET enterprises.netapp.netapp1.sysStat.nvram.nvramBatteryStatus.0`);
chomp($globalmsg = `$SNMPGET enterprises.netapp.netapp1.sysStat.misc.miscGlobalStatusMessage.0`);
chomp($diskcount = `$SNMPGET enterprises.netapp.netapp1.raid.diskSummary.diskTotalCount.0`); chomp($activecount = `$SNMPGET enterprises.netapp.netapp1.raid.diskSummary.diskActiveCount.0`);
chomp($rebuildingcount = `$SNMPGET enterprises.netapp.netapp1.raid.diskSummary.diskReconstructingCount.0`); chomp($reparitycount = `$SNMPGET enterprises.netapp.netapp1.raid.diskSummary.diskReconstructingParityCoun t.0`); chomp($verifyparitycount = `$SNMPGET enterprises.netapp.netapp1.raid.diskSummary.diskVerifyingParityCount.0`) ;
chomp($failedcount = `$SNMPGET enterprises.netapp.netapp1.raid.diskSummary.diskFailedCount.0`); chomp($sparecount = `$SNMPGET enterprises.netapp.netapp1.raid.diskSummary.diskSpareCount.0`);
chomp($failedmsg = `$SNMPGET enterprises.netapp.netapp1.raid.diskSummary.diskFailedMessage.0`);
## Here's where we output all this crap.
print("\n\nStatus Report for $TARGETHOST: $DATE\n"); print(" The global message is: $globalmsg \n\n");
print(" There are $failedfans failed fans.\n"); if($failedfans != 0) { print("\n***FAILED FAN IN $TARGETHOST: $failedfanmsg ***\n\n"); }
print(" There are $failedps failed power supplied.\n"); if($failedps != 0) { print("\n***FAILED POWER SUPPLY IN $TARGETHOST: $failedpsmsg ***\n\n"); }
print(" Battery Status is: $batterystat \n"); print(" Total disk count is: $diskcount \n"); print(" The Active Disk Count is: $activecount \n"); print(" The Spare Disk Count is: $sparecount \n"); if($activecount + $sparecount != $diskcount) { print("\n***PROBLEM: ActiveDisks plus SpareDisks dont match TotalDisks. Investigate***\n\n"); } print(" The Failed Disk Count is: $failedcount \n"); if($failedcount != 0) { print("\n***FAILED DISK IN $TARGETHOST: $failedmsg ***\n\n"); }
print("\n ------H--O--M--E--S--T--E--A--D--.--C--O--M-----\n");
} #------------------------- FIN -----------brockwood@homestead-inc.com---