<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4826091299587678762</id><updated>2011-10-15T04:41:49.641-07:00</updated><category term='nagios'/><category term='ink'/><category term='toner'/><title type='text'>Check Toner</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://checktoner.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4826091299587678762/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://checktoner.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>lynx</name><uri>http://www.blogger.com/profile/01580958066249166438</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>3</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4826091299587678762.post-5209333511080918886</id><published>2009-01-28T09:49:00.000-08:00</published><updated>2009-01-28T09:57:07.173-08:00</updated><title type='text'>Update 0.4</title><content type='html'>I've updated the script.  This time I changed the SNMP version from 1 to 2c.  It appears some printer still want to use the first version&lt;br /&gt;&lt;br /&gt;http://www.nagiosexchange.org/cgi-bin/page.cgi?g=Detailed%2F2926.html;d=1&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4826091299587678762-5209333511080918886?l=checktoner.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://checktoner.blogspot.com/feeds/5209333511080918886/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://checktoner.blogspot.com/2009/01/update-04.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4826091299587678762/posts/default/5209333511080918886'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4826091299587678762/posts/default/5209333511080918886'/><link rel='alternate' type='text/html' href='http://checktoner.blogspot.com/2009/01/update-04.html' title='Update 0.4'/><author><name>lynx</name><uri>http://www.blogger.com/profile/01580958066249166438</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4826091299587678762.post-1092573683142817075</id><published>2009-01-26T16:23:00.000-08:00</published><updated>2009-01-26T16:27:28.583-08:00</updated><title type='text'>Update 0.3</title><content type='html'>&lt;p&gt;An update to the check_toner script:&lt;br /&gt;&lt;a href="http://www.nagiosexchange.org/cgi-bin/page.cgi?g=Detailed%2F2926.html;d=1"&gt;nagiosexchange.org&lt;/a&gt;.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;#!/bin/bash&lt;br /&gt;#&lt;br /&gt;#check_toner version 0.3&lt;br /&gt;#&lt;br /&gt;#01-26-2009, Henry Franco&lt;br /&gt;#&lt;br /&gt;# This plugin will check the black toner level on a printer via SNMP.&lt;br /&gt;# The plugin returns warning and critical status when the toner&lt;br /&gt;# drops below $CRIT AND $WARN.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;if [ $# -lt 1 ]; then&lt;br /&gt;        echo "Usage: ./check_toner PRINTER_NAME"&lt;br /&gt;        exit 127&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;HOST=$1&lt;br /&gt;INK="Black ink available:"&lt;br /&gt;CRIT=5&lt;br /&gt;WARN=10&lt;br /&gt;STATUS=0&lt;br /&gt;&lt;br /&gt;# GET THE MAXIMUN CAPACITY VALUE FROM SNMP&lt;br /&gt;max_level=`snmpwalk -O qv -v 2c -c public $HOST mib-2.43.11.1.1.8.1.1`&lt;br /&gt;RES=$?&lt;br /&gt;&lt;br /&gt;# GET CURRENT SUPPLY LEVEL FROM SNMP&lt;br /&gt;current_level=`snmpwalk -O qv -v 2c -c public $HOST mib-2.43.11.1.1.9.1.1`&lt;br /&gt;RES=$?&lt;br /&gt;&lt;br /&gt;#BAIL OUT IF ANYTHING WENT WRONG&lt;br /&gt;if [ $RES != 0 ]; then&lt;br /&gt;        INK="Toner Unknown - SNMP problem. No data received from host.";&lt;br /&gt;        echo $INK;&lt;br /&gt;        STATUS=3;&lt;br /&gt;        exit $STATUS;&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;#CALCULATE TONER LEVEL&lt;br /&gt;result=$(echo "scale=2; $current_level / $max_level;" | bc)&lt;br /&gt;&lt;br /&gt;#ACTUAL VALUE OF TONER SUPPLY&lt;br /&gt;percent=`echo "$result"*"100"/"1"|bc`&lt;br /&gt;&lt;br /&gt;#CHECK WARNING AND CRITICAL LEVELS&lt;br /&gt;        if [ $percent -le $CRIT ]; then&lt;br /&gt;                echo "Toner Critical - "$INK $percent"%";&lt;br /&gt;                STATUS=2&lt;br /&gt;        elif [ $percent -le $WARN ]; then&lt;br /&gt;                echo "Toner Warning - "$INK $percent"%";&lt;br /&gt;                STATUS=1&lt;br /&gt;        else&lt;br /&gt;                echo "Toner OK - "$INK $percent"%";&lt;br /&gt;        fi&lt;br /&gt;&lt;br /&gt;exit $STATUS&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4826091299587678762-1092573683142817075?l=checktoner.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://checktoner.blogspot.com/feeds/1092573683142817075/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://checktoner.blogspot.com/2009/01/update-03.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4826091299587678762/posts/default/1092573683142817075'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4826091299587678762/posts/default/1092573683142817075'/><link rel='alternate' type='text/html' href='http://checktoner.blogspot.com/2009/01/update-03.html' title='Update 0.3'/><author><name>lynx</name><uri>http://www.blogger.com/profile/01580958066249166438</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4826091299587678762.post-5518147734710627087</id><published>2009-01-26T12:10:00.000-08:00</published><updated>2009-01-26T12:43:38.220-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='toner'/><category scheme='http://www.blogger.com/atom/ns#' term='ink'/><category scheme='http://www.blogger.com/atom/ns#' term='nagios'/><title type='text'>Checking Toner with Nagios</title><content type='html'>&lt;p&gt;I wrote a very simple script for Nagios that will check the black toner level for any laser printer configured with SNMP &lt;a href="http://www.nagiosexchange.org/cgi-bin/page.cgi?g=Detailed%2F2926.html;d=1"&gt;nagiosexchange.org&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;#!/bin/bash&lt;br /&gt;#&lt;br /&gt;#01-26-2009, Henry Franco&lt;br /&gt;#&lt;br /&gt;# This plugin will check the black toner level on a printer via SNMP.&lt;br /&gt;# The plugin returns warning and critical status when the toner&lt;br /&gt;# drops below $CRIT AND $WARN.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;if [ $# -lt 1 ]; then&lt;br /&gt;      echo "Usage: ./check_toner PRINTER_NAME"&lt;br /&gt;      exit 127&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;HOST=$1&lt;br /&gt;INK="Black ink available:"&lt;br /&gt;NAGIOSPLUGSDIR=/usr/lib/nagios/plugins&lt;br /&gt;CRIT=5&lt;br /&gt;WARN=10&lt;br /&gt;STATUS=0&lt;br /&gt;&lt;br /&gt;# GET THE MAXIMUN CAPACITY VALUE FROM SNMP&lt;br /&gt;# YOU WILL GET THE SAME VALUE RUNNING snmpwalk -O n -v 2c -c public $HOST mib-2.43.11.1.1.8.1.1&lt;br /&gt;max_level=`$NAGIOSPLUGSDIR/check_snmp -H $HOST -C public -o mib-2.43.11.1.1.8.1.1`&lt;br /&gt;RES=$?&lt;br /&gt;&lt;br /&gt;# GET CURRENT SUPPLY LEVEL FROM SNMP&lt;br /&gt;# YOU WILL GET THE SAME VALUE RUNNING snmpwalk -O n -v 2c -c public $HOST mib-2.43.11.1.1.9.1.1&lt;br /&gt;current_level=`$NAGIOSPLUGSDIR/check_snmp -H $HOST -C public -o mib-2.43.11.1.1.9.1.1`&lt;br /&gt;RES=$?&lt;br /&gt;&lt;br /&gt;#BAIL OUT IF ANYTHING WENT WRONG&lt;br /&gt;if [ $RES != 0 ]; then&lt;br /&gt;      INK="Toner Unknown - SNMP problem. No data received from host.";&lt;br /&gt;      echo $INK;&lt;br /&gt;      STATUS=3;&lt;br /&gt;      exit $STATUS;&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;#EXTRACT VALUES FROM CHECK_SNMP COMMANDS&lt;br /&gt;new_max_level=`echo $max_level|cut -d ' ' -f4`&lt;br /&gt;new_current_level=`echo $current_level|cut -d ' ' -f4`&lt;br /&gt;result=$(echo "scale=2; $new_current_level / $new_max_level;" | bc)&lt;br /&gt;&lt;br /&gt;#ACTUAL VALUE OF TONER SUPPLY&lt;br /&gt;percent=`echo "$result"*"100"/"1"|bc`&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#CHECK WARNING AND CRITICAL LEVELS&lt;br /&gt;      if [ $percent -le $CRIT ]; then&lt;br /&gt;              echo "Toner Critical - "$INK $percent"%";&lt;br /&gt;              STATUS=2&lt;br /&gt;      elif [ $percent -le $WARN ]; then&lt;br /&gt;              echo "Toner Warning - "$INK $percent"%";&lt;br /&gt;              STATUS=1&lt;br /&gt;      else&lt;br /&gt;              echo "Toner OK - "$INK $percent"%";&lt;br /&gt;      fi&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;exit $STATUS&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4826091299587678762-5518147734710627087?l=checktoner.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://checktoner.blogspot.com/feeds/5518147734710627087/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://checktoner.blogspot.com/2009/01/checking-toner-with-nagios.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4826091299587678762/posts/default/5518147734710627087'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4826091299587678762/posts/default/5518147734710627087'/><link rel='alternate' type='text/html' href='http://checktoner.blogspot.com/2009/01/checking-toner-with-nagios.html' title='Checking Toner with Nagios'/><author><name>lynx</name><uri>http://www.blogger.com/profile/01580958066249166438</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry></feed>
