Novel Netware printer template.

Templates, scripts for templates, scripts and requests for templates.

Moderators: Moderators, Developers

Post Reply
Author
Message
royce
Cacti User
Posts: 79
Joined: Wed Dec 29, 2004 7:37 am
Location: Sweden

Novel Netware printer template.

#1 Post by royce » Fri Aug 05, 2005 3:47 am

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
Attachments
untitled.JPG
The output.
untitled.JPG (99.93 KiB) Viewed 10916 times
netware.rar
Templates and scripts.
(6.73 KiB) Downloaded 937 times

stuartl
Posts: 11
Joined: Thu Jul 07, 2005 2:44 pm

Thanks!

#2 Post by stuartl » Wed Aug 10, 2005 12:43 pm

Works great. I'll post an image after it has built some history.

:)

MU-IT
Cacti User
Posts: 113
Joined: Tue Nov 06, 2007 12:07 pm

#3 Post by MU-IT » Wed Jul 15, 2009 1:41 pm

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:

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


User avatar
BSOD2600
Cacti Moderator
Posts: 12160
Joined: Sat May 08, 2004 12:44 pm
Location: USA

#4 Post by BSOD2600 » Thu Jul 16, 2009 2:52 pm

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.

Post Reply