Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
go ahead... be a heretic

Can I access NetWare volume stats using perl on NT?

( #70138=categorized question: print w/ replies, xml ) Need Help??
Contributed by Anonymous Monk on Apr 05, 2001 at 19:46 UTC
Q&A  > network programming

Answer: Can I access NetWare volume stats using perl on NT?
contributed by Coyote

There are a couple of options to do this. The simplest way to get volume stats under netware would be to grab the output from NDIR utility (ndir /SPA) and parse it in perl. Another way to do it would be to use the NDSm perl modules, a commercial product that wraps the Netware Client32 libraries. A third way would be to grab the ActiveX controls for Netware from and use Win32::OLE from perl to talk to the ActiveX controls. Here's a link to the documentation for the controls.

I've used both the the NDSm modules and the ActiveX/COM kludge in Netware related sysadmin scripts over the years, but I find that munging the output from Novell's powerful, but needlessly complex command line utilities usually works best.

contributed by saprice

Thanks for the links. I have around 100 NW4 servers that I need to monitor volume utilization (free space) on. I've been using an NDIR parsing script until now, but with volumes being added and deleted its making maintaining the script a pain. I'll look at the OLE route and see if I can hack something together with it. Regards sp

contributed by jbodoni

Use Net::SNMP! If you've got Netware 5.1 or later, SNMP is installed.

#!c:\perl\bin\perl.exe -w # props to 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 = "."; # +e my $NWNameOID = $NWBaseOID . ".1.2."; # +wFSVolEntry.nwVolPhysicalName my $NWVolSizeOID = $NWBaseOID . ".1.3."; # +FSVolEntry.nwVolSize in KB my $NWVolFreeOID = $NWBaseOID . ".1.4."; # +FSVolEntry.nwVolFree in KB my $NWVolPurgableOID = $NWBaseOID . ".1.5."; # +e.nwFSVolEntry.nwVolFreeable in KB my $NWVolMountedOID = $NWBaseOID . ".1.8."; # +.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;
contributed by rchiav

I'd suggest using ADSI. It requires Win32::OLE. If you need to install ADSI, go here. The book "WIN32 PERL SCRIPTING, The Administrators Handbook" covers some of the basics of ADSI with Perl, though it doesn't have any NDS specific examples.

Unfortunately I've never used Perl to interface with NDS so I can't be much more help than this.

Good Luck,



  • Please read these before you post! —
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Log In?

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

    How do I use this? | Other CB clients
    Other Users?
    Others chanting in the Monastery: (7)
    As of 2014-03-13 21:38 GMT
    Find Nodes?
      Voting Booth?

      Have you used a cryptocurrency?

      Results (290 votes), past polls