mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
some formatting cleanups, introduce some more FIXMEs to look at, plus replace mysql_fetch_array by mysql_fetch_assoc, for great justice
git-svn-id: http://www.observium.org/svn/observer/trunk@2029 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
+1
-1
@@ -153,7 +153,7 @@ function getifindexbyid($id)
|
||||
function getifbyid($id)
|
||||
{
|
||||
$sql = mysql_query("SELECT * FROM `ports` WHERE `interface_id` = '$id'");
|
||||
$result = @mysql_fetch_array($sql);
|
||||
$result = @mysql_fetch_assoc($sql);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ foreach (explode("\n", $ipNetToMedia_data) as $data)
|
||||
list($oid, $mac) = explode(" ", $data);
|
||||
list($if, $first, $second, $third, $fourth) = explode(".", $oid);
|
||||
list($m_a, $m_b, $m_c, $m_d, $m_e, $m_f) = explode(":", $mac);
|
||||
$interface = mysql_fetch_array(mysql_query("SELECT * FROM ports WHERE device_id = '".$device['device_id']."' AND ifIndex = '".$if."'"));
|
||||
$interface = mysql_fetch_assoc(mysql_query("SELECT * FROM ports WHERE device_id = '".$device['device_id']."' AND ifIndex = '".$if."'"));
|
||||
$ip = $first .".". $second .".". $third .".". $fourth;
|
||||
|
||||
$m_a = zeropad($m_a);$m_b = zeropad($m_b);$m_c = zeropad($m_c);$m_d = zeropad($m_d);$m_e = zeropad($m_e);$m_f = zeropad($m_f);
|
||||
@@ -51,7 +51,7 @@ foreach (explode("\n", $ipNetToMedia_data) as $data)
|
||||
|
||||
$sql = "SELECT * from ipv4_mac AS M, ports as I WHERE M.interface_id = I.interface_id and I.device_id = '".$device['device_id']."'";
|
||||
$query = mysql_query($sql);
|
||||
while ($entry = mysql_fetch_array($query))
|
||||
while ($entry = mysql_fetch_assoc($query))
|
||||
{
|
||||
$entry_mac = $entry['mac_address'];
|
||||
$entry_if = $entry['interface_id'];
|
||||
|
||||
@@ -159,7 +159,7 @@ if ($config['enable_bgp'])
|
||||
} # os=junos
|
||||
|
||||
$af_query = mysql_query("SELECT * FROM bgpPeers_cbgp WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '".$peer['ip']."'");
|
||||
while ($entry = mysql_fetch_array($af_query))
|
||||
while ($entry = mysql_fetch_assoc($af_query))
|
||||
{
|
||||
$afi = $entry['afi'];
|
||||
$safi = $entry['safi'];
|
||||
@@ -182,7 +182,7 @@ if ($config['enable_bgp'])
|
||||
$sql = "SELECT * FROM bgpPeers AS B, devices AS D WHERE B.device_id = D.device_id AND D.device_id = '".$device['device_id']."'";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
while ($entry = mysql_fetch_array($query))
|
||||
while ($entry = mysql_fetch_assoc($query))
|
||||
{
|
||||
unset($exists);
|
||||
$i = 0;
|
||||
|
||||
@@ -13,7 +13,7 @@ if ($device['os_group'] == "ios")
|
||||
list($if, $direction, $a_a, $a_b, $a_c, $a_d, $a_e, $a_f) = explode(".", $oid);
|
||||
$oid = "$a_a.$a_b.$a_c.$a_d.$a_e.$a_f";
|
||||
unset($interface);
|
||||
$interface = mysql_fetch_array(mysql_query("SELECT * FROM ports WHERE device_id = '".$device['device_id']."' AND ifIndex = '".$if."'"));
|
||||
$interface = mysql_fetch_assoc(mysql_query("SELECT * FROM ports WHERE device_id = '".$device['device_id']."' AND ifIndex = '".$if."'"));
|
||||
$ah_a = zeropad(dechex($a_a));
|
||||
$ah_b = zeropad(dechex($a_b));
|
||||
$ah_c = zeropad(dechex($a_c));
|
||||
|
||||
@@ -52,7 +52,7 @@ if ($config['enable_pseudowires'] && $device['os_group'] == "ios")
|
||||
$sql = "SELECT * FROM pseudowires AS P, ports AS I, devices as D WHERE P.interface_id = I.interface_id AND I.device_id = D.device_id AND D.device_id = '".$device['device_id']."'";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
while ($cpw = mysql_fetch_array($query))
|
||||
while ($cpw = mysql_fetch_assoc($query))
|
||||
{
|
||||
unset($exists);
|
||||
$i = 0;
|
||||
|
||||
@@ -42,7 +42,7 @@ if ($device['os_group'] == "ios")
|
||||
}
|
||||
|
||||
$device_vlans = mysql_query("SELECT * FROM `vlans` WHERE `device_id` = '" . $device['device_id'] . "' AND `vlan_domain` = '" . $vtp_domain . "'");
|
||||
while ($dev_vlan = mysql_fetch_array($device_vlans))
|
||||
while ($dev_vlan = mysql_fetch_assoc($device_vlans))
|
||||
{
|
||||
unset($vlan_exists);
|
||||
foreach ($this_vlans as $test_vlan)
|
||||
|
||||
@@ -49,7 +49,7 @@ if ($device['os_group'] == "ios" || $device['os_group'] == "junos" || $device['o
|
||||
echo(" ( ");
|
||||
foreach (explode("\n", $ports) as $if_id)
|
||||
{
|
||||
$interface = mysql_fetch_array(mysql_query("SELECT * FROM ports WHERE ifIndex = '$if_id' AND device_id = '" . $device['device_id'] . "'"));
|
||||
$interface = mysql_fetch_assoc(mysql_query("SELECT * FROM ports WHERE ifIndex = '$if_id' AND device_id = '" . $device['device_id'] . "'"));
|
||||
echo(makeshortif($interface['ifDescr']) . " ");
|
||||
mysql_query("UPDATE ports SET ifVrf = '".$vrf_id."' WHERE interface_id = '".$interface['interface_id']."'");
|
||||
$if = $interface['interface_id'];
|
||||
@@ -61,7 +61,7 @@ if ($device['os_group'] == "ios" || $device['os_group'] == "junos" || $device['o
|
||||
|
||||
$sql = "SELECT * FROM ports WHERE device_id = '" . $device['device_id'] . "'";
|
||||
$data = mysql_query($sql);
|
||||
while ($row = mysql_fetch_array($data))
|
||||
while ($row = mysql_fetch_assoc($data))
|
||||
{
|
||||
$if = $row['interface_id'];
|
||||
$vrf_id = $row['ifVrf'];
|
||||
@@ -81,7 +81,7 @@ if ($device['os_group'] == "ios" || $device['os_group'] == "junos" || $device['o
|
||||
|
||||
$sql = "SELECT * FROM vrfs WHERE device_id = '" . $device['device_id'] . "'";
|
||||
$data = mysql_query($sql);
|
||||
while ($row = mysql_fetch_array($data))
|
||||
while ($row = mysql_fetch_assoc($data))
|
||||
{
|
||||
$vrf_id = $row['vrf_id'];
|
||||
if (!$valid_vrf[$vrf_id])
|
||||
|
||||
@@ -13,7 +13,7 @@ if ($device['os'] == "ironware")
|
||||
unset($fdp_links);
|
||||
foreach (array_keys($fdp_array) as $key)
|
||||
{
|
||||
$interface = mysql_fetch_array(mysql_query("SELECT * FROM `ports` WHERE device_id = '".$device['device_id']."' AND `ifIndex` = '".$key."'"));
|
||||
$interface = mysql_fetch_assoc(mysql_query("SELECT * FROM `ports` WHERE device_id = '".$device['device_id']."' AND `ifIndex` = '".$key."'"));
|
||||
$fdp_if_array = $fdp_array[$key];
|
||||
foreach (array_keys($fdp_if_array) as $entry_key)
|
||||
{
|
||||
@@ -40,7 +40,7 @@ if ($cdp_array)
|
||||
unset($cdp_links);
|
||||
foreach (array_keys($cdp_array) as $key)
|
||||
{
|
||||
$interface = mysql_fetch_array(mysql_query("SELECT * FROM `ports` WHERE device_id = '".$device['device_id']."' AND `ifIndex` = '".$key."'"));
|
||||
$interface = mysql_fetch_assoc(mysql_query("SELECT * FROM `ports` WHERE device_id = '".$device['device_id']."' AND `ifIndex` = '".$key."'"));
|
||||
$cdp_if_array = $cdp_array[$key];
|
||||
foreach (array_keys($cdp_if_array) as $entry_key)
|
||||
{
|
||||
@@ -81,7 +81,7 @@ if ($lldp_array)
|
||||
} else {
|
||||
$ifIndex = $entry_key;
|
||||
}
|
||||
$interface = mysql_fetch_array(mysql_query("SELECT * FROM `ports` WHERE device_id = '".$device['device_id']."' AND `ifIndex` = '".$ifIndex."'"));
|
||||
$interface = mysql_fetch_assoc(mysql_query("SELECT * FROM `ports` WHERE device_id = '".$device['device_id']."' AND `ifIndex` = '".$ifIndex."'"));
|
||||
$lldp_instance = $lldp_if_array[$entry_key];
|
||||
foreach (array_keys($lldp_instance) as $entry_instance)
|
||||
{
|
||||
@@ -108,7 +108,7 @@ if ($debug) { print_r($link_exists); }
|
||||
$sql = "SELECT * FROM `links` AS L, `ports` AS I WHERE L.local_interface_id = I.interface_id AND I.device_id = '".$device['device_id']."'";
|
||||
if ($query = mysql_query($sql))
|
||||
{
|
||||
while ($test = mysql_fetch_array($query))
|
||||
while ($test = mysql_fetch_assoc($query))
|
||||
{
|
||||
$local_interface_id = $test['local_interface_id'];
|
||||
$remote_hostname = $test['remote_hostname'];
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
|
||||
$sql = "SELECT * FROM `entPhysical` WHERE `device_id` = '".$device['device_id']."'";
|
||||
$query = mysql_query($sql);
|
||||
while ($test = mysql_fetch_array($query)) {
|
||||
while ($test = mysql_fetch_assoc($query)) {
|
||||
$id = $test['entPhysicalIndex'];
|
||||
if (!$valid[$id]) {
|
||||
echo("-");
|
||||
|
||||
@@ -45,7 +45,7 @@ if (is_array($hrDevices))
|
||||
$sql = "SELECT * FROM `hrDevice` WHERE `device_id` = '".$device['device_id']."'";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
while ($test_hrDevice = mysql_fetch_array($query))
|
||||
while ($test_hrDevice = mysql_fetch_assoc($query))
|
||||
{
|
||||
if (!$valid_hrDevice[$test_hrDevice['hrDeviceIndex']])
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@ foreach (explode("\n", $oids) as $data)
|
||||
$sql = "SELECT * FROM ipv4_addresses AS A, ports AS I WHERE I.device_id = '".$device['device_id']."' AND A.interface_id = I.interface_id";
|
||||
$data = mysql_query($sql);
|
||||
|
||||
while ($row = mysql_fetch_array($data))
|
||||
while ($row = mysql_fetch_assoc($data))
|
||||
{
|
||||
$full_address = $row['ipv4_address'] . "/" . $row['ipv4_prefixlen'] . "|" . $row['ifIndex'];
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ if (!$oids)
|
||||
$sql = "SELECT * FROM ipv6_addresses AS A, ports AS I WHERE I.device_id = '".$device['device_id']."' AND A.interface_id = I.interface_id";
|
||||
$data = mysql_query($sql);
|
||||
|
||||
while ($row = mysql_fetch_array($data))
|
||||
while ($row = mysql_fetch_assoc($data))
|
||||
{
|
||||
$full_address = $row['ipv6_address'] . "/" . $row['ipv6_prefixlen'];
|
||||
$interface_id = $row['interface_id'];
|
||||
|
||||
@@ -35,7 +35,7 @@ if ($device['os'] == "junose" && $config['enable_ports_junoseatmvp'])
|
||||
|
||||
if ($debug) { print_r ($valid_vp); }
|
||||
|
||||
while ($test = mysql_fetch_array($query))
|
||||
while ($test = mysql_fetch_assoc($query))
|
||||
{
|
||||
$interface_id = $test['interface_id'];
|
||||
$vp_id = $test['vp_id'];
|
||||
|
||||
@@ -11,7 +11,7 @@ $query = mysql_query($sql);
|
||||
|
||||
if ($debug) { print_r ($valid_mempool); }
|
||||
|
||||
while ($test_mempool = mysql_fetch_array($query))
|
||||
while ($test_mempool = mysql_fetch_assoc($query))
|
||||
{
|
||||
$mempool_index = $test_mempool['mempool_index'];
|
||||
$mempool_type = $test_mempool['mempool_type'];
|
||||
|
||||
@@ -75,7 +75,7 @@ foreach (explode("\n", $ports) as $entry)
|
||||
$sql = "SELECT * FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `deleted` = '0'";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
while ($test_if = mysql_fetch_array($query))
|
||||
while ($test_if = mysql_fetch_assoc($query))
|
||||
{
|
||||
unset($exists);
|
||||
$i = 0;
|
||||
|
||||
@@ -15,7 +15,7 @@ $query = mysql_query($sql);
|
||||
|
||||
if ($debug) { print_r ($valid_processor); }
|
||||
|
||||
while ($test_processor = mysql_fetch_array($query))
|
||||
while ($test_processor = mysql_fetch_assoc($query))
|
||||
{
|
||||
$processor_index = $test_processor['processor_index'];
|
||||
$processor_type = $test_processor['processor_type'];
|
||||
|
||||
@@ -35,7 +35,7 @@ if ($vlanversion == 'version1')
|
||||
}
|
||||
|
||||
$device_vlans = mysql_query("SELECT * FROM `vlans` WHERE `device_id` = '" . $device['device_id'] . "'");
|
||||
while ($dev_vlan = mysql_fetch_array($device_vlans))
|
||||
while ($dev_vlan = mysql_fetch_assoc($device_vlans))
|
||||
{
|
||||
unset($vlan_exists);
|
||||
foreach ($this_vlans as $test_vlan)
|
||||
|
||||
@@ -11,7 +11,7 @@ $query = mysql_query($sql);
|
||||
|
||||
if ($debug) { print_r ($valid_storage); }
|
||||
|
||||
while ($test_storage = mysql_fetch_array($query))
|
||||
while ($test_storage = mysql_fetch_assoc($query))
|
||||
{
|
||||
$storage_index = $test_storage['storage_index'];
|
||||
$storage_mib = $test_storage['storage_mib'];
|
||||
|
||||
@@ -49,7 +49,7 @@ if ($config['enable_printers'])
|
||||
$sql = "SELECT * FROM toner WHERE device_id = '".$device['device_id']."'";
|
||||
if ($query = mysql_query($sql))
|
||||
{
|
||||
while ($test_toner = mysql_fetch_array($query))
|
||||
while ($test_toner = mysql_fetch_assoc($query))
|
||||
{
|
||||
$toner_index = $test_toner['toner_index'];
|
||||
$toner_type = $test_toner['toner_type'];
|
||||
|
||||
@@ -37,7 +37,7 @@ $query = mysql_query($sql);
|
||||
|
||||
if ($debug) { print_r ($valid_diskio); }
|
||||
|
||||
while ($test = mysql_fetch_array($query))
|
||||
while ($test = mysql_fetch_assoc($query))
|
||||
{
|
||||
if ($debug) { echo($test['diskio_index'] . " -> " . $test['diskio_descr'] . "\n"); }
|
||||
if (!$valid_diskio[$test['diskio_index']])
|
||||
|
||||
@@ -89,7 +89,7 @@ if ($device['os'] == "vmware")
|
||||
|
||||
$db_vm_list = mysql_query("SELECT id, vmwVmVMID FROM vmware_vminfo WHERE device_id = '" . $device["device_id"] . "'");
|
||||
|
||||
while ($db_vm = mysql_fetch_array($db_vm_list))
|
||||
while ($db_vm = mysql_fetch_assoc($db_vm_list))
|
||||
{
|
||||
/*
|
||||
* Delete the Virtual Machines that are removed from the host.
|
||||
|
||||
@@ -59,7 +59,7 @@ function device_array($device_id)
|
||||
{
|
||||
$sql = "SELECT * FROM `devices` WHERE `device_id` = '".$device_id."'";
|
||||
$query = mysql_query($sql);
|
||||
$device = mysql_fetch_array($query);
|
||||
$device = mysql_fetch_assoc($query);
|
||||
return $device;
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ function getImage($host)
|
||||
{
|
||||
global $config;
|
||||
$sql = "SELECT * FROM `devices` WHERE `device_id` = '$host'";
|
||||
$data = mysql_fetch_array(mysql_query($sql));
|
||||
$data = mysql_fetch_assoc(mysql_query($sql));
|
||||
$type = strtolower($data['os']);
|
||||
if ($config['os'][$type]['icon'] && file_exists($config['html_dir'] . "/images/os/" . $config['os'][$type]['icon'] . ".png"))
|
||||
{
|
||||
@@ -173,7 +173,7 @@ function delete_device($id)
|
||||
$host = mysql_result(mysql_query("SELECT hostname FROM devices WHERE device_id = '$id'"), 0);
|
||||
mysql_query("DELETE FROM `devices` WHERE `device_id` = '$id'");
|
||||
$int_query = mysql_query("SELECT * FROM `ports` WHERE `device_id` = '$id'");
|
||||
while ($int_data = mysql_fetch_array($int_query))
|
||||
while ($int_data = mysql_fetch_assoc($int_query))
|
||||
{
|
||||
$int_if = $int_data['ifDescr'];
|
||||
$int_id = $int_data['interface_id'];
|
||||
|
||||
@@ -7,7 +7,7 @@ $app_data = mysql_query($sql);
|
||||
if (mysql_affected_rows())
|
||||
{
|
||||
echo('Applications: ');
|
||||
while ($app = mysql_fetch_array($app_data))
|
||||
while ($app = mysql_fetch_assoc($app_data))
|
||||
{
|
||||
$app_include = $config['install_dir'].'/includes/polling/applications/'.$app['app_type'].'.inc.php';
|
||||
if (is_file($app_include))
|
||||
|
||||
@@ -9,7 +9,7 @@ if (!$config['enable_bgp'])
|
||||
else
|
||||
{
|
||||
$peers = mysql_query("SELECT * FROM bgpPeers WHERE device_id = '" . $device['device_id'] . "'");
|
||||
while ($peer = mysql_fetch_array($peers))
|
||||
while ($peer = mysql_fetch_assoc($peers))
|
||||
{
|
||||
### Poll BGP Peer
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
$query = "SELECT * FROM entPhysical WHERE device_id = '" . $device['device_id'] . "' AND entPhysicalClass = 'sensor'";
|
||||
$sensors = mysql_query($query);
|
||||
while ($sensor = mysql_fetch_array($sensors))
|
||||
while ($sensor = mysql_fetch_assoc($sensors))
|
||||
{
|
||||
echo("Checking Entity Sensor " . $sensor['entPhysicalName'] . " - " . $sensor['cempsensorName']);
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
$query = "SELECT * FROM sensors WHERE sensor_class='current' AND device_id = '" . $device['device_id'] . "' AND poller_type='snmp'";
|
||||
$current_data = mysql_query($query);
|
||||
while ($dbcurrent = mysql_fetch_array($current_data))
|
||||
while ($dbcurrent = mysql_fetch_assoc($current_data))
|
||||
{
|
||||
echo("Checking current " . $dbcurrent['sensor_descr'] . "... ");
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
$query = "SELECT * FROM sensors WHERE sensor_class='fanspeed' AND device_id = '" . $device['device_id'] . "' AND poller_type='snmp'";
|
||||
$fan_data = mysql_query($query);
|
||||
|
||||
while ($fanspeed = mysql_fetch_array($fan_data))
|
||||
while ($fanspeed = mysql_fetch_assoc($fan_data))
|
||||
{
|
||||
echo("Checking fan " . $fanspeed['sensor_descr'] . "... ");
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
$query = "SELECT * FROM `sensors` WHERE device_id = '" . $device['device_id'] . "' AND `sensor_class` = 'freq' AND poller_type='snmp'";
|
||||
$sensor_data = mysql_query($query);
|
||||
|
||||
while ($sensor = mysql_fetch_array($sensor_data))
|
||||
while ($sensor = mysql_fetch_assoc($sensor_data))
|
||||
{
|
||||
echo("Checking frequency " . $sensor['sensor_descr'] . "... ");
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
$query = "SELECT * FROM sensors WHERE sensor_class='humidity' AND device_id = '" . $device['device_id'] . "' AND poller_type='snmp'";
|
||||
$hum_data = mysql_query($query);
|
||||
while ($humidity = mysql_fetch_array($hum_data))
|
||||
while ($humidity = mysql_fetch_assoc($hum_data))
|
||||
{
|
||||
echo("Checking humidity " . $humidity['sensor_descr'] . "... ");
|
||||
|
||||
|
||||
@@ -16,9 +16,9 @@ if ($device['os_group'] == "ios") {
|
||||
}
|
||||
|
||||
$interface_query = mysql_query("SELECT * FROM `ports` $where");
|
||||
while ($interface = mysql_fetch_array($interface_query)) {
|
||||
while ($interface = mysql_fetch_assoc($interface_query)) {
|
||||
|
||||
if (!$device) { $device = mysql_fetch_array(mysql_query("SELECT * FROM `devices` WHERE `device_id` = '" . $interface['device_id'] . "'")); }
|
||||
if (!$device) { $device = mysql_fetch_assoc(mysql_query("SELECT * FROM `devices` WHERE `device_id` = '" . $interface['device_id'] . "'")); }
|
||||
|
||||
unset($ifAdminStatus, $ifOperStatus, $ifAlias, $ifDescr);
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ if ($ipmi['host'] = get_dev_attrib($device,'ipmi_hostname'))
|
||||
$ipmi_sensor[$desc][$ipmi_unit[$type]]['unit'] = $type;
|
||||
}
|
||||
|
||||
while ($ipmisensors = mysql_fetch_array($ipmi_data))
|
||||
while ($ipmisensors = mysql_fetch_assoc($ipmi_data))
|
||||
{
|
||||
echo("Updating IPMI sensor " . $ipmisensors['sensor_descr'] . "... ");
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ if (mysql_affected_rows())
|
||||
|
||||
echo("Checking JunOSe ATM vps: ");
|
||||
|
||||
while ($vp=mysql_fetch_array($vp_data))
|
||||
while ($vp = mysql_fetch_assoc($vp_data))
|
||||
{
|
||||
echo(".");
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
$query = "SELECT * FROM mempools WHERE device_id = '" . $device['device_id'] . "'";
|
||||
$mempool_data = mysql_query($query);
|
||||
while ($mempool = mysql_fetch_array($mempool_data))
|
||||
while ($mempool = mysql_fetch_assoc($mempool_data))
|
||||
{
|
||||
echo("Mempool ". $mempool['mempool_descr'] . ": ");
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ echo("VMware VM: ");
|
||||
|
||||
$db_info_list = mysql_query("SELECT id, vmwVmVMID, vmwVmDisplayName, vmwVmGuestOS, vmwVmMemSize, vmwVmCpus, vmwVmState FROM vmware_vminfo WHERE device_id = '" . $device["device_id"] . "'");
|
||||
|
||||
while ($db_info = mysql_fetch_array($db_info_list))
|
||||
while ($db_info = mysql_fetch_assoc($db_info_list))
|
||||
{
|
||||
/*
|
||||
* Fetch the Virtual Machine information.
|
||||
|
||||
@@ -102,7 +102,7 @@ if ($debug) { print_r($port_stats); }
|
||||
|
||||
/// Loop ports in the DB and update where necessary
|
||||
$port_query = mysql_query("SELECT * FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `deleted` = 0");
|
||||
while ($port = mysql_fetch_array($port_query))
|
||||
while ($port = mysql_fetch_assoc($port_query))
|
||||
{
|
||||
echo("Port " . $port['ifDescr'] . " ");
|
||||
if ($port_stats[$port['ifIndex']] && $port['disabled'] != "1")
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
$query = "SELECT * FROM processors WHERE device_id = '" . $device['device_id'] . "'";
|
||||
$proc_data = mysql_query($query);
|
||||
while ($processor = mysql_fetch_array($proc_data))
|
||||
while ($processor = mysql_fetch_assoc($proc_data))
|
||||
{
|
||||
echo("Processor " . $processor['processor_descr'] . "... ");
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ $storage_cache = array();
|
||||
|
||||
$query = "SELECT * FROM storage WHERE device_id = '" . $device['device_id'] . "'";
|
||||
$storage_data = mysql_query($query);
|
||||
while ($storage = mysql_fetch_array($storage_data))
|
||||
while ($storage = mysql_fetch_assoc($storage_data))
|
||||
{
|
||||
echo("Storage ".$storage['storage_descr'] . ": ");
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
$query = "SELECT * FROM sensors WHERE sensor_class='temperature' AND device_id = '" . $device['device_id'] . "' AND poller_type='snmp'";
|
||||
$temp_data = mysql_query($query);
|
||||
while ($temperature = mysql_fetch_array($temp_data))
|
||||
while ($temperature = mysql_fetch_assoc($temp_data))
|
||||
{
|
||||
echo("Checking temp " . $temperature['sensor_descr'] . "... ");
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ if ($config['enable_printers'])
|
||||
$query = "SELECT * FROM toner WHERE device_id = '" . $device['device_id'] . "'";
|
||||
$toner_data = mysql_query($query);
|
||||
|
||||
while ($toner = mysql_fetch_array($toner_data))
|
||||
while ($toner = mysql_fetch_assoc($toner_data))
|
||||
{
|
||||
echo("Checking toner " . $toner['toner_descr'] . "... ");
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ if (mysql_affected_rows())
|
||||
|
||||
echo("Checking UCD DiskIO MIB: ");
|
||||
|
||||
while ($diskio = mysql_fetch_array($diskio_data))
|
||||
while ($diskio = mysql_fetch_assoc($diskio_data))
|
||||
{
|
||||
$index = $diskio['diskio_index'];
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
$query = "SELECT * FROM sensors WHERE sensor_class='voltage' AND device_id = '" . $device['device_id'] . "' AND poller_type='snmp'";
|
||||
$volt_data = mysql_query($query);
|
||||
|
||||
while ($sensor = mysql_fetch_array($volt_data))
|
||||
while ($sensor = mysql_fetch_assoc($volt_data))
|
||||
{
|
||||
echo("Checking voltage " . $sensor['sensor_descr'] . "... ");
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$interface = mysql_fetch_array(mysql_query("SELECT * FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '".$entry[2]."'"));
|
||||
$interface = mysql_fetch_assoc(mysql_query("SELECT * FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '".$entry[2]."'"));
|
||||
|
||||
if (!$interface) { exit; }
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$interface = mysql_fetch_array(mysql_query("SELECT * FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '".$entry[2]."'"));
|
||||
$interface = mysql_fetch_assoc(mysql_query("SELECT * FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '".$entry[2]."'"));
|
||||
|
||||
if (!$interface) { exit; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user