Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Use Net::SNMP! If you've got Netware 5.1 or later, SNMP is installed.

#!c:\perl\bin\perl.exe -w # props to http://myweb.facstaff.wwu.edu/~riedesg/sysadmin1138/ for mo +st of this code! use strict; use warnings; use Net::SNMP; use Time::Seconds; use Time::Piece; # provide your SNMP community string and your list of servers below my $community = 'public'; my @servers = uc ( shift ) || qw/FS1 FS2 FS3/; # lets you specify a s +erver on the command line for quick query # end of user-provided information my $timenow = localtime; # Mon Aug 26 14:30:09 2002 $enddate) = map $_->strftime('%Y-%m-%d'), $timenow, $weeks, $start, $e +nd; my ($timestamp) = map $_->strftime('%Y-%m-%d '), $timenow; my @report; my $NWBaseOID = ".1.3.6.1.4.1.23.2.28.2.14"; # .iso.org.dod.interne +t.private.enterprises.novell.mibDoc.nwServer.nwFileSystem.nwFSVolTabl +e my $NWNameOID = $NWBaseOID . ".1.2."; # .iso.org.dod.internet.p +rivate.enterprises.novell.mibDoc.nwServer.nwFileSystem.nwFSVolTable.n +wFSVolEntry.nwVolPhysicalName my $NWVolSizeOID = $NWBaseOID . ".1.3."; # .iso.org.dod.internet.pr +ivate.enterprises.novell.mibDoc.nwServer.nwFileSystem.nwFSVolTable.nw +FSVolEntry.nwVolSize in KB my $NWVolFreeOID = $NWBaseOID . ".1.4."; # .iso.org.dod.internet.pr +ivate.enterprises.novell.mibDoc.nwServer.nwFileSystem.nwFSVolTable.nw +FSVolEntry.nwVolFree in KB my $NWVolPurgableOID = $NWBaseOID . ".1.5."; # .iso.org.dod.interne +t.private.enterprises.novell.mibDoc.nwServer.nwFileSystem.nwFSVolTabl +e.nwFSVolEntry.nwVolFreeable in KB my $NWVolMountedOID = $NWBaseOID . ".1.8."; # .iso.org.dod.internet +.private.enterprises.novell.mibDoc.nwServer.nwFileSystem.nwFSVolTable +.nwFSVolEntry.nwVolMounted, 1=mounted, 2=unmounted for my $servername (@servers) { my ($Session, $Error) = Net::SNMP->session( -hostname => $serverna +me, -community => $community ); my $Table = $Session->get_table( -baseoid => $NWBaseOID ); print STDERR "No info for $servername!\n" unless defined $Table; push @report, "$timestamp\t$servername / ERR\tERR\n" unless define +d $Table; next unless defined $Table; for (my $drivenumber = 1; $drivenumber < 256 ; $drivenumber++) { + # Cluster drives start at 255 and work DOWN next unless $Table -> { $NWVolMountedOID . $drivenumber }; next if $Table -> { $NWNameOID . $drivenumber } =~ /_ADMIN/; my $diskname = $Table -> { $NWNameOID . $drivenumber}.":"; +# Appends a ":" for backward compatibility my $totalsize = $Table -> { $NWVolSizeOID . $drivenumber}; my $freespace = $Table -> { $NWVolFreeOID . $drivenumber}; my $utilized = 100 - int ( $freespace / $totalsize * 100 ); push @report, "$servername / $diskname\t$utilized\n"; } $Session->close(); } print sort @report;

In reply to Re: Can I access NetWare volume stats using perl on NT? by jbodoni
in thread Can I access NetWare volume stats using perl on NT? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-19 20:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found