mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00: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:
@@ -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'] . "... ");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user