C309a

From timswiki
Jump to: navigation, search

HP C309a Printer Plugins

The following plugins report ink levels and pages printed statistics for HP C309 printers.

HP C309a Printer Ink Level Plugins

This plugin reports the remaining ink level on an HP C309a printer. The text listing below can be saved into a file named c309_ink_ and then a link can be created from its location into your munin plugins directory. The plugin link name must have the printer IP address or DNS name appended to the plugin name, as shown below.

 $ ln -s /path/to/c309_ink_ /etc/munin/plugins/c309_ink_192.168.1.7

or:

 $ ln -s /path/to/c309_ink_ /etc/munin/plugins/c309_ink_hp309


where 192.168.1.7 is your printer IP address, or else hp309 is your DNS name for your printer.


You may also need to promote the plugin to run as root if your net-tools snmpget binary is not available to normal users.

/etc/munin/plugin-conf.d/munin-node

[c309*]
user root



#!/bin/sh
#
# Plugin to measure remaining ink level on an HP C309 series device.
#
# Contributed by Tim Chappell
#
# Magic markers - optional - used by installation scripts and
# munin-config:
#
#%# family=manual
#%# capabilities=autoconf

IP=${0##*/c309_ink_}

if [ "$1" = "autoconf" ]; then
        echo yes
        exit 0
fi

if [ "$1" = "config" ]; then

        echo 'graph_category printing'
        echo 'graph_title Printer Ink Level'
        echo 'graph_args --upper-limit 100 -l 0 '
        echo 'graph_vlabel Remaining level (%)'
        echo 'black.label Black ink'
        echo 'black.draw LINE1'
        echo 'black.warning 20:'
        echo 'black.critical 10:'
        echo 'black.colour 000000'
        echo 'yellow.label Yellow ink'
        echo 'yellow.draw LINE1'
        echo 'yellow.warning 20:'
        echo 'yellow.critical 10:'
        echo 'yellow.colour ffff00'
        echo 'cyan.label Cyan ink'
        echo 'cyan.draw LINE1'
        echo 'cyan.warning 20:'
        echo 'cyan.critical 10:'
        echo 'cyan.colour 00ffff'
        echo 'magenta.label Magenta ink'
        echo 'magenta.draw LINE1'
        echo 'magenta.warning 20:'
        echo 'magenta.critical 10:'
        echo 'magenta.colour ff00ff'
        echo 'lightblack.label Photoblack ink'
        echo 'lightblack.draw LINE1'
        echo 'lightblack.warning 20:'
        echo 'lightblack.critical 10:'
        echo 'lightblack.colour 808080'
        exit 0
fi

/usr/bin/snmpget -c public -v 1 $IP SNMPv2-SMI::mib-2.43.11.1.1.9.1.1  | awk '{printf "black.value %s\n",$NF}'
/usr/bin/snmpget -c public -v 1 $IP SNMPv2-SMI::mib-2.43.11.1.1.9.1.2  | awk '{printf "yellow.value %s\n",$NF}'
/usr/bin/snmpget -c public -v 1 $IP SNMPv2-SMI::mib-2.43.11.1.1.9.1.3  | awk '{printf "cyan.value %s\n",$NF}'
/usr/bin/snmpget -c public -v 1 $IP SNMPv2-SMI::mib-2.43.11.1.1.9.1.4  | awk '{printf "magenta.value %s\n",$NF}'
/usr/bin/snmpget -c public -v 1 $IP SNMPv2-SMI::mib-2.43.11.1.1.9.1.5  | awk '{printf "lightblack.value %s\n",$NF}'


HP C309a Pages Processed Plugins

This plugin reports statistics relating to the number of pages processed on an HP C309a printer. The text listing below can be saved into a file named c309_pages_ and then a link can be created from its location into your munin plugins directory. The plugin link name must have the printer IP address or DNS name appended to the plugin name, as shown below.

 $ ln -s /path/to/c309_pages_ /etc/munin/plugins/c309_pages_192.168.1.7

or:

 $ ln -s /path/to/c309_pages_ /etc/munin/plugins/c309_pages_hp309


where 192.168.1.7 is your printer IP address, or else hp309 is your DNS name for your printer.


You may also need to promote the plugin to run as root if your net-tools snmpget binary is not available to normal users.

/etc/munin/plugin-conf.d/munin-node

[c309*]
user root


#!/bin/sh
#
# Plugin to report printer page count.
#
# Contributed by Tim Chappell
#
# Magic markers - optional - used by installation scripts and
# munin-config:
#
#%# family=manual
#%# capabilities=autoconf

IP=${0##*/c309_pages_}

if [ "$1" = "autoconf" ]; then
        echo yes
        exit 0
fi

if [ "$1" = "config" ]; then

        echo 'graph_category printing'
        echo 'graph_title Printer Page Count'
        # echo 'graph_args --base 1000 -l 0 '
        echo 'graph_args --base 1000'
        echo 'graph_vlabel Pages (number)'
        echo 'pages.label Pages'
        echo 'pages.draw LINE1'
        exit 0
fi

/usr/bin/snmpget -c public -v 1 $IP SNMPv2-SMI::mib-2.43.10.2.1.4.1.1 | awk '{printf "pages.value %s\n",$NF}'


This website publishes a Privacy Policy. Continued use of this website implies your consent to the use of data outlined in the policy.