1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-09-18 16:48:44 +00:00

Do some more housecleaning.

This commit is contained in:
Diego Elio Pettenò 2012-08-06 21:38:45 -07:00
parent 5d5bf6e4e5
commit e0f0fb8659
5 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,107 @@
#!/bin/bash
#
#This plugin assumes that the printer returns remaining ink level in percent.
#
#To configure this plugin, create a symlink in the /etc/munin/plugins directory to the code with the printer's location after the underscore.
#For example, if the printer is at 192.168.0.241, the link should read printerink_192.168.0.241
#
#If you are interested in printers that return units other than percent,
#the following can be used to get the units used in the SNMP replies.
#units=($(snmpwalk -Ov -Oq -c $community -v $version $printerlocation 1.3.6.1.2.1.43.11.1.1.7))
#
#For interpretation of the numeric value returned, the following are the standard codes:
#realunitvalues=( [1]="other" [2]="unknown" [3]="inches/10,000" [4]="microns" [7]="impressions" [8]="sheets" [11]="hours" [12]="ounces/1,000" [13]="g/10" [14]="fluid ounces/100" [15]="ml/10" [16]="feet" [17]="meters" [18]="items" [19]="percent" )
#
#Note that HP L7555 returns 15 for units but shows remaining ink in percent
#
#Requires package snmp
#
# Copyright 2011 Rory Jaffe <rsjaffe@gmail.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#%# family=contrib
#%# capabilities=
#
printerlocation=${0##*printerink_}
#Set variable if not set in environment.
: ${community:=public}
: ${version:=1}
#Check for command line arguments.
#
#While this program includes snmp autoconfig code, I have been having trouble getting it to properly identify
#the printer, so the "magic markers" are not included for autoconf. If you are able to make this work, please
#contact me and I will update this.
#
case $1 in
snmpconf) #autoconfigure for snmp
echo 'require 1.3.6.1.2.1.43.11.1.1.6.1.1'
echo 'require 1.3.6.1.2.1.43.11.1.1.9.1.1 \d'
exit 0;;
config )
#abort if location not included in link
if [ "" = "$printerlocation" ]
then
echo "Error: symlink with printer location needed for use (e.g., printerink_192.168.0.52)" >&2
exit 1
fi
IFS='
'
labels=($(snmpwalk -Ov -Oq -c $community -v $version $printerlocation 1.3.6.1.2.1.43.11.1.1.6 | tr -d '"'))
for (( i = 0 ; i < ${#labels[@]} ; i++ ))
do
echo color$i.label ${labels[$i]}
case ${labels[$i]} in # try to get line color to match ink color note that colour is rrggbb from http://www.procato.com/rgb+index/
black*) echo color$i.colour 000000;;
blue*) echo color$i.colour 0000FF;;
cyan*) echo color$i.colour 00FFFF;;
green*) echo color$i.colour 00FF00;;
light\ black*) echo color$i.colour 555555;;
light\ blue*) echo color$i.colour 8A8AE7;;
light\ cyan*) echo color$i.colour 8AE7E7;;
light\ green*) echo color$i.colour 8AE78A;;
light\ magenta*) echo color$i.colour E78AE7;;
light\ orange*) echo color$i.colour E7B98A;;
light\ red*) echo color$i.colour E78A8A;;
light\ yellow*) echo color$i.colour E7E78A;;
magenta*) echo color$i.colour FF00FF;;
orange*) echo color$i.colour FFA500;;
red*) echo color$i.colour FF0000;;
yellow*) echo color$i.colour FFFF00;;
esac
done
#uncomment this to show printer as separate 'location' in munin report, and add to munin.conf the host with the ip address of the node that is running this plugin (e.g., 127.0.0.1)
# echo host_name printer
echo graph_vlabel Percent
echo graph_category print
echo graph_args --base 1000 -l 0 -u 100 -r
echo graph_scale no
echo graph_title Printer Ink Levels $(snmpget -Ov -Oq -c $community -v $version $printerlocation 1.3.6.1.2.1.1.5.0 | tr -d '"')
exit 0;;
esac
#do the real work--find the levels and print them out
#abort if location not included in link
if [ "" = "$printerlocation" ]
then
echo "Error: symlink with printer location needed for use (e.g., printerink_192.168.0.52)" >&2
exit 1
fi
levels=($(snmpwalk -Ov -Oq -c $community -v $version $printerlocation 1.3.6.1.2.1.43.11.1.1.9))
for (( i = 0 ; i < ${#levels[@]} ; i++ ))
do
echo color$i.value ${levels[$i]}
done

62
plugins/printer/xerox-wc3220 Executable file
View file

@ -0,0 +1,62 @@
#!/bin/sh
PRINTER_IP=${host:-"10.10.10.10"}
TMP_DIR=${tmp:-"/tmp"}
: << =cut
=head1 NAME
Xerox-WC3220 - Plugin to monitor consumables level and status on Xerox WorkCentre 3220
=head1 CONFIGURATION
PRINTER_IP
=head1 AUTHOR
Oleksiy Kochkin
=head1 LICENSE
As is.
=back
=head1 MAGIC MARKERS
#%# family=contrib
#%# capabilities=autoconf
=cut
case $1 in
config)
echo "graph_title Consumables level @ $PRINTER_IP"
echo 'graph_vlabel %'
echo 'graph_category printers'
echo 'graph_scale no'
echo 'black.label Black toner level'
echo 'black.draw LINE2'
echo 'black.type GAUGE'
echo 'black.colour 000000'
echo 'black.warning 5:'
echo 'black.critical 1:'
echo 'black.min 0'
echo 'black.max 100'
exit 0;;
esac
wget -q -o /dev/null -O $TMP_DIR/$PRINTER_IP-Supplies.html http://$PRINTER_IP/status/Supplies.html
TONER_STR=$(grep "<td width=5%>" "$TMP_DIR/$PRINTER_IP-Supplies.html")
#<td width=5%>99%</td>
echo -n "black.value "
echo $TONER_STR | egrep -o "5%>[0-9]{1,2}" | egrep -o "[0-9]{1,2}$"
rm $TMP_DIR/$PRINTER_IP-Supplies.html

View file

@ -0,0 +1,109 @@
#!/bin/sh
PRINTER_IP=${host:-"10.10.10.10"}
TMP_DIR=${tmp:-"/tmp"}
: << =cut
=head1 NAME
Xerox-WC7232-consumables - Plugin to monitor consumables level and status on Xerox WorkCentre 7232
=head1 CONFIGURATION
PRINTER_IP
=head1 AUTHOR
Oleksiy Kochkin
=head1 LICENSE
As is.
=back
=head1 MAGIC MARKERS
#%# family=contrib
#%# capabilities=autoconf
=cut
case $1 in
config)
echo "graph_title Consumables level @ $PRINTER_IP"
echo 'graph_vlabel %'
echo 'graph_category printers'
echo 'graph_scale no'
echo 'cyan.label Cyan toner level'
echo 'cyan.draw LINE2'
echo 'cyan.type GAUGE'
echo 'cyan.colour 1921B1'
echo 'cyan.warning 5:'
echo 'cyan.critical 1:'
echo 'cyan.min 0'
echo 'cyan.max 100'
echo 'magenta.label Magenta toner level'
echo 'magenta.draw LINE2'
echo 'magenta.type GAUGE'
echo 'magenta.colour C00086'
echo 'magenta.warning 5:'
echo 'magenta.critical 1:'
echo 'magenta.min 0'
echo 'magenta.max 100'
echo 'yellow.label Yellow toner level'
echo 'yellow.draw LINE2'
echo 'yellow.type GAUGE'
echo 'yellow.colour FECD00'
echo 'yellow.warning 5:'
echo 'yellow.critical 1:'
echo 'yellow.min 0'
echo 'yellow.max 100'
echo 'black.label Black toner level'
echo 'black.draw LINE2'
echo 'black.type GAUGE'
echo 'black.colour 000000'
echo 'black.warning 5:'
echo 'black.critical 1:'
echo 'black.min 0'
echo 'black.max 100'
echo 'drum.label Drum unit resource left'
echo 'drum.draw LINE2'
echo 'drum.type GAUGE'
echo 'drum.colour 00C12B'
echo 'drum.warning 5:'
echo 'drum.critical 1:'
echo 'drum.min 0'
echo 'drum.max 100'
exit 0;;
esac
wget -q -o /dev/null -O $TMP_DIR/$PRINTER_IP-stsply.htm http://$PRINTER_IP/stsply.htm
#toner and drum cartriges have both status and percentage
TONER_STR=$(grep Toner "$TMP_DIR/$PRINTER_IP-stsply.htm")
#info=info.concat([['Toner Cartridges',[['Cyan Toner [C]',0,77],['Magenta Toner [M]',7,1],['Yellow Toner [Y]',7,1],['Black Toner [K]',0,39]],3]]);
DRUM_STR=$(grep Drum "$TMP_DIR/$PRINTER_IP-stsply.htm")
#info=info.concat([['Drum Cartridges',[['Drum Cartridges',0,79]],1]]);
echo -n "cyan.value "
echo $TONER_STR | egrep -o "C]',[0-9],[0-9]{1,2}" | egrep -o "[0-9]{1,2}$"
echo -n "magenta.value "
echo $TONER_STR | egrep -o "M]',[0-9],[0-9]{1,2}" | egrep -o "[0-9]{1,2}$"
echo -n "yellow.value "
echo $TONER_STR | egrep -o "Y]',[0-9],[0-9]{1,2}" | egrep -o "[0-9]{1,2}$"
echo -n "black.value "
echo $TONER_STR | egrep -o "K]',[0-9],[0-9]{1,2}" | egrep -o "[0-9]{1,2}$"
echo -n "drum.value "
echo $DRUM_STR | egrep -o "s',[0-9],[0-9]{1,2}" | egrep -o "[0-9]{1,2}$"
rm $TMP_DIR/$PRINTER_IP-stsply.htm