mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	updates
git-svn-id: http://www.observium.org/svn/observer/trunk@2344 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
		@@ -138,7 +138,7 @@ if ($device['os'] == "ios" || $device['os_group'] == "ios")
 | 
			
		||||
 | 
			
		||||
        if ($ok) {
 | 
			
		||||
#          echo("\n".$valid['sensor'].", $type, $device, $oid, $index, 'cisco-entity-sensor', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $limit, $warn_limit, $current");
 | 
			
		||||
          discover_sensor($valid['sensor'], $type, $device, $oid, $index, 'cisco-entity-sensor', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $limit, $warn_limit, $current);
 | 
			
		||||
          discover_sensor($valid['sensor'], $type, $device, $oid, $index, 'cisco-entity-sensor', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $limit, $warn_limit, $current, $entPhysicalIndex, $entry['entSensorMeasuredEntity']);
 | 
			
		||||
        }
 | 
			
		||||
        $cisco_entity_temperature = 1;
 | 
			
		||||
        unset($limit, $limit_low, $warn_limit, $warn_limit_low);
 | 
			
		||||
 
 | 
			
		||||
@@ -1,11 +1,11 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
### Discover sensors
 | 
			
		||||
function discover_sensor(&$valid, $class, $device, $oid, $index, $type, $descr, $divisor = '1', $multiplier = '1', $low_limit = NULL, $low_warn_limit = NULL, $warn_limit = NULL, $high_limit = NULL, $current = NULL, $poller_type = 'snmp')
 | 
			
		||||
function discover_sensor(&$valid, $class, $device, $oid, $index, $type, $descr, $divisor = '1', $multiplier = '1', $low_limit = NULL, $low_warn_limit = NULL, $warn_limit = NULL, $high_limit = NULL, $current = NULL, $poller_type = 'snmp', $entPhysicalIndex = NULL, $entPhysicalIndex_measured = NULL)
 | 
			
		||||
{
 | 
			
		||||
  global $config, $debug;
 | 
			
		||||
 | 
			
		||||
  if ($debug) { echo("Discover sensor: $oid, $index, $type, $descr, $precision\n"); }
 | 
			
		||||
  if ($debug) { echo("Discover sensor: $oid, $index, $type, $descr, $precision, $entPhysicalIndex\n"); }
 | 
			
		||||
 | 
			
		||||
  if (dbFetchCell("SELECT COUNT(sensor_id) FROM `sensors` WHERE `poller_type`= ? AND `sensor_class` = ? AND `device_id` = ? AND sensor_type = ? AND `sensor_index` = ?", array($poller_type, $class, $device['device_id'], $type, $index)) == '0')
 | 
			
		||||
  {
 | 
			
		||||
@@ -64,14 +64,14 @@ function discover_sensor(&$valid, $class, $device, $oid, $index, $type, $descr,
 | 
			
		||||
      log_event("Sensor Low Limit Updated: ".mres($class)." ".mres($type)." ". mres($index)." ".mres($descr)." (".$low_limit.")", $device, 'sensor', $sensor_id);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ($oid == $sensor_entry['sensor_oid'] && $descr == $sensor_entry['sensor_descr'] && $multiplier == $sensor_entry['sensor_multiplier'] && $divisor == $sensor_entry['sensor_divisor'])
 | 
			
		||||
    if ($oid == $sensor_entry['sensor_oid'] && $descr == $sensor_entry['sensor_descr'] && $multiplier == $sensor_entry['sensor_multiplier'] && $divisor == $sensor_entry['sensor_divisor'] && $entPhysicalIndex_measured == $sensor_entry['entPhysicalIndex_measured'] && $entPhysicalIndex == $sensor_entry['entPhysicalIndex'])
 | 
			
		||||
    {
 | 
			
		||||
      echo(".");
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
      $update = array('sensor_oid' => $oid, 'sensor_descr' => $descr, 'sensor_multiplier' => $multiplier, 'sensor_divisor' => $divisor);
 | 
			
		||||
      $update = array('sensor_oid' => $oid, 'sensor_descr' => $descr, 'sensor_multiplier' => $multiplier, 'sensor_divisor' => $divisor,
 | 
			
		||||
                      'entPhysicalIndex' => $entPhysicalIndex, 'entPhysicalIndex_measured' => $entPhysicalIndex_measured);
 | 
			
		||||
      $updated = dbUpdate($update, '`sensor_id` = ?', array($sensor_entry['sensor_id']));
 | 
			
		||||
       echo("U");
 | 
			
		||||
      log_event("Sensor Updated: ".mres($class)." ".mres($type)." ". mres($index)." ".mres($descr), $device, 'sensor', $sensor_id);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user