mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	make sure capacity oid actually ends up in database for already existing toner
git-svn-id: http://www.observium.org/svn/observer/trunk@3140 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
		@@ -38,9 +38,6 @@ $config['auth_mechanism'] = "mysql"; # default, other options: ldap, http-auth
 | 
			
		||||
$config['nets'][] = "172.22.0.0/16";
 | 
			
		||||
$config['nets'][] = "192.168.0.0/24";
 | 
			
		||||
 | 
			
		||||
### Use the new Unix Agent (ALPHA)
 | 
			
		||||
$config['poller_modules']['unix-agent']                   = 0;
 | 
			
		||||
 | 
			
		||||
include("includes/static-config.php");
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
 
 | 
			
		||||
@@ -465,13 +465,13 @@ function discover_mempool(&$valid, $device, $index, $type, $descr, $precision =
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function discover_toner(&$valid, $device, $oid, $capacity_oid, $index, $type, $descr, $capacity = NULL, $current = NULL)
 | 
			
		||||
function discover_toner(&$valid, $device, $oid, $index, $type, $descr, $capacity_oid = NULL, $capacity = NULL, $current = NULL)
 | 
			
		||||
{
 | 
			
		||||
  global $config, $debug;
 | 
			
		||||
 | 
			
		||||
  if ($debug) { echo("$oid, $index, $type, $descr, $capacity\n"); }
 | 
			
		||||
  if ($debug) { echo("$oid, $index, $type, $descr, $capacity, $capacity_oid\n"); }
 | 
			
		||||
 | 
			
		||||
  if (mysql_result(mysql_query("SELECT count(toner_id) FROM `toner` WHERE device_id = '".$device['device_id']."' AND toner_type = '$type' AND `toner_index` = '$index'"),0) == '0')
 | 
			
		||||
  if (mysql_result(mysql_query("SELECT count(toner_id) FROM `toner` WHERE device_id = '".$device['device_id']."' AND toner_type = '$type' AND `toner_index` = '$index' AND `toner_capacity_oid` = '$capacity_oid'"),0) == '0')
 | 
			
		||||
  {
 | 
			
		||||
    $query = "INSERT INTO toner (`device_id`, `toner_oid`, `toner_capacity_oid`, `toner_index`, `toner_type`, `toner_descr`, `toner_capacity`, `toner_current`) ";
 | 
			
		||||
    $query .= " VALUES ('".$device['device_id']."', '$oid', '$capacity_oid', '$index', '$type', '$descr', '$capacity', '$current')";
 | 
			
		||||
@@ -482,7 +482,7 @@ function discover_toner(&$valid, $device, $oid, $capacity_oid, $index, $type, $d
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    $toner_entry = mysql_fetch_assoc(mysql_query("SELECT * FROM `toner` WHERE device_id = '".$device['device_id']."' AND toner_type = '$type' AND `toner_index` = '$index'"));
 | 
			
		||||
    if ($oid == $toner_entry['toner_oid'] && $descr == $toner_entry['toner_descr'] && $capacity == $toner_entry['toner_capacity'])
 | 
			
		||||
    if ($oid == $toner_entry['toner_oid'] && $descr == $toner_entry['toner_descr'] && $capacity == $toner_entry['toner_capacity'] && $capacity_oid == $toner_entry['toner_capacity_oid'])
 | 
			
		||||
    {
 | 
			
		||||
      echo(".");
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -36,7 +36,7 @@ if ($config['enable_printers'])
 | 
			
		||||
            $current       = $current / $capacity * 100;
 | 
			
		||||
            $type          = "jetdirect";
 | 
			
		||||
            if (isHexString($descr)) { $descr = snmp_hexstring($descr); }
 | 
			
		||||
            discover_toner($valid_toner,$device, $toner_oid, $capacity_oid, $index, $type, $descr, $capacity, $current);
 | 
			
		||||
            discover_toner($valid_toner,$device, $toner_oid, $index, $type, $descr, $capacity_oid, $capacity, $current);
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user