Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Wed Jun 26, 2019 5:37 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Novel Netware printer template.
PostPosted: Fri Aug 05, 2005 3:47 am 
Offline
Cacti User

Joined: Wed Dec 29, 2004 7:37 am
Posts: 79
Location: Sweden
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:
File comment: Templates and scripts.
netware.rar [6.73 KiB]
Downloaded 931 times
File comment: The output.
untitled.JPG
untitled.JPG [ 99.93 KiB | Viewed 10711 times ]
Top
 Profile  
 
 Post subject: Thanks!
PostPosted: Wed Aug 10, 2005 12:43 pm 
Offline

Joined: Thu Jul 07, 2005 2:44 pm
Posts: 11
Works great. I'll post an image after it has built some history.

:)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 15, 2009 1:41 pm 
Offline
Cacti User

Joined: Tue Nov 06, 2007 12:07 pm
Posts: 113
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



Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 16, 2009 2:52 pm 
Offline
Cacti Moderator
User avatar

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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group