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

@ -1,23 +0,0 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
*
*/
// FIXME. move to definitions
if (isset($oid_cache[$processor['processor_oid']]))
{
$load = $oid_cache[$processor['processor_oid']];
} else {
$load = snmp_get_oid($device, '.1.3.6.1.4.1.6141.2.60.12.1.7.4.0');
}
$proc = (float) $load / 100;
// EOF

View File

@ -1,31 +0,0 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
*
*/
// DNOS-SWITCHING-MIB::agentSwitchCpuProcessTotalUtilization.0 = STRING: " 5 Secs ( 6.510%) 60 Secs ( 7.724%) 300 Secs ( 6.3812%)"
// FIXME. move to definitions
if (isset($oid_cache[$processor['processor_oid']]))
{
$data = $oid_cache[$processor['processor_oid']];
} else {
$data = snmp_get_oid($device, 'agentSwitchCpuProcessTotalUtilization.0', 'DNOS-SWITCHING-MIB');
}
if (preg_match('/300 Secs \(\s*(?<proc>[\d\.]+)%\)/', $data, $matches))
{
$proc = $matches['proc'];
}
unset($data, $matches);
// EOF

View File

@ -1,31 +0,0 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
*
*/
// EdgeSwitch-SWITCHING-MIB::agentSwitchCpuProcessTotalUtilization.0 = STRING: " 5 Secs ( 99.9999%) 60 Secs ( 99.6358%) 300 Secs ( 99.2401%)"
// FIXME. move to definitions
if (isset($oid_cache[$processor['processor_oid']]))
{
$data = $oid_cache[$processor['processor_oid']];
} else {
$data = snmp_get_oid($device, 'agentSwitchCpuProcessTotalUtilization.0', 'EdgeSwitch-SWITCHING-MIB');
}
if (preg_match('/300 Secs \(\s*(?<proc>[\d\.]+)%\)/', $data, $matches))
{
$proc = $matches['proc'];
}
unset($data, $matches);
// EOF

View File

@ -4,53 +4,57 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @package observium
* @subpackage poller
* @copyright (C) Adam Armstrong
*
*/
$hrDevice_oids = array('hrDeviceType', 'hrDeviceDescr', 'hrProcessorLoad');
$hrDevice_oids = ['hrDeviceType', 'hrDeviceDescr', 'hrProcessorLoad'];
$hrDevice_array = [];
foreach ($hrDevice_oids as $oid) {
$hrDevice_array = snmpwalk_cache_oid($device, $oid, $hrDevice_array, 'HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES');
$hrDevice_array = snmpwalk_cache_oid($device, $oid, $hrDevice_array, 'HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES');
}
$hr_cpus = 0;
$hr_cpus = 0;
$hr_total = 0;
if (safe_count($hrDevice_array)) {
foreach ($hrDevice_array as $index => $entry) {
if (!is_numeric($entry['hrProcessorLoad'])) { continue; }
foreach ($hrDevice_array as $index => $entry) {
if (!is_numeric($entry['hrProcessorLoad'])) {
continue;
}
if (!isset($entry['hrDeviceType'])) {
$entry['hrDeviceType'] = 'hrDeviceProcessor';
$entry['hrDeviceIndex'] = $index;
} elseif ($entry['hrDeviceType'] === 'hrDeviceOther' &&
preg_match('/^cpu\d+:/', $entry['hrDeviceDescr'])) {
// Workaround bsnmpd reporting CPUs as hrDeviceOther (FY FreeBSD.)
$entry['hrDeviceType'] = 'hrDeviceProcessor';
if (!isset($entry['hrDeviceType'])) {
$entry['hrDeviceType'] = 'hrDeviceProcessor';
$entry['hrDeviceIndex'] = $index;
} elseif ($entry['hrDeviceType'] === 'hrDeviceOther' &&
preg_match('/^cpu\d+:/', $entry['hrDeviceDescr'])) {
// Workaround bsnmpd reporting CPUs as hrDeviceOther (FY FreeBSD.)
$entry['hrDeviceType'] = 'hrDeviceProcessor';
}
if ($entry['hrDeviceType'] === 'hrDeviceProcessor') {
$usage = $entry['hrProcessorLoad'];
if ($device['os'] === 'arista_eos' && $index == 1) {
continue;
}
if ($entry['hrDeviceDescr'] !== 'An electronic chip that makes the computer work.') {
$hr_cpus++;
$hr_total += $usage;
}
}
unset($entry);
}
if ($entry['hrDeviceType'] === 'hrDeviceProcessor') {
$usage = $entry['hrProcessorLoad'];
if ($device['os'] === 'arista_eos' && $index == 1) { continue; }
if ($entry['hrDeviceDescr'] !== 'An electronic chip that makes the computer work.') {
$hr_cpus++;
$hr_total += $usage;
}
if ($hr_cpus) {
$proc = $hr_total / $hr_cpus;
}
unset($entry);
}
if ($hr_cpus) {
$proc = $hr_total / $hr_cpus;
}
unset($hrDevice_oids, $hrDevice_array, $oid);
unset($hrDevice_oids, $hrDevice_array, $oid);
}
// EOF

View File

@ -1,22 +0,0 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
*
*/
// FIXME. move to definitions
if (isset($oid_cache[$processor['processor_oid']]))
{
$proc = $oid_cache[$processor['processor_oid']];
} else {
$proc = snmp_get_oid($device, 'swCpuUsage.0', 'SW-MIB');
}
// EOF

View File

@ -1,28 +0,0 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
*
*/
# "5 Sec (7.31%), 1 Min (14.46%), 5 Min (10.90%)"
// FIXME. move to definitions
if (isset($oid_cache[$processor['processor_oid']]))
{
$values = $oid_cache[$processor['processor_oid']];
} else {
$values = snmp_get_oid($device, 'dellLanExtension.6132.1.1.1.1.4.4.0', 'Dell-Vendor-MIB');
}
preg_match('/5 Sec \((.*)%\),.*1 Min \((.*)%\),.*5 Min \((.*)%\)$/', $values, $matches);
$proc = $matches[3];
// EOF

View File

@ -1,5 +1,4 @@
<?php
/**
* Observium
*
@ -7,29 +6,24 @@
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
// Simple poller for UCD old style CPU. will always poll the same index.
// Simple poller for UCD old style CPU.
//$system = snmp_get($device, 'ssCpuSystem.0', '-OvQ', 'UCD-SNMP-MIB');
//$user = snmp_get($device, 'ssCpuUser.0', '-OvQ', 'UCD-SNMP-MIB');
// FIXME. move to definitions
if (isset($oid_cache[$processor['processor_oid']]))
{
$idle = $oid_cache[$processor['processor_oid']];
if (isset($oid_cache[$processor['processor_oid']])) {
$idle = $oid_cache[$processor['processor_oid']];
} else {
$idle = snmp_get_oid($device, 'ssCpuIdle.0', 'UCD-SNMP-MIB');
$idle = snmp_get_oid($device, 'ssCpuIdle.0', 'UCD-SNMP-MIB');
}
if ($processor['processor_returns_idle'] == 1)
{
// Just compat before processor not updated
$proc = $idle;
} else {
$proc = 100 - $idle;
if (isset($processor['processor_returns_idle'])) {
// Just compat before the processor isn't updated
$processor['processor_returns_idle'] = 1;
}
$proc = $idle;
// EOF

View File

@ -0,0 +1,33 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) Adam Armstrong
*
*/
// Derp poller for UCD-SNMP-MIB for counter. It's IDLE
if (isset($oid_cache[$processor['processor_oid']])) {
$proc = $oid_cache[$processor['processor_oid']];
} elseif ($processor['processor_polled'] &&
$idle_last = get_entity_attrib('processor', $processor['processor_id'], 'value-raw')) { // get last counter value
$idle = snmp_get_oid($device, 'ssCpuRawIdle.0', 'UCD-SNMP-MIB');
$proc_polled = snmp_endtime();
// Calculate idle for counter from previous value
$proc = float_div($idle - $idle_last, $proc_polled - $processor['processor_polled']);
// store raw value for next poll
set_entity_attrib('processor', $processor['processor_id'], 'value-raw', $idle);
} else {
// In case of error
$proc = 100;
}
// EOF

View File

@ -4,9 +4,9 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
* @package observium
* @subpackage poller
* @copyright (C) Adam Armstrong
*
*/
@ -15,26 +15,26 @@
- Need to add support for systems with multiple processor models
*/
$db_cpu_names = dbFetchRows('SELECT `processor_descr` FROM `processors` WHERE `device_id` = ?', [ $device['device_id'] ]);
$db_cpu_names = dbFetchRows('SELECT `processor_descr` FROM `processors` WHERE `device_id` = ?', [$device['device_id']]);
if (count(array_unique((array)$db_cpu_names)) === 1 &&
($db_cpu_names[0]['processor_descr'] === 'Unknown Processor Type' || $db_cpu_names[0]['processor_descr'] === 'Intel')) {
$logical_proc_count = 0;
$cpu_count = 0;
$cpu_names = [];
$logical_proc_count = 0;
$cpu_count = 0;
$cpu_names = [];
foreach ($wmi['processors'] as $cpu) {
$cpu_count++;
$logical_proc_count += $cpu['NumberOfLogicalProcessors'];
array_push($cpu_names, $cpu['Name']);
}
foreach ($wmi['processors'] as $cpu) {
$cpu_count++;
$logical_proc_count += $cpu['NumberOfLogicalProcessors'];
array_push($cpu_names, $cpu['Name']);
}
if (count(array_unique($cpu_names)) === 1 && $cpu_names[0] === $wmi['processors'][0]['Name']) {
dbUpdate([ 'processor_descr' => $wmi['processors'][0]['Name']] , 'processors', '`device_id` = ? AND (`processor_descr` = ? OR `processor_descr` = ?)', [ $device['device_id'], 'Unknown Processor Type', 'Intel' ]);
echo(' Processor Name Updated:');
}
if (count(array_unique($cpu_names)) === 1 && $cpu_names[0] === $wmi['processors'][0]['Name']) {
dbUpdate(['processor_descr' => $wmi['processors'][0]['Name']], 'processors', '`device_id` = ? AND (`processor_descr` = ? OR `processor_descr` = ?)', [$device['device_id'], 'Unknown Processor Type', 'Intel']);
echo(' Processor Name Updated:');
}
}
echo(' '.$wmi['processors'][0]['Name']."\n");
echo(' ' . $wmi['processors'][0]['Name'] . "\n");
// EOF