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,5 +1,4 @@
<?php
/**
* Observium
*
@ -7,50 +6,45 @@
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
global $agent_sensors;
if ($agent_data['array'] != '|')
{
$items = explode("\n", $agent_data['hdarray']);
echo "hdarray: " . print_r($items);
if (count($items))
{
foreach ($items as $item)
{
list($param, $status) = explode('=', $item, 2);
$itemcount++; // Note this is not best index
switch ($status)
{
case 'Ok':
$istatus = 1;
break;
case 'Non-Critical':
// Warn
$istatus = 2;
break;
default:
// Fail
$istatus = 0;
}
echo "Status: $status istatus: $istatus";
if ($param == 'Controller Status')
{
discover_status($device, '', $itemcount, 'unix-agent-state', $param, $istatus, array('entPhysicalClass' => 'controller'), 'agent');
$agent_sensors['state']['unix-agent-state'][$itemcount] = array('description' => $param, 'current' => $istatus, 'index' => $itemcount);
}
elseif (preg_match('/^Drive \d/', $param))
{
discover_status($device, '', $itemcount, 'unix-agent-state', $param, $istatus, array('entPhysicalClass' => 'storage'), 'agent');
$agent_sensors['state']['unix-agent-state'][$itemcount] = array('description' => $param, 'current' => $istatus, 'index' => $itemcount);
}
if ($agent_data['array'] !== '|') {
$items = explode("\n", $agent_data['hdarray']);
if (OBS_DEBUG) {
echo "hdarray: " . print_r($items);
}
if (safe_count($items)) {
foreach ($items as $item) {
[ $param, $status ] = explode('=', $item, 2);
$itemcount++; // Note this is not best index
switch ($status) {
case 'Ok':
$istatus = 1;
break;
case 'Non-Critical':
// Warn
$istatus = 2;
break;
default:
// Fail
$istatus = 0;
}
echo "Status: $status istatus: $istatus";
if ($param == 'Controller Status') {
discover_status($device, '', $itemcount, 'unix-agent-state', $param, $istatus, ['entPhysicalClass' => 'controller'], 'agent');
$agent_sensors['state']['unix-agent-state'][$itemcount] = ['description' => $param, 'current' => $istatus, 'index' => $itemcount];
} elseif (preg_match('/^Drive \S/', $param)) {
discover_status($device, '', $itemcount, 'unix-agent-state', $param, $istatus, ['entPhysicalClass' => 'storage'], 'agent');
$agent_sensors['state']['unix-agent-state'][$itemcount] = ['description' => $param, 'current' => $istatus, 'index' => $itemcount];
}
}
echo PHP_EOL;
}
echo PHP_EOL;
}
}
// EOF