41 lines
1.4 KiB
PHP

<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) Adam Armstrong
*
*/
global $agent_sensors;
if ($agent_data['areca']['hw'] != '') {
foreach (explode("\n", $agent_data['areca']['hw']) as $line) {
[$key, $content] = explode(':', $line, 2);
$areca[trim($key)] = trim($content);
}
foreach ($areca as $key => $value) {
if ($key == "Battery Status") {
$value = str_replace('%', '', $value);
discover_sensor('capacity', $device, '', 0, 'areca', "Areca Battery Status", 1, $value, [], 'agent');
$agent_sensors['capacity']['areca'][0] = ['description' => "Areca Battery Status", 'current' => $value, 'index' => 0];
} elseif ($key == "Fan#1 Speed (RPM)") {
// Currently doesn't handle more than one fan (but I know of no Areca controllers with >1 fan)
// Could be done with a regex like below.
discover_sensor('fanspeed', $device, '', 1, 'areca', "Areca Fan #1", 1, $value, [], 'agent');
$agent_sensors['fanspeed']['areca'][1] = ['description' => "Areca Fan #1", 'current' => $value, 'index' => 1];
} elseif (preg_match("/^HDD\ .*\ Temp\./", $key)) {
// Temperature value. Currently not handled as this can be retrieved over SNMP, unlike fan and battery status (for SATA controllers).
}
}
unset($areca);
}
// EOF