mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
log toner replacement
git-svn-id: http://www.observium.org/svn/observer/trunk@2122 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -9,6 +9,8 @@ if ($config['enable_printers'])
|
||||
{
|
||||
echo("Checking toner " . $toner['toner_descr'] . "... ");
|
||||
|
||||
# FIXME poll capacity maybe also here, when toner is replaced capacity can change, leading to "154% of toner"
|
||||
|
||||
$tonerperc = snmp_get($device, $toner['toner_oid'], "-OUqnv") / $toner['toner_capacity'] * 100;
|
||||
|
||||
$tonerrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("toner-" . $toner['toner_descr'] . ".rrd");
|
||||
@@ -27,9 +29,15 @@ if ($config['enable_printers'])
|
||||
|
||||
rrdtool_update($tonerrrd,"N:$tonerperc");
|
||||
|
||||
#FIXME could report for toner out... :)
|
||||
#FIXME should report for toner out... :)
|
||||
|
||||
mysql_query("UPDATE toner SET toner_current = '$tonerperc' WHERE toner_id = '" . $toner['toner_id'] . "'");
|
||||
# Log toner swap
|
||||
if ($tonerperc > $toner['toner_current'])
|
||||
{
|
||||
log_event('Toner ' . $toner['toner_descr'] . ' was replaced (new level: ' . $tonerperc . '%)', $device, 'toner', $toner['toner_id']);
|
||||
}
|
||||
|
||||
mysql_query("UPDATE toner SET toner_current = '$tonerperc', toner_capacity = '" . $toner['toner_capacity'] . "' WHERE toner_id = '" . $toner['toner_id'] . "'");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user