Hi.
I wrote this script 6 months ago and decided to post it here.
It's a kind of quick and dirty work, but it works.
This template is for counting netware printers connected to a netware server. It's been verified with v5, v6 and v6.5.
Import templates into cacti and put nw-print.sh in /scripts/ -directory.
Verify paths in nw-print.sh.
Export is from latest (0.8.6f) -release and should work in both windows and unix environment but Windows-users, it wont work until you change the pathes.
Thanks,
Christofer
Novel Netware printer template.
Moderators: Developers, Moderators
Novel Netware printer template.
- Attachments
-
- The output.
- untitled.JPG (99.93 KiB) Viewed 12970 times
-
- netware.rar
- Templates and scripts.
- (6.73 KiB) Downloaded 1162 times
Could someone re-write this to use perl or something a windows machine can run with out extensive hoop-jumping? Is there something other than cygwin that is worth looking into?
The script is as follows:
The script is as follows:
Code: Select all
#!/bin/sh
###################
# Christofer Algotsson
# q'n'd for counting netware printers
##################
# Variables
script=$0
host=$1
community=$2
all=$#
snmpversion=1
#oids
PRINTTOTALERRORSOID=".1.3.6.1.4.1.23.2.92.2.6.1.3"
ERRORLEVELS=".1.3.6.1.4.1.23.2.92.2.6.1.4"
PRINTTOTALWORKINGOID=".1.3.6.1.4.1.23.2.92.2.8.1.3"
REGISTEREDPRINTOID=".1.3.6.1.4.1.23.2.27.3.4.0"
snmpwalk=C:/net-snmp/bin/snmpwalk
snmpget=C:/net-snmp/bin/snmpget
awk=/usr/bin/awk
wc="/usr/bin/wc -l"
grep=/bin/grep
help ()
{
echo Usage:
echo $0 [host] [community]
echo
}
if [ "$all" != "2" ]; then
help
exit 1
fi
if [ ! "$host" ]; then
help
exit 1
fi
if [ ! "$community" ]; then
help
exit 1
fi
total=`$snmpwalk -v$snmpversion -c $community $host $PRINTTOTALERRORSOID | $grep "Error Printing" | $wc`
not_connected=`$snmpwalk -v$snmpversion -c $community $host $ERRORLEVELS | $grep -v "Ping" | $awk -F" " '/Printer Not Connected/ {print $1}' | $grep "Printer Not Connected" | $wc`
ioerrors=`$snmpwalk -v$snmpversion -c $community $host $ERRORLEVELS | $awk -F" " '/I\/O Error/ {print $1}'|grep "I/O Error" | $wc`
notpingable=`$snmpwalk -v$snmpversion -c $community $host $ERRORLEVELS | $grep "Ping" | $wc`
working=`$snmpwalk -v$snmpversion -c $community $host $PRINTTOTALWORKINGOID | $wc`
registered=`$snmpget -v$snmpversion -c $community $host $REGISTEREDPRINTOID | $awk '{print $4}'`
other_errs=`expr $total - $not_connected - $ioerrors - $notpingable`
all=`expr $total + $working`
echo total:$total notconnected:$not_connected ioerrors:$ioerrors notpingable:$notpingable other:$other_errs working:$working all:$all registered:$registered
Personally, I'd just re-write it to use the cacti php script server, since its just doing simple snmpgets and parsing of the data.
| Scripts: Monitor processes | RFC1213 MIB | DOCSIS Stats | Dell PowerEdge | Speedfan | APC UPS | DOCSIS CMTS | 3ware | Motorola Canopy |
| Guides: Windows Install | [HOWTO] Debug Windows NTFS permission problems |
| Tools: Windows All-in-one Installer |
Who is online
Users browsing this forum: No registered users and 0 guests