mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	split frequencies and current into separate files
git-svn-id: http://www.observium.org/svn/observer/trunk@1589 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
		@@ -1,228 +1,7 @@
 | 
			
		||||
<?php
 | 
			
		||||
echo("Current : ");
 | 
			
		||||
echo("Current: ");
 | 
			
		||||
 | 
			
		||||
## APC
 | 
			
		||||
if ($device['os'] == "apc")
 | 
			
		||||
{
 | 
			
		||||
  # PDU
 | 
			
		||||
  $oids = snmp_walk($device, ".1.3.6.1.4.1.318.1.1.12.2.3.1.1.2", "-OsqnU", "");
 | 
			
		||||
  if ($debug) { echo($oids."\n"); }
 | 
			
		||||
  $oids = trim($oids);
 | 
			
		||||
  if ($oids) echo("APC ");
 | 
			
		||||
  $type = "apc";
 | 
			
		||||
  $precision = "10";
 | 
			
		||||
  foreach(explode("\n", $oids) as $data)
 | 
			
		||||
  {
 | 
			
		||||
    $data = trim($data);
 | 
			
		||||
    if ($data)
 | 
			
		||||
    {
 | 
			
		||||
      list($oid,$kind) = explode(" ", $data);
 | 
			
		||||
      $split_oid = explode('.',$oid);
 | 
			
		||||
      $index = $split_oid[count($split_oid)-1];
 | 
			
		||||
 | 
			
		||||
      $current_oid   = "1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.".$index;
 | 
			
		||||
      $phase_oid     = "1.3.6.1.4.1.318.1.1.12.2.3.1.1.4.".$index;
 | 
			
		||||
      $limit_oid     = "1.3.6.1.4.1.318.1.1.12.2.2.1.1.4.".$index;
 | 
			
		||||
      $lowlimit_oid  = "1.3.6.1.4.1.318.1.1.12.2.2.1.1.2.".$index;
 | 
			
		||||
      $warnlimit_oid = "1.3.6.1.4.1.318.1.1.12.2.2.1.1.3.".$index;
 | 
			
		||||
 | 
			
		||||
      $phase     = snmp_get($device, $phase_oid, "-Oqv", "");
 | 
			
		||||
      $current   = snmp_get($device, $current_oid, "-Oqv", "") / $precision;
 | 
			
		||||
      $limit     = snmp_get($device, $limit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
 | 
			
		||||
      $lowlimit  = snmp_get($device, $lowlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
 | 
			
		||||
      $warnlimit = snmp_get($device, $warnlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
 | 
			
		||||
      if (count(explode("\n",$oids)) != 1)
 | 
			
		||||
      {
 | 
			
		||||
        $descr     = "Phase $phase";
 | 
			
		||||
      }
 | 
			
		||||
      else
 | 
			
		||||
      {
 | 
			
		||||
        $descr     = "Output";
 | 
			
		||||
      }
 | 
			
		||||
      echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, NULL, $warnlimit, $limit, $current);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  # ATS  
 | 
			
		||||
  $atsCurrent = snmp_get($device, "1.3.6.1.4.1.318.1.1.8.5.4.3.1.4.1.1.1", "-OsqnU", "");
 | 
			
		||||
  if ($atsCurrent)
 | 
			
		||||
  {
 | 
			
		||||
      $current_oid   = "1.3.6.1.4.1.318.1.1.8.5.4.3.1.4.1.1.1";
 | 
			
		||||
      $limit_oid     = "1.3.6.1.4.1.318.1.1.8.4.16.1.5.1";
 | 
			
		||||
      $lowlimit_oid  = "1.3.6.1.4.1.318.1.1.8.4.16.1.3.1";
 | 
			
		||||
      $warnlimit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.4.1";
 | 
			
		||||
      $index         = 1;
 | 
			
		||||
 | 
			
		||||
      $current   = snmp_get($device, $current_oid, "-Oqv", "") / $precision;
 | 
			
		||||
      $limit     = snmp_get($device, $limit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
 | 
			
		||||
      $lowlimit  = snmp_get($device, $lowlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
 | 
			
		||||
      $warnlimit = snmp_get($device, $warnlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
 | 
			
		||||
      $descr     = "Output Feed";
 | 
			
		||||
 | 
			
		||||
      echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, NULL, $warnlimit, $limit, $current);
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
## MGE UPS
 | 
			
		||||
if ($device['os'] == "mgeups") 
 | 
			
		||||
{
 | 
			
		||||
  echo("MGE ");
 | 
			
		||||
  $oids = trim(snmp_walk($device, "1.3.6.1.4.1.705.1.7.1", "-OsqnU"));
 | 
			
		||||
  if ($debug) { echo($oids."\n"); }
 | 
			
		||||
  list($unused,$numPhase) = explode(' ',$oids);
 | 
			
		||||
  for($i = 1; $i <= $numPhase;$i++)
 | 
			
		||||
  {
 | 
			
		||||
    unset($current);
 | 
			
		||||
    $current_oid   = ".1.3.6.1.4.1.705.1.7.2.1.5.$i";
 | 
			
		||||
    $descr      = "Output"; if ($numPhase > 1) $descr .= " Phase $i";
 | 
			
		||||
    $current    = snmp_get($device, $current_oid, "-Oqv");
 | 
			
		||||
    if (!$current)
 | 
			
		||||
    {
 | 
			
		||||
      $current_oid .= ".0";
 | 
			
		||||
      $current    = snmp_get($device, $current_oid, "-Oqv");
 | 
			
		||||
    }
 | 
			
		||||
    $current   /= 10;
 | 
			
		||||
    $type       = "mge-ups";
 | 
			
		||||
    $precision  = 10;
 | 
			
		||||
    $index      = $i;
 | 
			
		||||
    $warnlimit  = NULL;
 | 
			
		||||
    $lowlimit   = 0;
 | 
			
		||||
    $limit      = NULL;
 | 
			
		||||
    $lowwarnlimit = NULL;
 | 
			
		||||
    echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, $lowwarnlimit, $warnlimit, $limit, $current);
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
  $oids = trim(snmp_walk($device, "1.3.6.1.4.1.705.1.6.1", "-OsqnU"));
 | 
			
		||||
  if ($debug) { echo($oids."\n"); }
 | 
			
		||||
  list($unused,$numPhase) = explode(' ',$oids);
 | 
			
		||||
  for($i = 1; $i <= $numPhase;$i++)
 | 
			
		||||
  {
 | 
			
		||||
    unset($current);
 | 
			
		||||
    $current_oid   = ".1.3.6.1.4.1.705.1.6.2.1.6.$i";
 | 
			
		||||
    $descr      = "Input"; if ($numPhase > 1) $descr .= " Phase $i";
 | 
			
		||||
    $current    = snmp_get($device, $current_oid, "-Oqv");
 | 
			
		||||
    if (!$current)
 | 
			
		||||
    {
 | 
			
		||||
      $current_oid .= ".0";
 | 
			
		||||
      $current    = snmp_get($device, $current_oid, "-Oqv");
 | 
			
		||||
    }
 | 
			
		||||
    $current   /= 10;
 | 
			
		||||
    $type       = "mge-ups";
 | 
			
		||||
    $precision  = 10;
 | 
			
		||||
    $index      = 100+$i;
 | 
			
		||||
    $warnlimit  = NULL;
 | 
			
		||||
    $lowlimit   = 0;
 | 
			
		||||
    $limit      = NULL;
 | 
			
		||||
    $lowwarnlimit = NULL;
 | 
			
		||||
    echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, $lowwarnlimit, $warnlimit, $limit, $current);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
## Riello UPS
 | 
			
		||||
if ($device['os'] == "netmanplus" || $device['os'] == 'deltaups') 
 | 
			
		||||
{
 | 
			
		||||
  echo("RFC1628 ");
 | 
			
		||||
  
 | 
			
		||||
  $oids = snmp_walk($device, "1.3.6.1.2.1.33.1.2.6", "-Osqn", "UPS-MIB");
 | 
			
		||||
  if ($debug) { echo($oids."\n"); }
 | 
			
		||||
  $oids = trim($oids);
 | 
			
		||||
  foreach(explode("\n", $oids) as $data) 
 | 
			
		||||
  {
 | 
			
		||||
    $data = trim($data);
 | 
			
		||||
    if ($data) 
 | 
			
		||||
    {
 | 
			
		||||
      list($oid,$descr) = explode(" ", $data,2);
 | 
			
		||||
      $split_oid = explode('.',$oid);
 | 
			
		||||
      $current_id = $split_oid[count($split_oid)-1];
 | 
			
		||||
      $current_oid  = "1.3.6.1.2.1.33.1.2.6.$current_id";
 | 
			
		||||
      $precision = 10;
 | 
			
		||||
      $current = snmp_get($device, $current_oid, "-O vq") / $precision;
 | 
			
		||||
      $descr = "Battery" . (count(explode("\n",$oids)) == 1 ? '' : ' ' . ($current_id+1));
 | 
			
		||||
      $type = "rfc1628";
 | 
			
		||||
      $index = 500+$current_id;
 | 
			
		||||
      echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', NULL, NULL, NULL, NULL, $current);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  $oids = trim(snmp_walk($device, "1.3.6.1.2.1.33.1.4.3.0", "-OsqnU"));
 | 
			
		||||
  if ($debug) { echo($oids."\n"); }
 | 
			
		||||
  list($unused,$numPhase) = explode(' ',$oids);
 | 
			
		||||
  for($i = 1; $i <= $numPhase;$i++)
 | 
			
		||||
  {
 | 
			
		||||
    $current_oid   = ".1.3.6.1.2.1.33.1.4.4.1.3.$i";
 | 
			
		||||
    $descr      = "Output"; if ($numPhase > 1) $descr .= " Phase $i";
 | 
			
		||||
    $current    = snmp_get($device, $current_oid, "-Oqv");
 | 
			
		||||
    $type       = "rfc1628";
 | 
			
		||||
    $precision  = 1;
 | 
			
		||||
    $index      = $i;
 | 
			
		||||
    echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', NULL, NULL, NULL, NULL, $current);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  $oids = trim(snmp_walk($device, "1.3.6.1.2.1.33.1.3.2.0", "-OsqnU"));
 | 
			
		||||
  if ($debug) { echo($oids."\n"); }
 | 
			
		||||
  list($unused,$numPhase) = explode(' ',$oids);
 | 
			
		||||
  for($i = 1; $i <= $numPhase;$i++)
 | 
			
		||||
  {
 | 
			
		||||
    $current_oid   = "1.3.6.1.2.1.33.1.3.3.1.4.$i";
 | 
			
		||||
    $descr      = "Input"; if ($numPhase > 1) $descr .= " Phase $i";
 | 
			
		||||
    $current    = snmp_get($device, $current_oid, "-Oqv");
 | 
			
		||||
    $type       = "rfc1628";
 | 
			
		||||
    $precision  = 1;
 | 
			
		||||
    $index      = 100+$i;
 | 
			
		||||
    echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', NULL, NULL, NULL, NULL, $current);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  $oids = trim(snmp_walk($device, "1.3.6.1.2.1.33.1.5.2.0", "-OsqnU"));
 | 
			
		||||
  if ($debug) { echo($oids."\n"); }
 | 
			
		||||
  list($unused,$numPhase) = explode(' ',$oids);
 | 
			
		||||
  for($i = 1; $i <= $numPhase;$i++)
 | 
			
		||||
  {
 | 
			
		||||
    $current_oid   = "1.3.6.1.2.1.33.1.5.3.1.3.$i";
 | 
			
		||||
    $descr      = "Bypass"; if ($numPhase > 1) $descr .= " Phase $i";
 | 
			
		||||
    $current    = snmp_get($device, $current_oid, "-Oqv");
 | 
			
		||||
    $type       = "rfc1628";
 | 
			
		||||
    $precision  = 1;
 | 
			
		||||
    $index      = 200+$i;
 | 
			
		||||
    echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', NULL, NULL, NULL, NULL, $current);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if ($device['os'] == "gamatronicups") {
 | 
			
		||||
 | 
			
		||||
               for($i = 1; $i <= 3 ;$i++) {
 | 
			
		||||
                       $current_oid   = "GAMATRONIC-MIB::gamatronicLTD.5.4.1.1.3.$i";
 | 
			
		||||
                       $descr = "Input Phase $i";
 | 
			
		||||
                       $current = snmp_get($device, $current_oid, "-Oqv");
 | 
			
		||||
                       $type = "gamatronicups";
 | 
			
		||||
                       $precision = 1;
 | 
			
		||||
                       $index = $i;
 | 
			
		||||
                       $lowlimit = 0;
 | 
			
		||||
                       $warnlimit = NULL;
 | 
			
		||||
                       $limit = NULL;
 | 
			
		||||
 | 
			
		||||
                       echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', $lowlimit, NULL, NULL, NULL, $current);
 | 
			
		||||
               }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
               for($i = 1; $i <= 3 ;$i++) {
 | 
			
		||||
                       $current_oid   = "GAMATRONIC-MIB::gamatronicLTD.5.5.1.1.3.$i";
 | 
			
		||||
                       $descr = "Output Phase $i";
 | 
			
		||||
                       $current = snmp_get($device, $current_oid, "-Oqv");
 | 
			
		||||
                       $type = "gamatronicups";
 | 
			
		||||
                       $precision = 1;
 | 
			
		||||
                       $index = 100+$i;
 | 
			
		||||
                       $lowlimit = 0;
 | 
			
		||||
                       $warnlimit = NULL;
 | 
			
		||||
                       $limit = NULL;
 | 
			
		||||
                       echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', $lowlimit, NULL, NULL, NULL, $current);
 | 
			
		||||
               }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
include_dir("includes/discovery/current");
 | 
			
		||||
 | 
			
		||||
if($debug) { print_r($valid['current']); }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										67
									
								
								includes/discovery/current/apc.inc.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								includes/discovery/current/apc.inc.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,67 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
global $valid_sensor;
 | 
			
		||||
 | 
			
		||||
## APC
 | 
			
		||||
if ($device['os'] == "apc")
 | 
			
		||||
{
 | 
			
		||||
  # PDU
 | 
			
		||||
  $oids = snmp_walk($device, ".1.3.6.1.4.1.318.1.1.12.2.3.1.1.2", "-OsqnU", "");
 | 
			
		||||
  if ($debug) { echo($oids."\n"); }
 | 
			
		||||
  $oids = trim($oids);
 | 
			
		||||
  if ($oids) echo("APC ");
 | 
			
		||||
  $type = "apc";
 | 
			
		||||
  $precision = "10";
 | 
			
		||||
  foreach(explode("\n", $oids) as $data)
 | 
			
		||||
  {
 | 
			
		||||
    $data = trim($data);
 | 
			
		||||
    if ($data)
 | 
			
		||||
    {
 | 
			
		||||
      list($oid,$kind) = explode(" ", $data);
 | 
			
		||||
      $split_oid = explode('.',$oid);
 | 
			
		||||
      $index = $split_oid[count($split_oid)-1];
 | 
			
		||||
 | 
			
		||||
      $current_oid   = "1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.".$index;
 | 
			
		||||
      $phase_oid     = "1.3.6.1.4.1.318.1.1.12.2.3.1.1.4.".$index;
 | 
			
		||||
      $limit_oid     = "1.3.6.1.4.1.318.1.1.12.2.2.1.1.4.".$index;
 | 
			
		||||
      $lowlimit_oid  = "1.3.6.1.4.1.318.1.1.12.2.2.1.1.2.".$index;
 | 
			
		||||
      $warnlimit_oid = "1.3.6.1.4.1.318.1.1.12.2.2.1.1.3.".$index;
 | 
			
		||||
 | 
			
		||||
      $phase     = snmp_get($device, $phase_oid, "-Oqv", "");
 | 
			
		||||
      $current   = snmp_get($device, $current_oid, "-Oqv", "") / $precision;
 | 
			
		||||
      $limit     = snmp_get($device, $limit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
 | 
			
		||||
      $lowlimit  = snmp_get($device, $lowlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
 | 
			
		||||
      $warnlimit = snmp_get($device, $warnlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
 | 
			
		||||
      if (count(explode("\n",$oids)) != 1)
 | 
			
		||||
      {
 | 
			
		||||
        $descr     = "Phase $phase";
 | 
			
		||||
      }
 | 
			
		||||
      else
 | 
			
		||||
      {
 | 
			
		||||
        $descr     = "Output";
 | 
			
		||||
      }
 | 
			
		||||
      echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, NULL, $warnlimit, $limit, $current);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  # ATS  
 | 
			
		||||
  $atsCurrent = snmp_get($device, "1.3.6.1.4.1.318.1.1.8.5.4.3.1.4.1.1.1", "-OsqnU", "");
 | 
			
		||||
  if ($atsCurrent)
 | 
			
		||||
  {
 | 
			
		||||
      $current_oid   = "1.3.6.1.4.1.318.1.1.8.5.4.3.1.4.1.1.1";
 | 
			
		||||
      $limit_oid     = "1.3.6.1.4.1.318.1.1.8.4.16.1.5.1";
 | 
			
		||||
      $lowlimit_oid  = "1.3.6.1.4.1.318.1.1.8.4.16.1.3.1";
 | 
			
		||||
      $warnlimit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.4.1";
 | 
			
		||||
      $index         = 1;
 | 
			
		||||
 | 
			
		||||
      $current   = snmp_get($device, $current_oid, "-Oqv", "") / $precision;
 | 
			
		||||
      $limit     = snmp_get($device, $limit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
 | 
			
		||||
      $lowlimit  = snmp_get($device, $lowlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
 | 
			
		||||
      $warnlimit = snmp_get($device, $warnlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
 | 
			
		||||
      $descr     = "Output Feed";
 | 
			
		||||
 | 
			
		||||
      echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, NULL, $warnlimit, $limit, $current);
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
?>
 | 
			
		||||
							
								
								
									
										38
									
								
								includes/discovery/current/gamatronicups.inc.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								includes/discovery/current/gamatronicups.inc.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
global $valid_sensor;
 | 
			
		||||
 | 
			
		||||
if ($device['os'] == "gamatronicups") {
 | 
			
		||||
 | 
			
		||||
               for($i = 1; $i <= 3 ;$i++) {
 | 
			
		||||
                       $current_oid   = "GAMATRONIC-MIB::gamatronicLTD.5.4.1.1.3.$i";
 | 
			
		||||
                       $descr = "Input Phase $i";
 | 
			
		||||
                       $current = snmp_get($device, $current_oid, "-Oqv");
 | 
			
		||||
                       $type = "gamatronicups";
 | 
			
		||||
                       $precision = 1;
 | 
			
		||||
                       $index = $i;
 | 
			
		||||
                       $lowlimit = 0;
 | 
			
		||||
                       $warnlimit = NULL;
 | 
			
		||||
                       $limit = NULL;
 | 
			
		||||
 | 
			
		||||
                       echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', $lowlimit, NULL, NULL, NULL, $current);
 | 
			
		||||
               }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
               for($i = 1; $i <= 3 ;$i++) {
 | 
			
		||||
                       $current_oid   = "GAMATRONIC-MIB::gamatronicLTD.5.5.1.1.3.$i";
 | 
			
		||||
                       $descr = "Output Phase $i";
 | 
			
		||||
                       $current = snmp_get($device, $current_oid, "-Oqv");
 | 
			
		||||
                       $type = "gamatronicups";
 | 
			
		||||
                       $precision = 1;
 | 
			
		||||
                       $index = 100+$i;
 | 
			
		||||
                       $lowlimit = 0;
 | 
			
		||||
                       $warnlimit = NULL;
 | 
			
		||||
                       $limit = NULL;
 | 
			
		||||
                       echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', $lowlimit, NULL, NULL, NULL, $current);
 | 
			
		||||
               }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
?>
 | 
			
		||||
							
								
								
									
										59
									
								
								includes/discovery/current/mgeups.inc.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								includes/discovery/current/mgeups.inc.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,59 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
global $valid_sensor;
 | 
			
		||||
 | 
			
		||||
## MGE UPS
 | 
			
		||||
if ($device['os'] == "mgeups") 
 | 
			
		||||
{
 | 
			
		||||
  echo("MGE ");
 | 
			
		||||
  $oids = trim(snmp_walk($device, "1.3.6.1.4.1.705.1.7.1", "-OsqnU"));
 | 
			
		||||
  if ($debug) { echo($oids."\n"); }
 | 
			
		||||
  list($unused,$numPhase) = explode(' ',$oids);
 | 
			
		||||
  for($i = 1; $i <= $numPhase;$i++)
 | 
			
		||||
  {
 | 
			
		||||
    unset($current);
 | 
			
		||||
    $current_oid   = ".1.3.6.1.4.1.705.1.7.2.1.5.$i";
 | 
			
		||||
    $descr      = "Output"; if ($numPhase > 1) $descr .= " Phase $i";
 | 
			
		||||
    $current    = snmp_get($device, $current_oid, "-Oqv");
 | 
			
		||||
    if (!$current)
 | 
			
		||||
    {
 | 
			
		||||
      $current_oid .= ".0";
 | 
			
		||||
      $current    = snmp_get($device, $current_oid, "-Oqv");
 | 
			
		||||
    }
 | 
			
		||||
    $current   /= 10;
 | 
			
		||||
    $type       = "mge-ups";
 | 
			
		||||
    $precision  = 10;
 | 
			
		||||
    $index      = $i;
 | 
			
		||||
    $warnlimit  = NULL;
 | 
			
		||||
    $lowlimit   = 0;
 | 
			
		||||
    $limit      = NULL;
 | 
			
		||||
    $lowwarnlimit = NULL;
 | 
			
		||||
    echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, $lowwarnlimit, $warnlimit, $limit, $current);
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
  $oids = trim(snmp_walk($device, "1.3.6.1.4.1.705.1.6.1", "-OsqnU"));
 | 
			
		||||
  if ($debug) { echo($oids."\n"); }
 | 
			
		||||
  list($unused,$numPhase) = explode(' ',$oids);
 | 
			
		||||
  for($i = 1; $i <= $numPhase;$i++)
 | 
			
		||||
  {
 | 
			
		||||
    unset($current);
 | 
			
		||||
    $current_oid   = ".1.3.6.1.4.1.705.1.6.2.1.6.$i";
 | 
			
		||||
    $descr      = "Input"; if ($numPhase > 1) $descr .= " Phase $i";
 | 
			
		||||
    $current    = snmp_get($device, $current_oid, "-Oqv");
 | 
			
		||||
    if (!$current)
 | 
			
		||||
    {
 | 
			
		||||
      $current_oid .= ".0";
 | 
			
		||||
      $current    = snmp_get($device, $current_oid, "-Oqv");
 | 
			
		||||
    }
 | 
			
		||||
    $current   /= 10;
 | 
			
		||||
    $type       = "mge-ups";
 | 
			
		||||
    $precision  = 10;
 | 
			
		||||
    $index      = 100+$i;
 | 
			
		||||
    $warnlimit  = NULL;
 | 
			
		||||
    $lowlimit   = 0;
 | 
			
		||||
    $limit      = NULL;
 | 
			
		||||
    $lowwarnlimit = NULL;
 | 
			
		||||
    echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, $lowwarnlimit, $warnlimit, $limit, $current);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
?>
 | 
			
		||||
							
								
								
									
										74
									
								
								includes/discovery/current/rfc1628.inc.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								includes/discovery/current/rfc1628.inc.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,74 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
global $valid_sensor;
 | 
			
		||||
 | 
			
		||||
## RFC1628 UPS
 | 
			
		||||
if ($device['os'] == "netmanplus" || $device['os'] == "deltaups") 
 | 
			
		||||
{
 | 
			
		||||
  echo("RFC1628 ");
 | 
			
		||||
  
 | 
			
		||||
  $oids = snmp_walk($device, "1.3.6.1.2.1.33.1.2.6", "-Osqn", "UPS-MIB");
 | 
			
		||||
  if ($debug) { echo($oids."\n"); }
 | 
			
		||||
  $oids = trim($oids);
 | 
			
		||||
  foreach(explode("\n", $oids) as $data) 
 | 
			
		||||
  {
 | 
			
		||||
    $data = trim($data);
 | 
			
		||||
    if ($data) 
 | 
			
		||||
    {
 | 
			
		||||
      list($oid,$descr) = explode(" ", $data,2);
 | 
			
		||||
      $split_oid = explode('.',$oid);
 | 
			
		||||
      $current_id = $split_oid[count($split_oid)-1];
 | 
			
		||||
      $current_oid  = "1.3.6.1.2.1.33.1.2.6.$current_id";
 | 
			
		||||
      $precision = 10;
 | 
			
		||||
      $current = snmp_get($device, $current_oid, "-O vq") / $precision;
 | 
			
		||||
      $descr = "Battery" . (count(explode("\n",$oids)) == 1 ? '' : ' ' . ($current_id+1));
 | 
			
		||||
      $type = "rfc1628";
 | 
			
		||||
      $index = 500+$current_id;
 | 
			
		||||
      echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', NULL, NULL, NULL, NULL, $current);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  $oids = trim(snmp_walk($device, "1.3.6.1.2.1.33.1.4.3.0", "-OsqnU"));
 | 
			
		||||
  if ($debug) { echo($oids."\n"); }
 | 
			
		||||
  list($unused,$numPhase) = explode(' ',$oids);
 | 
			
		||||
  for($i = 1; $i <= $numPhase;$i++)
 | 
			
		||||
  {
 | 
			
		||||
    $current_oid   = ".1.3.6.1.2.1.33.1.4.4.1.3.$i";
 | 
			
		||||
    $descr      = "Output"; if ($numPhase > 1) $descr .= " Phase $i";
 | 
			
		||||
    $current    = snmp_get($device, $current_oid, "-Oqv");
 | 
			
		||||
    $type       = "rfc1628";
 | 
			
		||||
    $precision  = 1;
 | 
			
		||||
    $index      = $i;
 | 
			
		||||
    echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', NULL, NULL, NULL, NULL, $current);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  $oids = trim(snmp_walk($device, "1.3.6.1.2.1.33.1.3.2.0", "-OsqnU"));
 | 
			
		||||
  if ($debug) { echo($oids."\n"); }
 | 
			
		||||
  list($unused,$numPhase) = explode(' ',$oids);
 | 
			
		||||
  for($i = 1; $i <= $numPhase;$i++)
 | 
			
		||||
  {
 | 
			
		||||
    $current_oid   = "1.3.6.1.2.1.33.1.3.3.1.4.$i";
 | 
			
		||||
    $descr      = "Input"; if ($numPhase > 1) $descr .= " Phase $i";
 | 
			
		||||
    $current    = snmp_get($device, $current_oid, "-Oqv");
 | 
			
		||||
    $type       = "rfc1628";
 | 
			
		||||
    $precision  = 1;
 | 
			
		||||
    $index      = 100+$i;
 | 
			
		||||
    echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', NULL, NULL, NULL, NULL, $current);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  $oids = trim(snmp_walk($device, "1.3.6.1.2.1.33.1.5.2.0", "-OsqnU"));
 | 
			
		||||
  if ($debug) { echo($oids."\n"); }
 | 
			
		||||
  list($unused,$numPhase) = explode(' ',$oids);
 | 
			
		||||
  for($i = 1; $i <= $numPhase;$i++)
 | 
			
		||||
  {
 | 
			
		||||
    $current_oid   = "1.3.6.1.2.1.33.1.5.3.1.3.$i";
 | 
			
		||||
    $descr      = "Bypass"; if ($numPhase > 1) $descr .= " Phase $i";
 | 
			
		||||
    $current    = snmp_get($device, $current_oid, "-Oqv");
 | 
			
		||||
    $type       = "rfc1628";
 | 
			
		||||
    $precision  = 1;
 | 
			
		||||
    $index      = 200+$i;
 | 
			
		||||
    echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', NULL, NULL, NULL, NULL, $current);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
@@ -1,154 +1,7 @@
 | 
			
		||||
<?php
 | 
			
		||||
echo("Frequencies : ");
 | 
			
		||||
 | 
			
		||||
## MGE UPS Frequencies
 | 
			
		||||
if ($device['os'] == "mgeups") 
 | 
			
		||||
{
 | 
			
		||||
  echo("MGE ");
 | 
			
		||||
  $oids = trim(snmp_walk($device, "1.3.6.1.4.1.705.1.7.1", "-OsqnU"));
 | 
			
		||||
  if ($debug) { echo($oids."\n"); }
 | 
			
		||||
  list($unused,$numPhase) = explode(' ',$oids);
 | 
			
		||||
  for($i = 1; $i <= $numPhase;$i++)
 | 
			
		||||
  {
 | 
			
		||||
    $freq_oid   = ".1.3.6.1.4.1.705.1.7.2.1.3.$i";
 | 
			
		||||
    $descr      = "Output"; if ($numPhase > 1) $descr .= " Phase $i";
 | 
			
		||||
    $current    = snmp_get($device, $freq_oid, "-Oqv");
 | 
			
		||||
    if (!$current)
 | 
			
		||||
    {
 | 
			
		||||
      $freq_oid .= ".0";
 | 
			
		||||
      $current    = snmp_get($device, $freq_oid, "-Oqv");
 | 
			
		||||
    }
 | 
			
		||||
    $current   /= 10;
 | 
			
		||||
    $type       = "mge-ups";
 | 
			
		||||
    $divisor  = 10;
 | 
			
		||||
    $index      = $i;
 | 
			
		||||
    echo discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
 | 
			
		||||
  }
 | 
			
		||||
  $oids = trim(snmp_walk($device, "1.3.6.1.4.1.705.1.6.1", "-OsqnU"));
 | 
			
		||||
  if ($debug) { echo($oids."\n"); }
 | 
			
		||||
  list($unused,$numPhase) = explode(' ',$oids);
 | 
			
		||||
  for($i = 1; $i <= $numPhase;$i++)
 | 
			
		||||
  {
 | 
			
		||||
    $freq_oid   = ".1.3.6.1.4.1.705.1.6.2.1.3.$i";
 | 
			
		||||
    $descr      = "Input"; if ($numPhase > 1) $descr .= " Phase $i";
 | 
			
		||||
    $current    = snmp_get($device, $freq_oid, "-Oqv");
 | 
			
		||||
    if (!$current)
 | 
			
		||||
    {
 | 
			
		||||
      $freq_oid .= ".0";
 | 
			
		||||
      $current    = snmp_get($device, $freq_oid, "-Oqv");
 | 
			
		||||
    }
 | 
			
		||||
    $current   /= 10;
 | 
			
		||||
    $type       = "mge-ups";
 | 
			
		||||
    $divisor  = 10;
 | 
			
		||||
    $index      = 100+$i;
 | 
			
		||||
    echo discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
## RFC1628
 | 
			
		||||
if ($device['os'] == "netmanplus" || $device['os'] == "deltaups") 
 | 
			
		||||
{
 | 
			
		||||
  echo("RFC1628 ");
 | 
			
		||||
  
 | 
			
		||||
  $oids = trim(snmp_walk($device, "1.3.6.1.2.1.33.1.3.2.0", "-OsqnU"));
 | 
			
		||||
  if ($debug) { echo($oids."\n"); }
 | 
			
		||||
  list($unused,$numPhase) = explode(' ',$oids);
 | 
			
		||||
  for($i = 1; $i <= $numPhase;$i++)
 | 
			
		||||
  {
 | 
			
		||||
    $freq_oid   = "1.3.6.1.2.1.33.1.3.3.1.2.$i";
 | 
			
		||||
    $descr      = "Input"; if ($numPhase > 1) $descr .= " Phase $i";
 | 
			
		||||
    $current    = snmp_get($device, $freq_oid, "-Oqv") / 10;
 | 
			
		||||
    $type       = "rfc1628";
 | 
			
		||||
    $divisor  = 10;
 | 
			
		||||
    $index      = '3.2.0.'.$i;
 | 
			
		||||
    echo discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  $freq_oid   = "1.3.6.1.2.1.33.1.4.2.0";
 | 
			
		||||
  $descr      = "Output";
 | 
			
		||||
  $current    = snmp_get($device, $freq_oid, "-Oqv") / 10;
 | 
			
		||||
  $type       = "rfc1628";
 | 
			
		||||
  $divisor  = 10;
 | 
			
		||||
  $index      = '4.2.0';
 | 
			
		||||
  echo discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
 | 
			
		||||
 | 
			
		||||
  $freq_oid   = "1.3.6.1.2.1.33.1.5.1.0";
 | 
			
		||||
  $descr      = "Bypass";
 | 
			
		||||
  $current    = snmp_get($device, $freq_oid, "-Oqv") / 10;
 | 
			
		||||
  $type       = "rfc1628";
 | 
			
		||||
  $divisor  = 10;
 | 
			
		||||
  $index      = '5.1.0';
 | 
			
		||||
  echo discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
## APC
 | 
			
		||||
if ($device['os'] == "apc") 
 | 
			
		||||
{
 | 
			
		||||
  $oids = snmp_walk($device, "1.3.6.1.4.1.318.1.1.8.5.3.2.1.4", "-OsqnU", "");
 | 
			
		||||
  if ($debug) { echo($oids."\n"); }
 | 
			
		||||
  if ($oids) echo("APC In ");
 | 
			
		||||
  $divisor = 1;
 | 
			
		||||
  $type = "apc";
 | 
			
		||||
  foreach(explode("\n", $oids) as $data) 
 | 
			
		||||
  {
 | 
			
		||||
    $data = trim($data);
 | 
			
		||||
    if ($data) 
 | 
			
		||||
    {
 | 
			
		||||
      list($oid,$current) = explode(" ", $data,2);
 | 
			
		||||
      $split_oid = explode('.',$oid);
 | 
			
		||||
      $index = $split_oid[count($split_oid)-1];
 | 
			
		||||
      $oid  = "1.3.6.1.4.1.318.1.1.8.5.3.2.1.4." . $index;
 | 
			
		||||
      $descr = "Input Feed " . chr(64+$index);
 | 
			
		||||
      discover_sensor($valid_sensor, 'freq', $device, $oid, "3.2.1.4.$index", $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  $oids = snmp_walk($device, "1.3.6.1.4.1.318.1.1.8.5.4.2.1.4", "-OsqnU", "");
 | 
			
		||||
  if ($debug) { echo($oids."\n"); }
 | 
			
		||||
  if ($oids) echo(" APC Out ");
 | 
			
		||||
  $divisor = 1;
 | 
			
		||||
  $type = "apc";
 | 
			
		||||
  foreach(explode("\n", $oids) as $data) 
 | 
			
		||||
  {
 | 
			
		||||
    $data = trim($data);
 | 
			
		||||
    if ($data) 
 | 
			
		||||
    {
 | 
			
		||||
      list($oid,$current) = explode(" ", $data,2);
 | 
			
		||||
      $split_oid = explode('.',$oid);
 | 
			
		||||
      $index = $split_oid[count($split_oid)-3];
 | 
			
		||||
      $oid  = "1.3.6.1.4.1.318.1.1.8.5.4.2.1.4." . $index;
 | 
			
		||||
      $descr = "Output Feed"; if (count(explode("\n", $oids)) > 1) { $descr .= " $index"; }
 | 
			
		||||
      discover_sensor($valid_sensor, 'freq', $device, $oid, "4.2.1.4.$index", $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  $oids = snmp_get($device, "1.3.6.1.4.1.318.1.1.1.3.2.4.0", "-OsqnU", "");
 | 
			
		||||
  if ($debug) { echo($oids."\n"); }
 | 
			
		||||
  if ($oids)
 | 
			
		||||
  {
 | 
			
		||||
    echo(" APC In ");
 | 
			
		||||
    list($oid,$current) = explode(" ",$oids);
 | 
			
		||||
    $divisor = 1;
 | 
			
		||||
    $type = "apc";
 | 
			
		||||
    $index = "3.2.4.0";
 | 
			
		||||
    $descr = "Input";
 | 
			
		||||
    discover_sensor($valid_sensor, 'freq', $device, $oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  $oids = snmp_get($device, "1.3.6.1.4.1.318.1.1.1.4.2.2.0", "-OsqnU", "");
 | 
			
		||||
  if ($debug) { echo($oids."\n"); }
 | 
			
		||||
  if ($oids)
 | 
			
		||||
  {
 | 
			
		||||
    echo(" APC Out ");
 | 
			
		||||
    list($oid,$current) = explode(" ",$oids);
 | 
			
		||||
    $divisor = 1;
 | 
			
		||||
    $type = "apc";
 | 
			
		||||
    $index = "4.2.2.0";
 | 
			
		||||
    $descr = "Output";
 | 
			
		||||
    discover_sensor($valid_sensor, 'freq', $device, $oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
echo("Frequencies: ");
 | 
			
		||||
 | 
			
		||||
include_dir("includes/discovery/frequencies");
 | 
			
		||||
 | 
			
		||||
if($debug) { print_r($valid['freq']); }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										72
									
								
								includes/discovery/frequencies/apc.inc.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								includes/discovery/frequencies/apc.inc.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,72 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
global $valid_sensor;
 | 
			
		||||
 | 
			
		||||
## APC
 | 
			
		||||
if ($device['os'] == "apc") 
 | 
			
		||||
{
 | 
			
		||||
  $oids = snmp_walk($device, "1.3.6.1.4.1.318.1.1.8.5.3.2.1.4", "-OsqnU", "");
 | 
			
		||||
  if ($debug) { echo($oids."\n"); }
 | 
			
		||||
  if ($oids) echo("APC In ");
 | 
			
		||||
  $divisor = 1;
 | 
			
		||||
  $type = "apc";
 | 
			
		||||
  foreach(explode("\n", $oids) as $data) 
 | 
			
		||||
  {
 | 
			
		||||
    $data = trim($data);
 | 
			
		||||
    if ($data) 
 | 
			
		||||
    {
 | 
			
		||||
      list($oid,$current) = explode(" ", $data,2);
 | 
			
		||||
      $split_oid = explode('.',$oid);
 | 
			
		||||
      $index = $split_oid[count($split_oid)-1];
 | 
			
		||||
      $oid  = "1.3.6.1.4.1.318.1.1.8.5.3.2.1.4." . $index;
 | 
			
		||||
      $descr = "Input Feed " . chr(64+$index);
 | 
			
		||||
      discover_sensor($valid_sensor, 'freq', $device, $oid, "3.2.1.4.$index", $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  $oids = snmp_walk($device, "1.3.6.1.4.1.318.1.1.8.5.4.2.1.4", "-OsqnU", "");
 | 
			
		||||
  if ($debug) { echo($oids."\n"); }
 | 
			
		||||
  if ($oids) echo(" APC Out ");
 | 
			
		||||
  $divisor = 1;
 | 
			
		||||
  $type = "apc";
 | 
			
		||||
  foreach(explode("\n", $oids) as $data) 
 | 
			
		||||
  {
 | 
			
		||||
    $data = trim($data);
 | 
			
		||||
    if ($data) 
 | 
			
		||||
    {
 | 
			
		||||
      list($oid,$current) = explode(" ", $data,2);
 | 
			
		||||
      $split_oid = explode('.',$oid);
 | 
			
		||||
      $index = $split_oid[count($split_oid)-3];
 | 
			
		||||
      $oid  = "1.3.6.1.4.1.318.1.1.8.5.4.2.1.4." . $index;
 | 
			
		||||
      $descr = "Output Feed"; if (count(explode("\n", $oids)) > 1) { $descr .= " $index"; }
 | 
			
		||||
      discover_sensor($valid_sensor, 'freq', $device, $oid, "4.2.1.4.$index", $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  $oids = snmp_get($device, "1.3.6.1.4.1.318.1.1.1.3.2.4.0", "-OsqnU", "");
 | 
			
		||||
  if ($debug) { echo($oids."\n"); }
 | 
			
		||||
  if ($oids)
 | 
			
		||||
  {
 | 
			
		||||
    echo(" APC In ");
 | 
			
		||||
    list($oid,$current) = explode(" ",$oids);
 | 
			
		||||
    $divisor = 1;
 | 
			
		||||
    $type = "apc";
 | 
			
		||||
    $index = "3.2.4.0";
 | 
			
		||||
    $descr = "Input";
 | 
			
		||||
    discover_sensor($valid_sensor, 'freq', $device, $oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  $oids = snmp_get($device, "1.3.6.1.4.1.318.1.1.1.4.2.2.0", "-OsqnU", "");
 | 
			
		||||
  if ($debug) { echo($oids."\n"); }
 | 
			
		||||
  if ($oids)
 | 
			
		||||
  {
 | 
			
		||||
    echo(" APC Out ");
 | 
			
		||||
    list($oid,$current) = explode(" ",$oids);
 | 
			
		||||
    $divisor = 1;
 | 
			
		||||
    $type = "apc";
 | 
			
		||||
    $index = "4.2.2.0";
 | 
			
		||||
    $descr = "Output";
 | 
			
		||||
    discover_sensor($valid_sensor, 'freq', $device, $oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
?>
 | 
			
		||||
							
								
								
									
										48
									
								
								includes/discovery/frequencies/mgeups.inc.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								includes/discovery/frequencies/mgeups.inc.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,48 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
global $valid_sensor;
 | 
			
		||||
 | 
			
		||||
## MGE UPS Frequencies
 | 
			
		||||
if ($device['os'] == "mgeups") 
 | 
			
		||||
{
 | 
			
		||||
  echo("MGE ");
 | 
			
		||||
  $oids = trim(snmp_walk($device, "1.3.6.1.4.1.705.1.7.1", "-OsqnU"));
 | 
			
		||||
  if ($debug) { echo($oids."\n"); }
 | 
			
		||||
  list($unused,$numPhase) = explode(' ',$oids);
 | 
			
		||||
  for($i = 1; $i <= $numPhase;$i++)
 | 
			
		||||
  {
 | 
			
		||||
    $freq_oid   = ".1.3.6.1.4.1.705.1.7.2.1.3.$i";
 | 
			
		||||
    $descr      = "Output"; if ($numPhase > 1) $descr .= " Phase $i";
 | 
			
		||||
    $current    = snmp_get($device, $freq_oid, "-Oqv");
 | 
			
		||||
    if (!$current)
 | 
			
		||||
    {
 | 
			
		||||
      $freq_oid .= ".0";
 | 
			
		||||
      $current    = snmp_get($device, $freq_oid, "-Oqv");
 | 
			
		||||
    }
 | 
			
		||||
    $current   /= 10;
 | 
			
		||||
    $type       = "mge-ups";
 | 
			
		||||
    $divisor  = 10;
 | 
			
		||||
    $index      = $i;
 | 
			
		||||
    echo discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
 | 
			
		||||
  }
 | 
			
		||||
  $oids = trim(snmp_walk($device, "1.3.6.1.4.1.705.1.6.1", "-OsqnU"));
 | 
			
		||||
  if ($debug) { echo($oids."\n"); }
 | 
			
		||||
  list($unused,$numPhase) = explode(' ',$oids);
 | 
			
		||||
  for($i = 1; $i <= $numPhase;$i++)
 | 
			
		||||
  {
 | 
			
		||||
    $freq_oid   = ".1.3.6.1.4.1.705.1.6.2.1.3.$i";
 | 
			
		||||
    $descr      = "Input"; if ($numPhase > 1) $descr .= " Phase $i";
 | 
			
		||||
    $current    = snmp_get($device, $freq_oid, "-Oqv");
 | 
			
		||||
    if (!$current)
 | 
			
		||||
    {
 | 
			
		||||
      $freq_oid .= ".0";
 | 
			
		||||
      $current    = snmp_get($device, $freq_oid, "-Oqv");
 | 
			
		||||
    }
 | 
			
		||||
    $current   /= 10;
 | 
			
		||||
    $type       = "mge-ups";
 | 
			
		||||
    $divisor  = 10;
 | 
			
		||||
    $index      = 100+$i;
 | 
			
		||||
    echo discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
?>
 | 
			
		||||
							
								
								
									
										40
									
								
								includes/discovery/frequencies/rfc1628.inc.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								includes/discovery/frequencies/rfc1628.inc.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
global $valid_sensor;
 | 
			
		||||
 | 
			
		||||
## RFC1628
 | 
			
		||||
if ($device['os'] == "netmanplus" || $device['os'] == "deltaups") 
 | 
			
		||||
{
 | 
			
		||||
  echo("RFC1628 ");
 | 
			
		||||
  
 | 
			
		||||
  $oids = trim(snmp_walk($device, "1.3.6.1.2.1.33.1.3.2.0", "-OsqnU"));
 | 
			
		||||
  if ($debug) { echo($oids."\n"); }
 | 
			
		||||
  list($unused,$numPhase) = explode(' ',$oids);
 | 
			
		||||
  for($i = 1; $i <= $numPhase;$i++)
 | 
			
		||||
  {
 | 
			
		||||
    $freq_oid   = "1.3.6.1.2.1.33.1.3.3.1.2.$i";
 | 
			
		||||
    $descr      = "Input"; if ($numPhase > 1) $descr .= " Phase $i";
 | 
			
		||||
    $current    = snmp_get($device, $freq_oid, "-Oqv") / 10;
 | 
			
		||||
    $type       = "rfc1628";
 | 
			
		||||
    $divisor  = 10;
 | 
			
		||||
    $index      = '3.2.0.'.$i;
 | 
			
		||||
    echo discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  $freq_oid   = "1.3.6.1.2.1.33.1.4.2.0";
 | 
			
		||||
  $descr      = "Output";
 | 
			
		||||
  $current    = snmp_get($device, $freq_oid, "-Oqv") / 10;
 | 
			
		||||
  $type       = "rfc1628";
 | 
			
		||||
  $divisor  = 10;
 | 
			
		||||
  $index      = '4.2.0';
 | 
			
		||||
  echo discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
 | 
			
		||||
 | 
			
		||||
  $freq_oid   = "1.3.6.1.2.1.33.1.5.1.0";
 | 
			
		||||
  $descr      = "Bypass";
 | 
			
		||||
  $current    = snmp_get($device, $freq_oid, "-Oqv") / 10;
 | 
			
		||||
  $type       = "rfc1628";
 | 
			
		||||
  $divisor  = 10;
 | 
			
		||||
  $index      = '5.1.0';
 | 
			
		||||
  echo discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
 | 
			
		||||
}
 | 
			
		||||
?>
 | 
			
		||||
		Reference in New Issue
	
	Block a user