1<?php 2 3/** 4 * Observium 5 * 6 * This file is part of Observium. 7 * 8 * @package observium 9 * @subpackage poller 10 * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited 11 * 12 */ 13 14global $agent_sensors; 15 16if ($agent_data['array'] != '|') 17{ 18 $items = explode("\n", $agent_data['hdarray']); 19 echo "hdarray: " . print_r($items); 20 21 if (count($items)) 22 { 23 foreach ($items as $item) 24 { 25 list($param, $status) = explode('=', $item, 2); 26 $itemcount++; // Note this is not best index 27 switch ($status) 28 { 29 case 'Ok': 30 $istatus = 1; 31 break; 32 case 'Non-Critical': 33 // Warn 34 $istatus = 2; 35 break; 36 default: 37 // Fail 38 $istatus = 0; 39 } 40 echo "Status: $status istatus: $istatus"; 41 if ($param == 'Controller Status') 42 { 43 discover_status($device, '', $itemcount, 'unix-agent-state', $param, $istatus, array('entPhysicalClass' => 'controller'), 'agent'); 44 $agent_sensors['state']['unix-agent-state'][$itemcount] = array('description' => $param, 'current' => $istatus, 'index' => $itemcount); 45 } 46 elseif (preg_match('/^Drive \d/', $param)) 47 { 48 discover_status($device, '', $itemcount, 'unix-agent-state', $param, $istatus, array('entPhysicalClass' => 'storage'), 'agent'); 49 $agent_sensors['state']['unix-agent-state'][$itemcount] = array('description' => $param, 'current' => $istatus, 'index' => $itemcount); 50 } 51 } 52 echo PHP_EOL; 53 } 54} 55 56// EOF 57