[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Using Xymon to monitor the ink and toner levels in printers
- To: hobbit (at) hswn.dk
- Subject: Using Xymon to monitor the ink and toner levels in printers
- From: kevin (at) shadowsoft.com (Kevin McAllister)
- Date: Thu, 11 Mar 2010 17:08:37 -0600
- User-agent: Thunderbird 2.0.0.23 (Windows/20090812)
Hello,
The scripts that I have for gathering this doesn't seem to be getting
any data at all. I am new to this any help would be appreciated. I am
running Centos 5.3 x86_64. I have put a copy of the scripts in the email.
#!/bin/sh
#ink
#
#BIG BROTHER - monitor HP printer ink levels
#
HOSTIP=$1; export HOSTIP
HOST=$2; export HOST
VHOST=$3; export VHOST
InkTmp=$BBTMP/ink.$$; export InkTmp
COLOR="blue"; export COLOR
echo $COLOR > ${InkTmp}-color
URL="http://${HOSTIP}/SSI/device_status_info.htm"
echo "URL: $URL" > ${InkTmp}-2
echo "" >> ${InkTmp}-2
/usr/bin/curl -w "$SS_LOGCURL" -m 120 -H "Host: $VHOST" -G $URL >
$InkTmp 2>> ${InkTmp}-2
#bit a monkeybusiness with COLOR here because the variable doesn't
propagate back from the sub-shells
if test $? -eq 0
then
echo "" >> ${InkTmp}-2
COLOR="green"; export COLOR
$GREP CARTRIDGE $InkTmp | $SED -r 's/<[^>]*>| //g' | $SED 's/
CARTRIDGE/ _CARTRIDGE: /' | tee -a ${InkTmp}-2 | $SED 's/%//' | while
read x
do
if test $COLOR != "red"
then
set $x
if test $2 -le 10
then
COLOR="yellow"
fi
fi
echo $COLOR > ${InkTmp}-color
done
fi
#
#THE FIRST LINE IS STATUS INFORMATION .....STRUCTURE IMPORTANT!
#THE REST IS FREE-FORM - WHATEVER YOU'D LIKE TO SEND ....
#
LINE="status ${HOST}.${TEST} `cat ${InkTmp}-color` `date`
<code>`cat ${InkTmp}-2`</code>"
$RM -f $InkTmp ${InkTmp}-2 ${InkTmp}-color
#NOW USE THE BB COMMAND TO SEND THE DATA ACROSS
$BB $BBDISP "$LINE" #SEND IT TO BBDISPLAY
++++++++++++++++++++++++++++++++++++++++++++++++++
#!/bin/sh
#toner
#
#BIG BROTHER - monitor HP printer ink levels
#
HOSTIP=$1; export HOSTIP
HOST=$2; export HOST
VHOST=$3; export VHOST
InkTmp=$BBTMP/toner.$$; export InkTmp
COLOR="blue"; export COLOR
echo $COLOR > ${InkTmp}-color
URL="http://${HOSTIP}/hp/device/this.LCDispatcher?nav=hp.DeviceStatus"
echo "URL: $URL" > ${InkTmp}-2
echo "" >> ${InkTmp}-2
/usr/bin/curl -w "$SS_LOGCURL" -m 120 -H "Host: $VHOST" -G $URL >
$InkTmp 2>> ${InkTmp}-2
#bit a monkeybusiness with COLOR here because the variable doesn't
propagate back from the sub-shells
if test $? -eq 0
then
echo "" >> ${InkTmp}-2
COLOR="green"; export COLOR
$GREP CARTRIDGE $InkTmp | $SED -r 's/<[^>]*>| //g' | $SED 's/
CARTRIDGE/ _CARTRIDGE: /' | tee -a ${InkTmp}-2 | $SED 's/%//' | while
read x
do
if test $COLOR != "red"
then
set $x
if test $2 -le 10
then
COLOR="yellow"
fi
fi
echo $COLOR > ${InkTmp}-color
done
fi
#
#THE FIRST LINE IS STATUS INFORMATION .....STRUCTURE IMPORTANT!
#THE REST IS FREE-FORM - WHATEVER YOU'D LIKE TO SEND ....
#
LINE="status ${HOST}.${TEST} `cat ${InkTmp}-color` `date` <code> `cat
${InkTmp}-2`</code>"
$RM -f $InkTmp ${InkTmp}-2 ${InkTmp}-color
#NOW USE THE BB COMMAND TO SEND THE DATA ACROSS
$BB $BBDISP "$LINE" #SEND IT TO BBDISPLAY