HP Color LaserJet 2600N - Toner percent / Left|Printed pages
Moderators: Developers, Moderators
HP Color LaserJet 2600N - Toner percent / Left|Printed pages
Hi Guys,
this script is a workaround to get the following values over HTML Code from Webpanel which are not inside of SNMP MIB:
- Toner Catridge left
- Estimated Pages Remaining
- Pages printed with this supply
The script get the webpage with wget and grep´ to requested values.
You have to change the language on top of script.
Requirements: Linux, wget, cat, grep, php (command line)
Command: ./get_data.php
Output: rest_toner_black:99 rest_toner_magenta:99 rest_toner_cyan:99 rest_toner_yellow:99 left_pages_black:2483 left_pages_magenta:1989 left_pages_cyan:1989 left_pages_yellow:1989 printed_pages_black:17 printed_pages_magenta:11 printed_pages_cyan:11 printed_pages_yellow:11
You have to create a new "Data Input Method"
Name: "HP Color LaserJet 2600n"
Input Type: "Script/Command"
Input String: "/path/to/get_data.php"
with following output fields:
rest_toner_black
rest_toner_magenta
rest_toner_cyan
rest_toner_yellow
left_pages_black
left_pages_magenta
left_pages_cyan
left_pages_yellow
printed_pages_black
printed_pages_magenta
printed_pages_cyan
printed_pages_yellow
It's not comfortable and not beautiful but it's a good workaround
regards
this script is a workaround to get the following values over HTML Code from Webpanel which are not inside of SNMP MIB:
- Toner Catridge left
- Estimated Pages Remaining
- Pages printed with this supply
The script get the webpage with wget and grep´ to requested values.
You have to change the language on top of script.
Requirements: Linux, wget, cat, grep, php (command line)
Command: ./get_data.php
Output: rest_toner_black:99 rest_toner_magenta:99 rest_toner_cyan:99 rest_toner_yellow:99 left_pages_black:2483 left_pages_magenta:1989 left_pages_cyan:1989 left_pages_yellow:1989 printed_pages_black:17 printed_pages_magenta:11 printed_pages_cyan:11 printed_pages_yellow:11
You have to create a new "Data Input Method"
Name: "HP Color LaserJet 2600n"
Input Type: "Script/Command"
Input String: "/path/to/get_data.php"
with following output fields:
rest_toner_black
rest_toner_magenta
rest_toner_cyan
rest_toner_yellow
left_pages_black
left_pages_magenta
left_pages_cyan
left_pages_yellow
printed_pages_black
printed_pages_magenta
printed_pages_cyan
printed_pages_yellow
It's not comfortable and not beautiful but it's a good workaround
regards
- Attachments
-
- get_data.php.txt
- PHP Script
- (2.89 KiB) Downloaded 1542 times
Last edited by tkempken on Wed Nov 07, 2007 4:58 pm, edited 1 time in total.
Additional Config for German Interface
Additional Config for German Interface
and a screenshot
and a screenshot
- Attachments
-
- Screenshot of usage
- sample_graphs.jpg (125.13 KiB) Viewed 23888 times
-
- Additional Config for German Interface.txt
- Additional Config for German Interface
- (469 Bytes) Downloaded 771 times
Try this script with: ./script.php my_ip_addrjweinraub wrote:I suspect you are from Germany?
Well... my first try failed because I never bothered to read the instructions. I did ./script.php my_ip_addr
As for my second try, ... nicht schlecht!
[jweinraub@intranet ~]$ ./get_data.php
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/pgsql.so' - /usr/lib/php/modules/pgsql.so: cannot open shared object file: No such file or directory in Unknown on line 0
rest_toner_black:59 rest_toner_magenta:43 rest_toner_cyan:43 rest_toner_yellow:43 left_pages_black:2518 left_pages_magenta:1324 left_pages_cyan:1324 left_pages_yellow:1324 printed_pages_black:1750 printed_pages_magenta:1756 printed_pages_cyan:1756 printed_pages_yellow:1756
I don't know why I get this warning. I don't know if this is due to your script or my PHP configuration since I recently upgraded to PHP5, compiled from source since RHEL 4 does not support PHP5 just yet .
I have several of these printers. So I wonder if it is possible to make this work with them all. Do I need to use a variable for $ip?
Or do i need several instances when I graph these. Another thing I use here is nagios. I wonder if it is easy to make this into a nagios plugin so i can get warnings when the ink is low.
Thanks! Danke schön!
This script download a temporary webpage with name status_192.168.1.2.htm for each printer...
So we won't get in any problems regarding "parallel polling"...
My concept was only for my single printer at home
After running it also remove the temp page...
I hope u understand my thoughts...
@PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/pgsql.so'
I think you have define some libs of postgresql inside of /etc/php.ini or so
If you don't need it you also can remove package php-pgsql
Otherwise add
Code: Select all
error_reporting(0);
Code: Select all
#/usr/bin/php -q
<?php
regards
- Attachments
-
- get_data_with_ip_as_parameter.php.txt
- (3.3 KiB) Downloaded 864 times
I think it depends what you want to do...
If you have got more printers I would suggest to create a data and graph template.
For my single printer it would be a kind of 'oversized'...
I written down my steps and create a smart word document...
It was fast and not the best english but i hope you understand it...
If you have got more printers I would suggest to create a data and graph template.
For my single printer it would be a kind of 'oversized'...
I written down my steps and create a smart word document...
It was fast and not the best english but i hope you understand it...
- Attachments
-
- cacti.doc
- (401 KiB) Downloaded 786 times
script for nagios
I think you can implement it like this:
Copy it to your directory where check_plugins are located...
define command{
command_name check_hpcl2600n
command_line $USER1$/check_hpcl2600n.php $ARG1$ $ARG2$ $ARG3$
}
arg1 = ip
arg2 = warn level (percent)
arg3 = crit level (percent)
TONER WARNING B:99 M:99 C:99 Y:99
TONER CRITICAL B:99 M:99 C:99 Y:99
maybe it works for you
I think you can implement it like this:
Copy it to your directory where check_plugins are located...
define command{
command_name check_hpcl2600n
command_line $USER1$/check_hpcl2600n.php $ARG1$ $ARG2$ $ARG3$
}
arg1 = ip
arg2 = warn level (percent)
arg3 = crit level (percent)
Code: Select all
./get_data.nagios.php 192.168.2.100 80 43
TONER OK B:99 M:99 C:99 Y:99
TONER CRITICAL B:99 M:99 C:99 Y:99
maybe it works for you
- Attachments
-
- check_hpcl2600n.php.txt
- Same Script but for Nagios :)
- (1.93 KiB) Downloaded 826 times
reinstalling pgsql fixed that problem!
[root@intranet libexec]# ./check_hpcl2600n.php 10.1.3.6 80 43
TONER WARNING B:54 M:43 C:43 Y:43
as for the warning/critical, shouldn't it be the other way around?
100% is when it is full, so
[root@intranet libexec]# ./check_hpcl2600n.php 10.1.3.6 40 20
I think might be more appropriate in my case, but thanks for the advice!
[root@intranet libexec]# ./check_hpcl2600n.php 10.1.3.6 80 43
TONER WARNING B:54 M:43 C:43 Y:43
as for the warning/critical, shouldn't it be the other way around?
100% is when it is full, so
[root@intranet libexec]# ./check_hpcl2600n.php 10.1.3.6 40 20
I think might be more appropriate in my case, but thanks for the advice!
it shows percentage remaining. so if it is less than 40% remaining it is a warning, meaning i will check inventory to be sure i have toner in stock.
if it is 20% it is time to examine for print quality and be prepared to replace the toner.
80% remaining is still brand new to me, so it will flag error too soon.
if it is 20% it is time to examine for print quality and be prepared to replace the toner.
80% remaining is still brand new to me, so it will flag error too soon.
i have not tried. i been very busy today actually. though the fact nagios should be running smoothly now so that is main concern.
cacti i use to gather statistics on toner use, mainly to determine or justify the need for a more expensive printer.
As you can see here, I go through a lot of ink on this one particular printer.
i will get back to you monday when i finish cacti (and rest of nagios for the remaining printers).
thanks!
cacti i use to gather statistics on toner use, mainly to determine or justify the need for a more expensive printer.
As you can see here, I go through a lot of ink on this one particular printer.
i will get back to you monday when i finish cacti (and rest of nagios for the remaining printers).
thanks!
- Attachments
-
- eng-printer.png (24.42 KiB) Viewed 23749 times
hmm
this is odd on nagios page:
TONER CRITICAL B: M: C: Y:
---
[root@intranet libexec]# ./check_hp2600n.php 10.1.3.6 40 20
TONER OK B:54 M:43 C:43 Y:43
--
--
--
--
this is odd on nagios page:
TONER CRITICAL B: M: C: Y:
---
[root@intranet libexec]# ./check_hp2600n.php 10.1.3.6 40 20
TONER OK B:54 M:43 C:43 Y:43
--
Code: Select all
# check_hp2600n
define command{
command_name check_hp2600n
command_line $USER1$/check_hp2600n.php $HOSTADDRESS$ 40 20
}
Code: Select all
# Service definition
define service{
use generic-service ; Name of service template to use
host_name BoardProdColor
service_description Toner Status
is_volatile 0
check_period workhours
max_check_attempts 4
normal_check_interval 5
retry_check_interval 1
contact_groups printer-admins
notification_interval 960
notification_period workhours
notification_options c,r
check_command check_hp2600n
}
--
Code: Select all
# 'Board Production Colour LaserJet' host definition
define host{
use generic-host ; Name of host template to use
host_name BoardProdColor
alias HP Color LaserJet 2600n
address 10.1.3.6
check_command check-host-alive
max_check_attempts 10
check_period 24x7
notification_interval 480
notification_period 24x7
contact_groups printer-admins
}
Who is online
Users browsing this forum: No registered users and 1 guest