<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */

$alarms = snmpwalk_cache_multi_oid($device, 'dpsRTUAlarmGrid', array(), "DPS-MIB-V38");

foreach($alarms as $index => $entry)
{
  // Ignore sensors that aren't configured or named
  if ($entry['dpsRTUAState'] == "-") { continue; }
  if ($entry['dpsRTUAPntDesc'] == "") { continue; }
  if ($entry['dpsRTUAPntDesc'] == "00") { continue; }
  if ($entry['dpsRTUAPntDesc'] == "Undefined") { continue; }
  if ($entry['dpsRTUAPntDesc'] == "-Undefined") { continue; }
  if ($entry['dpsRTUAPntDesc'] == "MjO:") { continue; }
  if ($entry['dpsRTUAPntDesc'] == "MjU:") { continue; }
  if ($entry['dpsRTUAPntDesc'] == "MnO:") { continue; }
  if ($entry['dpsRTUAPntDesc'] == "MnU:") { continue; }
  if ($entry['dpsRTUAPntDesc'] == "NotDet:") { continue; }

  $state = $entry['dpsRTUAState'];
  $oid   = ".1.3.6.1.4.1.2682.1.2.5.1.6.$index";
  $descr = $entry['dpsRTUAPntDesc'];

 discover_status($device, $oid, "dpsRTUAlarmGrid.$index", 'dpsRTUAState', $descr, $state, array('entPhysicalClass'=>'other'));
}

$alarms = snmpwalk_cache_multi_oid($device, 'analogChannels', array(), "DPS-MIB-V38");

foreach($alarms as $index => $entry)
{

  if ($entry['enabled'] == "disabled") { continue; }

  $state = $entry['thresholds'];
  $oid   = ".1.3.6.1.4.1.2682.1.2.6.1.5.$index";
  $descr = $entry['description'];

  discover_status($device, $oid, "analogChannel.$index", 'thresholds', $descr, $state, array('entPhysicalClass'=>'other'));

}

// EOF
