Permalink
Browse files

NetWare 1.0

git-svn-id: http://zenpacks.zenoss.org/svn/zenpacks@129 db08cffe-75b9-45d1-af1a-46ad9ef135f6
  • Loading branch information...
0 parents commit a711abd80a3695da73be84a7d567c174b8ae724c Matt Ray committed Mar 11, 2009
@@ -0,0 +1,16 @@
+All files in this directory and below are:
+
+Copyright (c) 2009 Zenoss, Inc. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 as published
+by the Free Software Foundation.
+
+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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -0,0 +1 @@
+__import__('pkg_resources').declare_namespace(__name__)
@@ -0,0 +1,8 @@
+
+import Globals
+import os.path
+
+skinsDir = os.path.join(os.path.dirname(__file__), 'skins')
+from Products.CMFCore.DirectoryView import registerDirectory
+if os.path.isdir(skinsDir):
+ registerDirectory(skinsDir, globals())
@@ -0,0 +1,2 @@
+# __init__.py
+
@@ -0,0 +1 @@
+# __init__.py
@@ -0,0 +1,14 @@
+#! /usr/bin/env bash
+
+device=$1
+community=$2
+fs_index=$3
+
+base_fs_table_oid=.1.3.6.1.4.1.23.2.28.2.14.1
+totalBlocks_oid=$base_fs_table_oid.3.$fs_index
+freeBlocks_oid=$base_fs_table_oid.4.$fs_index
+
+output=`snmpget -v1 -c $community $device $totalBlocks_oid $freeBlocks_oid | awk '{ print $NF; }'`
+usedBlocks=`echo $output - p | /usr/bin/dc`
+formatted=`echo $output | sed -e 's/ / freeBlocks:/'`
+echo "totalBlocks:$formatted usedBlocks:$usedBlocks"
@@ -0,0 +1,188 @@
+#!/usr/bin/perl
+
+#########################################################
+# Netware Server Stat Extension #
+# to Zenoss Client Access #
+# #
+# This is the "client" portion of the Netware Server #
+# stats extension for Zenoss. This will open up a #
+# connection to the specified server and get the #
+# information that you specify. #
+# #
+#########################################################
+#Zenoss version by Eric Feldman (eafeldman at gmail.com)#
+# #
+# #
+#Adapted from nwstat.pl by James Drews #
+# (drews@engr.wisc.edu) on #
+# Version 1.46 #
+# URL: #
+#http://forge.novell.com/modules/xfmod/project/?mrtgext #
+#########################################################
+# This program is freeware. *NO* warranty is expressed,#
+# implied, nor granted to you in any way. Use of this #
+# program is at your own risk. Your mileage may vary. #
+# This program was packed by weight, not by volume. #
+# Some settling may have occurred during shipment. #
+#########################################################
+
+#########################################################
+# Command Line Usage #
+# nwstat.pl host option1 option2 option3...option5 #
+# where host is the DNS name of the server to query #
+# and option1 and option2 are any combination of the #
+# following (case is not important): #
+# UTIL1 : 1 minute average CPU utilization #
+# UTIL5 : 5 minute average CPU utilization #
+# UTIL15 : 15 minute average CPU Utilization #
+# LICENSE : Connection License Count #
+# CONNECT : number currently licensed connections #
+# CONNMAX : Max number licensed connections used #
+# CONNPEAK : Peak Connections #
+# : (netware 3 = error (-1) ) #
+# : (netware 4 = number connections #
+# : allocated) #
+# NAME : Server's name #
+# UPTIME : Time that the server is operational #
+# VS<vol> : size of the volume <vol> in bytes #
+# VF<vol> : bytes free on <vol> #
+# VU<vol> : bytes used on <vol> #
+# VKS<vol> : size of the volume <vol> in kbytes #
+# VKF<vol> : kbytes free on <vol> #
+# VKU<vol> : kbytes used on <vol> #
+# VP<vol> : bytes of purgable files on <vol> #
+# VKP<vol> : kbytes of purgable files on <vol> #
+# VNP<vol> : bytes of not-yet-purgable files #
+# VKNP<vol> : kbytes of not-yet-purgable files #
+# ZERO : Returns the value 0 #
+# VOLUMES : Returns the list of mounted volumes #
+# : each volume name is on a seperate #
+# : line. Used by the nlmcfg.pl script #
+# S1 : Long Term Cache Hit Percentage #
+# S2 : Current number cache buffers #
+# S3 : Number of dirty cache buffers #
+# S4 : Cache LRU in seconds #
+# S5 : Cache LRU in minutes #
+# S6 : Dirty cache buffers as percent of tot #
+# S7 : Total cache buffers as percent of #
+# original #
+# S8 : Original number of cache buffers #
+# S9 : SAP object Count #
+# S9.x : SAP Object count for service x #
+# S10 : CPU Count #
+# S11 : IS DS Database Open? 1=yes 0=no #
+# S12 : Logins enabled? 1=yes 0=no #
+# S13 : DS.NLM Version string #
+# S14 : MRTGEXT.NLM Version string #
+# S15 : Packet receive buffer count #
+# S16 : Get Maximum packet receive buffer cnt #
+# S17 : Abended thread count (5.x only) #
+# S18 : Open file count #
+# S19 : OS Version String #
+# S20 : Max service processes #
+# S21 : Current service processes (5.x only) #
+# S22 : Time In Sync To the Network (0=No, #
+# 1 = yes) #
+# S23:<nlm> : Is <nlm> loaded? (0=no,1=yes) #
+# S24:<nlm> : Get <nlm>'s version #
+# S25 : Minimum Directory Cache Buffers #
+# S26 : Maximum Directory Cache Buffers #
+# S27 : Current Directory Cache Buffers #
+# #
+# Example: To get the server utilization for 5 and 15 #
+# minutes on the myserv.mydomain.com. #
+# #
+# nwstat.pl myserv.mydomain.com UTIL5 UTIL15 #
+# #
+# Example: To graph the disk space usage on the SYS #
+# volume on myserv.mydomain.com. #
+# #
+# nwstat.pl myserv.mydomain.com VFsys VUsys #
+#########################################################
+# #
+# Other notes: #
+# The server side NLM can take ALL the options on the #
+# command line at once. However, MRTG is written to #
+# only graph two variables at a time. Should some #
+# ambitious person modify the program to graph more #
+# than two items at once, this program can easily be #
+# expanded to output more items. #
+# #
+# The server will stop accepting input at 1023 chars #
+# or when it gets the first \n character #
+# #
+# Thanks to Kevin Keyser <kevin-keyser@uiowa.edu> #
+# for fixing the problem of loosing the 'W' char from #
+# the server name #
+#########################################################
+
+# Required for perl5.
+use Socket;
+($_, $opt1, $opt2, $opt3, $opt4, $opt5, $opt6, $opt7, $opt8, $opt9, $opt10) = @ARGV;
+
+if (!$_) {
+ print "Usage: $0 HOST OPTION1 OPTION2 OPTION3 .... OPTION10\n";
+ print " where host is the DNS name of the server to query\n";
+ print " and option1 and option2 are any combination of the\n";
+ print " following (case is not important):\n";
+ print " UTIL1 : 1 minute average CPU utilization\n";
+ print " UTIL5 : 5 minute average CPU utilization\n";
+ print " UTIL15 : 15 minute average CPU Utilization\n";
+ print " LICENSE : Connection License count\n";
+ print " CONNECT : number currently licensed connections\n";
+ print " CONNMAX : max licensed connections used\n";
+ print " CONNPEAK : Peak Connections\n";
+ print " : (netware 3 = error (-1) )\n";
+ print " : (netware 4 = number connections\n";
+ print " : allocated)\n";
+ print " VF<vol> : bytes free on <vol>\n";
+ print " VS<vol> : size in bytes of <vol>\n";
+ print " VU<vol> : bytes used on <vol>\n";
+ print " VKF<vol> : kbytes free on <vol>\n";
+ print " VKS<vol> : size in kbytes of <vol>\n";
+ print " VKU<vol> : kbytes used on <vol>\n";
+ print " ZERO : returns a zero (0)\n";
+ print " S1 : Long Term Cache Hit Percentage\n";
+ print " S2 : Number of Cache Buffers\n";
+ print " S3 : Number of Dirty Cache Buffers\n";
+ print " S4 : Cache LRU in seconds\n";
+ print " S5 : Cahce LRU in minutes\n";
+ print "\n Example: To graph the disk space usage on the SYS\n";
+ print " volume on myserv.mydomain.com.\n\n";
+ die " $0 myserv.mydomain.com VFsys VUsys\n";
+}
+
+$hostname = $_;
+
+# if you load the NLM with a different port
+# from the default, here is where you change it
+$port = 9999;
+
+# Open a socket and get the data
+ ($sockaddr,$there,$response,$tries) = ("Snc4x8");
+# On Win95, passing a numeric IP address to inet_aton() is slow, so
+# detect this case and use a simple conversion.
+ if ($hostname =~ /^\d+\.\d+\.\d+\.\d+(.*)/ )
+ {
+ $remote_addr = pack("C4",split /\./, $hostname);
+ } else {
+ $remote_addr = (gethostbyname($hostname))[4]
+ || die (host_not_found_error ($hostname, $?));
+ }
+
+ my $sockaddr_in = 'S n a4 x8';
+ $there = pack($sockaddr_in, AF_INET, $port, $remote_addr);
+ $proto = (getprotobyname ('tcp'))[2];
+
+ if (!socket(S,AF_INET,SOCK_STREAM,$proto)) { printf "-1\n-1\n\n\n"; die "$0: Fatal Error. $!\n"; }
+ if (!connect(S,$there)) { printf "-2\n-2\n\n\n"; die "$0: Fatal Error. $!\n"; }
+ select(S);$|=1;
+ select(STDOUT);
+ print S "$opt1 $opt2 $opt3 $opt4 $opt5 $opt6 $opt7 $opt8 $opt9 $opt10\r\n";
+ @replies=<S> ;
+ chomp(@replies);
+ close(S);
+ $a=shift@replies; $b=shift@replies; $c=shift@replies; $d=shift@replies; $e=shift@replies;
+ $f=shift@replies; $g=shift@replies; $h=shift@replies; $i=shift@replies; $j=shift@replies;
+ print "OK |$opt1=$a\ $opt2=$b\ $opt3=$c\ $opt4=$d\ $opt5=$e\ $opt6=$f\ $opt7=$g\ $opt8=$h\ $opt9=$i\ $opt10=$j\n";
+
@@ -0,0 +1 @@
+# __init__.py
@@ -0,0 +1 @@
+# __init__.py
@@ -0,0 +1,69 @@
+__doc__="""NetWareFileSystemMap
+
+FileSystemMap maps the interface and ip tables to interface objects
+
+$Id: NetWareFileSystemMap.py,v 0.9 2009/03/09 efeldman"""
+
+__version__ = '$Revision: 0.9 $'[11:-2]
+
+import re
+
+from Products.DataCollector.plugins.CollectorPlugin import SnmpPlugin, GetTableMap, GetMap
+from Products.DataCollector.plugins.DataMaps import ObjectMap
+import Globals
+
+class NetWareFileSystemMap(SnmpPlugin):
+
+ maptype = "FileSystemMap"
+ compname = "os"
+ relname = "filesystems"
+ modname = "Products.ZenModel.FileSystem"
+ deviceProperties = \
+ SnmpPlugin.deviceProperties + ('zFileSystemMapIgnoreNames',)
+
+
+ columns = {
+ '.1': 'nwVolId',
+ '.2': 'nwVolPhysicalName',
+ '.3': 'nwVolSize',
+ '.4': 'nwVolFree',
+ '.5': 'nwVolFreeable',
+ '.6': 'nwVolNonFreeable',
+ '.7': 'nwVolBlockSize',
+ '.8': 'nwVolMounted',
+ '.15': 'nwVolFileSystemID',
+ }
+
+ snmpGetTableMaps = (
+ GetTableMap('nwFSTable', '.1.3.6.1.4.1.23.2.28.2.14.1', columns),
+ )
+
+ nwVolFileSystemID = {
+ 3: 'netware',
+ 5: 'nss',
+ }
+
+
+ def process(self, device, results, log):
+ """collect snmp information from this device"""
+ getdata, tabledata = results
+ fstable = tabledata.get( "nwFSTable" )
+ skipfsnames = getattr(device, 'zFileSystemMapIgnoreNames', None)
+ maps = []
+ rm = self.relMap()
+ for fs in fstable.values():
+ if not fs.has_key("nwVolSize"): continue
+ if not self.checkColumns(fs, self.columns, log): continue
+ if fs['nwVolSize'] > 0 and (not skipfsnames or not re.search(skipfsnames,fs['nwVolPhysicalName'])):
+ om = self.objectMap()
+ om.id = self.prepId(fs['nwVolPhysicalName'])
+ om.snmpindex = fs['nwVolId']
+ om.mount = fs['nwVolPhysicalName']
+ om.type = fs['nwVolFileSystemID']
+ om.blockSize = 1024
+ om.totalBlocks = fs['nwVolSize']
+ rm.append(om)
+ maps.append(rm)
+ return maps
+
+
@@ -0,0 +1,27 @@
+__doc__="""NetWareMemoryInfo
+
+__version__ = '$Revision: 0.1'"""
+import re
+
+from Products.DataCollector.plugins.CollectorPlugin import SnmpPlugin, GetMap
+from Products.DataCollector.plugins.DataMaps import ObjectMap
+import Globals
+
+class NetWareMemoryInfo(SnmpPlugin):
+
+ maptype = "NetwareMemoryInfo"
+ compname = "hw"
+ relname = "filesystems"
+ modname = "Products.ZenModel.FileSystem"
+
+ snmpGetMap = GetMap({
+ '.1.3.6.1.2.1.25.2.2.0': 'totalMemory',
+ })
+
+ def process(self, device, results, log):
+ log.info('processing %s for device %s', self.name(), device.id)
+ getdata, tabledata = results
+ om = self.objectMap(getdata)
+ om.totalMemory= om.totalMemory * 1024
+ return om
+
@@ -0,0 +1,26 @@
+__doc__="""NetWareSwapInfo
+
+__version__ = '$Revision: 0.1'"""
+import re
+
+from Products.DataCollector.plugins.CollectorPlugin import SnmpPlugin, GetMap
+from Products.DataCollector.plugins.DataMaps import ObjectMap
+import Globals
+
+class NetWareSwapInfo(SnmpPlugin):
+
+ maptype = "NetwareSwapInfo"
+ compname = "os"
+ relname = "filesystems"
+ modname = "Products.ZenModel.FileSystem"
+
+ snmpGetMap = GetMap({
+ '.1.3.6.1.4.1.23.2.79.7.1.5.0': 'totalSwap',
+ })
+
+ def process(self, device, results, log):
+ log.info('processing %s for device %s', self.name(), device.id)
+ getdata, tabledata = results
+ om = self.objectMap(getdata)
+ om.totalSwap= om.totalSwap * 4
+ return om
@@ -0,0 +1 @@
+# __init__.py
Oops, something went wrong.

0 comments on commit a711abd

Please sign in to comment.