Commit version 24.12.13800

This commit is contained in:
2025-01-06 17:35:06 -05:00
parent b7f6a79c2c
commit 55d9218816
6133 changed files with 4239740 additions and 1374287 deletions

View File

@ -4,9 +4,9 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
* @package observium
* @subpackage discovery
* @copyright (C) Adam Armstrong
*
*/
@ -27,47 +27,47 @@ $mib = 'Printer-MIB';
//Printer-MIB::prtMarkerEastMargin.1.1 = INTEGER: 1968
//Printer-MIB::prtMarkerStatus.1.1 = INTEGER: 2
$oids = snmpwalk_cache_oid($device, "prtMarkerEntry", [], $mib);
$oids = snmpwalk_cache_oid($device, "prtMarkerEntry", [], $mib);
$prt_supplies = snmpwalk_cache_oid($device, 'prtMarkerSuppliesDescription', [], $mib, NULL, OBS_SNMP_ALL_ASCII);
//print_vars($oids);
//$count = count($oids);
//$total_printed_allow = TRUE;
$total_printed_allow = !discovery_check_if_type_exist([ 'printersupply->KYOCERA-MIB->kcprtMarkerServiceCount' ], 'counter');
$total_printed_allow = !discovery_check_if_type_exist(['printersupply->KYOCERA-MIB->kcprtMarkerServiceCount'], 'counter');
foreach ($oids as $index => $entry) {
$printer_supply = dbFetchRow("SELECT * FROM `printersupplies` WHERE `device_id` = ? AND `supply_mib` = ? AND `supply_index` = ?", [ $device['device_id'], 'jetdirect', $index ]);
$marker_descr = "Printed ".nicecase($entry['prtMarkerCounterUnit']);
list($hrDeviceIndex, $prtMarkerIndex) = explode('.', $index);
$options = [
'measured_class' => 'printersupply',
'measured_entity' => $printer_supply['supply_id'],
'counter_unit' => $entry['prtMarkerCounterUnit']
];
$printer_supply = dbFetchRow("SELECT * FROM `printersupplies` WHERE `device_id` = ? AND `supply_mib` = ? AND `supply_index` = ?", [$device['device_id'], 'jetdirect', $index]);
$marker_descr = "Printed " . nicecase($entry['prtMarkerCounterUnit']);
[$hrDeviceIndex, $prtMarkerIndex] = explode('.', $index);
$options = [
'measured_class' => 'printersupply',
'measured_entity' => $printer_supply['supply_id'],
'counter_unit' => $entry['prtMarkerCounterUnit']
];
// Lifetime counter (should be always single)
$descr = "Total $marker_descr";
$oid_name = 'prtMarkerLifeCount';
$oid = '.1.3.6.1.2.1.43.10.2.1.4.' . $index;
$value = $entry[$oid_name];
// Lifetime counter (should be always single)
$descr = "Total $marker_descr";
$oid_name = 'prtMarkerLifeCount';
$oid = '.1.3.6.1.2.1.43.10.2.1.4.' . $index;
$value = $entry[$oid_name];
if (isset($entry[$oid_name]) && $total_printed_allow) {
discover_counter($device, 'printersupply', $mib, $oid_name, $oid, $index, $descr, 1, $value, $options);
$total_printed_allow = FALSE; // Discover only first "Total Printed", all other always same
}
if (isset($entry[$oid_name]) && $total_printed_allow) {
discover_counter($device, 'printersupply', $mib, $oid_name, $oid, $index, $descr, 1, $value, $options);
$total_printed_allow = FALSE; // Discover only first "Total Printed", all other always same
}
// PowerOn counter
$descr = "PowerOn $marker_descr";
if ($prt_supplies[$index]['prtMarkerSuppliesDescription']) {
$descr .= ' - ' . rewrite_entity_name(snmp_hexstring($prt_supplies[$index]['prtMarkerSuppliesDescription']));
}
$oid_name = 'prtMarkerPowerOnCount';
$oid = '.1.3.6.1.2.1.43.10.2.1.5.' . $index;
$value = $entry[$oid_name];
// PowerOn counter
$descr = "PowerOn $marker_descr";
if ($prt_supplies[$index]['prtMarkerSuppliesDescription']) {
$descr .= ' - ' . rewrite_entity_name(snmp_hexstring($prt_supplies[$index]['prtMarkerSuppliesDescription']));
}
$oid_name = 'prtMarkerPowerOnCount';
$oid = '.1.3.6.1.2.1.43.10.2.1.5.' . $index;
$value = $entry[$oid_name];
discover_counter($device, 'printersupply', $mib, $oid_name, $oid, $index, rewrite_entity_name($descr), 1, $value, $options);
discover_counter($device, 'printersupply', $mib, $oid_name, $oid, $index, rewrite_entity_name($descr), 1, $value, $options);
// prtMarkerStatus
// FIXME, binary statuses currently unsupported
// prtMarkerStatus
// FIXME, binary statuses currently unsupported
}
// EOF