Novel Netware printer template.

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

Moderators: Developers, Moderators

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

Novel Netware printer template.

Post by royce »

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
The output.
The output.
untitled.JPG (99.93 KiB) Viewed 12969 times
netware.rar
Templates and scripts.
(6.73 KiB) Downloaded 1162 times
stuartl
Posts: 11
Joined: Thu Jul 07, 2005 2:44 pm

Thanks!

Post by stuartl »

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

Post by MU-IT »

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: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

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

Who is online

Users browsing this forum: No registered users and 1 guest