Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


Novel Netware printer template.

 
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates
Author Message
royce
Cacti User


Joined: 29 Dec 2004
Posts: 79
Location: Sweden

PostPosted: Fri Aug 05, 2005 3:47 am    Post subject: Novel Netware printer template. Reply with quote

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



untitled.JPG
 Description:
The output.
 Filesize:  99.93 KB
 Viewed:  5174 Time(s)

untitled.JPG



netware.rar
 Description:
Templates and scripts.

Download
 Filename:  netware.rar
 Filesize:  6.73 KB
 Downloaded:  436 Time(s)

Back to top
stuartl



Joined: 07 Jul 2005
Posts: 11

PostPosted: Wed Aug 10, 2005 12:43 pm    Post subject: Thanks! Reply with quote

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

Back to top
MU-IT
Cacti User


Joined: 06 Nov 2007
Posts: 87

PostPosted: Wed Jul 15, 2009 1:41 pm    Post subject: Reply with quote

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:


#!/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

Back to top
BSOD2600
Cacti Moderator


Joined: 08 May 2004
Posts: 8829
Location: WA, USA

PostPosted: Thu Jul 16, 2009 2:52 pm    Post subject: Reply with quote

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.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group