librenms / librenms

Community-based GPL-licensed network monitoring system
https://www.librenms.org
Other
3.96k stars 2.32k forks source link

Printer toner/cartdriges level graphics and alerts #2802

Closed cusco closed 8 years ago

cusco commented 8 years ago

Hi,

In observium one used to be able to see the toner levels on most printers, and in librenms i haven't found this to be available.

Could you guys code the toner levels into librenms ?

Thank you

Rosiak commented 8 years ago

Hi @cusco,

First of all, welcome aboard. Second, what devices are we talking about? Are they recognised?

breeman1 commented 8 years ago

Hi,

I'm sorry if I am hijacking someone elses issue however we have the same issue with our printers; well at least two that we have added so far, the HP laserjet 700 color MFP and the HP laserjet 5550. The toner levels are not being graphed, see screenshots attached.

image

image

cusco commented 8 years ago

Hi @Rosiak

Thank you,

Devices are recognized as they show in menu devices -> all devices -> printers

we have brother, HP, OKI..

and the issue is as such as @breeman1 's

cusco commented 8 years ago

also here is a log:

librenms@monitor:~$ ./poller.php -h printer-oki-pcmlx.host.com  -d -r -m toner
LibreNMS 2015.master Poller
Version info:
Commit SHA: 7c39cba5698d32fb2376f362f9fabbe15dc4be7c
DB Schema: 90
PHP: 5.6.14-0+deb8u1
MySQL: 5.5.46-0+deb8u1
RRDTool: 1.4.8
SNMP: NET-SNMP version: 5.7.2.1

DEBUG!
Starting polling run:

SQL[SELECT `device_id` FROM `devices` WHERE `disabled` = 0 AND `hostname` LIKE 'printer-oki-pcmlx.host.com' ORDER BY `device_id` ASC]
SQL[SELECT * FROM `devices` WHERE `device_id` = '74']
SQL[SELECT * FROM devices_attribs WHERE `device_id` = '74'] printer-oki-pcmlx.host.com 74 okilan (printer)

SQL[INSERT INTO `device_perf` (`xmt`,`rcv`,`loss`,`min`,`max`,`avg`,`device_id`,`timestamp`)  VALUES ('3','3','0','22.1','23.2','22.6','74',NOW())] DEBUG: SNMP Auth options =  -v1 -c public
/usr/bin/snmpget -v1 -c public -Oqv -m SNMPv2-MIB -M /opt/librenms/mibs udp:printer-oki-pcmlx.host.com:161 sysObjectID.0
SNMPv2-SMI::enterprises.2001.1.1.1.1

DEBUG: SNMP Auth options =  -v1 -c public
/usr/bin/snmpget -v1 -c public -OQnUs -m SNMPv2-MIB:HOST-RESOURCES-MIB:SNMP-FRAMEWORK-MIB -M /opt/librenms/mibs udp:printer-oki-pcmlx.host.com:161 sysUpTime.0 sysLocation.0 sysContact.0 sysName.0 sysDescr.0 sysObjectID.0
sysUpTime.0 = 6:16:58:15.20
sysLocation.0 = Lisboa, Portugal
sysContact.0 = ITS
sysName.0 = OKI-MC342-E63757
sysDescr.0 = OKI OkiLAN 8500e Rev.01.23 10/100BASE Ethernet PrintServer: Attached to MC342 Rev.02.70 : Copyright (c)2011 Oki Data Corporation. All rights reserved.
sysObjectID.0 = enterprises.2001.1.1.1.1

DEBUG: SNMP Auth options =  -v1 -c public
/usr/bin/snmpget -v1 -c public -OQnUs -m HOST-RESOURCES-MIB:SNMP-FRAMEWORK-MIB -M /opt/librenms/mibs udp:printer-oki-pcmlx.host.com:161 snmpEngineTime.0 hrSystemUptime.0
Error in packet
Reason: (genError) A general failure occured
Failed object: snmpEngineTime.0

Error in packet
Reason: (noSuchName) There is no such variable name in this MIB.
Failed object: hrSystemUptime.0

Using SNMP Agent Uptime (6:16:58:15.20)
[RRD Disabled]RRD[update /opt/librenms/rrd/printer-oki-pcmlx.host.com/uptime.rrd N:579495] Uptime: 6 days, 16h 58m 15s
[RRD Disabled]RRD[update /opt/librenms/rrd/printer-oki-pcmlx.host.com/poller-perf.rrd N:0.552] [RRD Disabled]RRD[update /opt/librenms/rrd/printer-oki-pcmlx.host.com/ping-perf.rrd N:22.6] [RRD Disabled]RRD[update /opt/librenms/rrd/printer-oki-pcmlx.host.com/ping-perf.rrd N:22.6] Polled in 0.552 seconds
Updating printer-oki-pcmlx.host.com
Array
(
    [uptime] => 579495
    [last_ping] => Array
        (
            [0] => NOW()
        )

    [last_ping_timetaken] => 22.6
    [last_polled] => Array
        (
            [0] => NOW()
        )

    [last_polled_timetaken] => 0.552
)

SQL[UPDATE `devices` set `uptime` ='579495',`last_ping` =NOW(),`last_ping_timetaken` ='22.6',`last_polled` =NOW(),`last_polled_timetaken` ='0.552' WHERE `device_id` = '74'] UPDATED!

SQL[SELECT * FROM device_groups ORDER BY name]
SQL[SELECT DISTINCT(devices.device_id) FROM devices WHERE device_id='74' && (devices.notes REGEXP "pcmEmpresas" ) LIMIT 1]
SQL[SELECT alert_schedule.schedule_id FROM alert_schedule LEFT JOIN alert_schedule_items ON alert_schedule.schedule_id=alert_schedule_items.schedule_id WHERE ( alert_schedule_items.target = '74' ) && NOW() BETWEEN alert_schedule.start AND alert_schedule.end LIMIT 1]
SQL[SELECT * FROM device_groups ORDER BY name]
SQL[SELECT DISTINCT(devices.device_id) FROM devices WHERE device_id='74' && (devices.notes REGEXP "pcmEmpresas" ) LIMIT 1]
SQL[SELECT alert_rules.* FROM alert_rules LEFT JOIN alert_map ON alert_rules.id=alert_map.rule WHERE alert_rules.disabled = 0 && ( (alert_rules.device_id = -1 || alert_rules.device_id = '74' ) || alert_map.target = '74'  )]  #3:
SQL[SELECT state FROM alerts WHERE rule_id = '3' && device_id = '74' ORDER BY id DESC LIMIT 1]
SQL[SELECT 1 FROM information_schema.COLUMNS WHERE TABLE_NAME = 'ports' && COLUMN_NAME = 'device_id']
SQL[SELECT * FROM ports WHERE (ports.device_id = '74') && (ports.ifDuplex != "fullDuplex"    &&  ports.ifType = "ethernetCsmacd"  &&  ports.ifSpeed > "1"    &&   (  ( ports.ifOperStatus = "up"  &&  ports.ifAdminStatus = "up"  &&   (  ( ports.deleted = 0  &&  ports.ignore = 0  &&  ports.disabled = 0 )  )  )  )  = "1" )]  NOCHG  #5:
SQL[SELECT state FROM alerts WHERE rule_id = '5' && device_id = '74' ORDER BY id DESC LIMIT 1]
SQL[SELECT 1 FROM information_schema.COLUMNS WHERE TABLE_NAME = 'processors' && COLUMN_NAME = 'device_id']
SQL[SELECT * FROM processors WHERE (processors.device_id = '74') && (processors.processor_usage >= "90"         )]  NOCHG

SQL[INSERT INTO `perf_times` (`type`,`doing`,`start`,`duration`,`devices`,`poller`)  VALUES ('poll','printer-oki-pcmlx.host.com','1453211706.1985','0.589','1','monitor\n')] ./poller.php printer-oki-pcmlx.host.com 2016-01-19 14:55:06 - 1 devices polled in 0.589 secs

MySQL: Cell[3/0s] Row[10/0.01s] Rows[3/0s] Column[0/0s] Update[1/0s] Insert[2/0s] Delete[0/0s]
laf commented 8 years ago

Do you have $config['enable_printers'] = true; in config.php?

breeman1 commented 8 years ago

Ah, that did it for me. Thanks Laf.

image

laf commented 8 years ago

Once @cusco confirms then we can close this :)

cusco commented 8 years ago

Yep that works, My bad for missing the configuration parameter.

Thank you!