change printer-supplies rrd name to include the supply_type (#12792)

* Update PrinterSupplies.php

* Update toner.inc.php

* Update auth.inc.php
This commit is contained in:
Simon Smith
2021-04-25 15:16:21 +01:00
committed by GitHub
parent 23e9ec3891
commit 5453163331
3 changed files with 3 additions and 3 deletions

View File

@@ -76,7 +76,7 @@ class PrinterSupplies implements Module
$tags = [
'rrd_def' => RrdDefinition::make()->addDataset('toner', 'GAUGE', 0, 20000),
'rrd_name' => ['toner', $toner['supply_index']],
'rrd_name' => ['toner', $toner['supply_type'], $toner['supply_index']],
'rrd_oldname' => ['toner', $toner['supply_descr']],
'index' => $toner['supply_index'],
];

View File

@@ -47,7 +47,7 @@ foreach (dbFetchRows('SELECT * FROM printer_supplies where device_id = ?', [$dev
$hostname = gethostbyid($toner['device_id']);
$descr = \LibreNMS\Data\Store\Rrd::safeDescr(substr(str_pad($toner['supply_descr'], 16), 0, 16));
$rrd_filename = Rrd::name($device['hostname'], ['toner', $toner['supply_index']]);
$rrd_filename = Rrd::name($device['hostname'], ['toner', $toner['supply_type'], $toner['supply_index']]);
$id = $toner['supply_id'];
$rrd_options .= " DEF:toner$id=$rrd_filename:toner:AVERAGE";

View File

@@ -5,7 +5,7 @@ if (is_numeric($vars['id'])) {
if (is_numeric($toner['device_id']) && ($auth || device_permitted($toner['device_id']))) {
$device = device_by_id_cache($toner['device_id']);
$rrd_filename = Rrd::name($device['hostname'], ['toner', $toner['supply_index']]);
$rrd_filename = Rrd::name($device['hostname'], ['toner', $toner['supply_type'], $toner['supply_index']]);
$title = generate_device_link($device);
$title .= ' :: Toner :: ' . htmlentities($toner['supply_descr']);