mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
more db*
git-svn-id: http://www.observium.org/svn/observer/trunk@2324 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
<?php
|
||||
|
||||
$query = mysql_query("SELECT * FROM `applications` WHERE `device_id` = '".$device['device_id']."'");
|
||||
|
||||
print_optionbar_start();
|
||||
|
||||
unset($sep);
|
||||
|
||||
while ($app = mysql_fetch_assoc($query))
|
||||
foreach (dbFetchRows("SELECT * FROM `applications` WHERE `device_id` = ?", array($device['device_id'])) as $app)
|
||||
{
|
||||
echo($sep);
|
||||
|
||||
@@ -26,7 +24,7 @@ while ($app = mysql_fetch_assoc($query))
|
||||
|
||||
print_optionbar_end();
|
||||
|
||||
$app = mysql_fetch_assoc(mysql_query("SELECT * FROM `applications` WHERE `device_id` = '".$device['device_id']."' AND `app_type` = '".$_GET['opta']."'"));
|
||||
$app = dbFetchRow("SELECT * FROM `applications` WHERE `device_id` = ? AND `app_type` = ?", array($device['device_id'], $_GET['opta']));
|
||||
|
||||
if (is_file("pages/device/apps/".mres($_GET['opta']).".inc.php"))
|
||||
{
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
|
||||
print_optionbar_start();
|
||||
|
||||
unset ($sep);
|
||||
$query = mysql_query("SELECT `entSensorType` FROM `entPhysical` WHERE device_id = '".$device['device_id']."' AND entSensorType != '' AND entSensorType NOT LIKE 'No%' GROUP BY `entSensorType` ORDER BY `entSensorType`");
|
||||
while ($data = mysql_fetch_assoc($query))
|
||||
{
|
||||
$type = $data['entSensorType'];
|
||||
if (!$_GET['opta']) { $_GET['opta'] = $type; }
|
||||
echo($sep);
|
||||
if ($_GET['opta'] == $type) { echo("<strong>"); }
|
||||
echo("<a href='device/" . $device['device_id'] . "/ciscosensors/" . $type . "/'>" . htmlspecialchars($type) ."</a>\n");
|
||||
if ($_GET['opta'] == $type) { echo("</strong>"); }
|
||||
$sep = ' | ';
|
||||
}
|
||||
|
||||
unset ($sep);
|
||||
|
||||
print_optionbar_end();
|
||||
|
||||
$query = mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$device['device_id']."' and entSensorType = '".$_GET['opta']."' ORDER BY `entPhysicalName`");
|
||||
while ($data = mysql_fetch_assoc($query))
|
||||
{
|
||||
if ($data['entSensorMeasuredEntity'])
|
||||
{
|
||||
$measured = mysql_fetch_assoc(mysql_query("SELECT * FROM entPhysical WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '".$data['entSensorMeasuredEntity']."'"));
|
||||
}
|
||||
|
||||
echo("<div><h3>".$measured['entPhysicalName']." ".$data['entPhysicalName']."</h3>");
|
||||
$graph_type = "cisco_entity_sensor";
|
||||
$args = "&a=".$data['entPhysical_id'];
|
||||
|
||||
include("includes/print-device-graph.php");
|
||||
|
||||
echo("</div>");
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -4,8 +4,8 @@ function printEntPhysical($ent, $level, $class)
|
||||
{
|
||||
global $device;
|
||||
|
||||
$query = mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$device['device_id']."' AND entPhysicalContainedIn = '".$ent."' ORDER BY entPhysicalContainedIn,entPhysicalIndex");
|
||||
while ($ent = mysql_fetch_assoc($query))
|
||||
$ents = dbFetchRows("SELECT * FROM `entPhysical` WHERE device_id = ? AND entPhysicalContainedIn = ? ORDER BY entPhysicalContainedIn,entPhysicalIndex", array($device['device_id'], $ent));
|
||||
foreach ($ents as $ent)
|
||||
{
|
||||
echo("
|
||||
<li class='$class'>");
|
||||
@@ -28,7 +28,7 @@ function printEntPhysical($ent, $level, $class)
|
||||
|
||||
if ($ent['ifIndex'])
|
||||
{
|
||||
$interface = mysql_fetch_assoc(mysql_query("SELECT * FROM `ports` WHERE ifIndex = '".$ent['ifIndex']."' AND device_id = '".$device['device_id']."'"));
|
||||
$interface = dbFetchRow("SELECT * FROM `ports` WHERE ifIndex = ? AND device_id = ?", array($ent['ifIndex'], $device['device_id']));
|
||||
$ent['entPhysicalName'] = generate_port_link($interface);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ function printEntPhysical($ent, $level, $class)
|
||||
|
||||
echo("</div>");
|
||||
|
||||
$count = mysql_result(mysql_query("SELECT COUNT(*) FROM `entPhysical` WHERE device_id = '".$device['device_id']."' AND entPhysicalContainedIn = '".$ent['entPhysicalIndex']."'"),0);
|
||||
$count = dbFetchCell("SELECT COUNT(*) FROM `entPhysical` WHERE device_id = '".$device['device_id']."' AND entPhysicalContainedIn = '".$ent['entPhysicalIndex']."'");
|
||||
if ($count)
|
||||
{
|
||||
echo("<ul>");
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
<?php
|
||||
|
||||
$query = "SELECT *,DATE_FORMAT(datetime, '%D %b %Y %T') as humandate FROM `eventlog` WHERE `host` = '$_GET[id]' ORDER BY `datetime` DESC LIMIT 0,250";
|
||||
$data = mysql_query($query);
|
||||
$entries = dbFetchRows("SELECT *,DATE_FORMAT(datetime, '%D %b %Y %T') as humandate FROM `eventlog` WHERE `host` = ? ORDER BY `datetime` DESC LIMIT 0,250", array($device['device_id']));
|
||||
echo('<table cellspacing="0" cellpadding="2" width="100%">');
|
||||
|
||||
while ($entry = mysql_fetch_assoc($data))
|
||||
foreach ($entries as $entry)
|
||||
{
|
||||
include("includes/print-event.inc.php");
|
||||
}
|
||||
|
||||
echo('</table>');
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -12,9 +12,8 @@ print_optionbar_start('', '');
|
||||
echo("<span style='font-weight: bold;'>Graphs</span> » ");
|
||||
|
||||
$sep = "";
|
||||
$query = mysql_query("SELECT * FROM device_graphs WHERE device_id = '".$device['device_id']."'");
|
||||
|
||||
while ($graph = mysql_fetch_assoc($query))
|
||||
foreach (dbFetchRows("SELECT * FROM device_graphs WHERE device_id = ?", array($device['device_id'])) as $graph)
|
||||
{
|
||||
$section = $config['graph_types']['device'][$graph['graph']]['section'];
|
||||
$graph_enable[$section][$graph['graph']] = $graph['graph'];
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<?php
|
||||
|
||||
$storage = mysql_result(mysql_query("select count(*) from storage WHERE device_id = '" . $device['device_id'] . "'"), 0);
|
||||
$diskio = mysql_result(mysql_query("select count(*) from ucd_diskio WHERE device_id = '" . $device['device_id'] . "'"), 0);
|
||||
$mempools = mysql_result(mysql_query("select count(*) from mempools WHERE device_id = '" . $device['device_id'] . "'"), 0);
|
||||
$processor = mysql_result(mysql_query("select count(*) from processors WHERE device_id = '" . $device['device_id'] . "'"), 0);
|
||||
$storage = dbFetchCell("select count(*) from storage WHERE device_id = ?", array($device['device_id']));
|
||||
$diskio = dbFetchCell("select count(*) from ucd_diskio WHERE device_id = ?", array($device['device_id']));
|
||||
$mempools = dbFetchCell("select count(*) from mempools WHERE device_id = ?", array($device['device_id']));
|
||||
$processor = dbFetchCell("select count(*) from processors WHERE device_id = ?", array($device['device_id']));
|
||||
|
||||
$temperatures = mysql_result(mysql_query("select count(*) from sensors WHERE sensor_class='temperature' AND device_id = '" . $device['device_id'] . "'"), 0);
|
||||
$humidity = mysql_result(mysql_query("select count(*) from sensors WHERE sensor_class='humidity' AND device_id = '" . $device['device_id'] . "'"), 0);
|
||||
$fans = mysql_result(mysql_query("select count(*) from sensors WHERE sensor_class='fanspeed' AND device_id = '" . $device['device_id'] . "'"), 0);
|
||||
$volts = mysql_result(mysql_query("select count(*) from sensors WHERE sensor_class='voltage' AND device_id = '" . $device['device_id'] . "'"), 0);
|
||||
$current = mysql_result(mysql_query("select count(*) from sensors WHERE sensor_class='current' AND device_id = '" . $device['device_id'] . "'"), 0);
|
||||
$freqs = mysql_result(mysql_query("select count(*) from sensors WHERE sensor_class='frequency' AND device_id = '" . $device['device_id'] . "'"), 0);
|
||||
$power = mysql_result(mysql_query("select count(*) from sensors WHERE sensor_class='power' AND device_id = '" . $device['device_id'] . "'"), 0);
|
||||
$temperatures = dbFetchCell("select count(*) from sensors WHERE sensor_class='temperature' AND device_id = ?", array($device['device_id']));
|
||||
$humidity = dbFetchCell("select count(*) from sensors WHERE sensor_class='humidity' AND device_id = ?", array($device['device_id']));
|
||||
$fans = dbFetchCell("select count(*) from sensors WHERE sensor_class='fanspeed' AND device_id = ?", array($device['device_id']));
|
||||
$volts = dbFetchCell("select count(*) from sensors WHERE sensor_class='voltage' AND device_id = ?", array($device['device_id']));
|
||||
$current = dbFetchCell("select count(*) from sensors WHERE sensor_class='current' AND device_id = ?", array($device['device_id']));
|
||||
$freqs = dbFetchCell("select count(*) from sensors WHERE sensor_class='frequency' AND device_id = ?", array($device['device_id']));
|
||||
$power = dbFetchCell("select count(*) from sensors WHERE sensor_class='power' AND device_id = ?", array($device['device_id']));
|
||||
|
||||
unset($datas);
|
||||
$datas[] = 'overview';
|
||||
|
||||
@@ -2,15 +2,13 @@
|
||||
|
||||
echo('<table width="100%">');
|
||||
|
||||
$hrdevices = mysql_query("SELECT * FROM `hrDevice` WHERE `device_id` = '".$device['device_id']."' ORDER BY `hrDeviceIndex`");
|
||||
|
||||
while ($hrdevice = mysql_fetch_assoc($hrdevices))
|
||||
foreach (dbFetchRows("SELECT * FROM `hrDevice` WHERE `device_id` = ? ORDER BY `hrDeviceIndex`", array($device['device_id'])) as $hrdevice)
|
||||
{
|
||||
echo("<tr><td>".$hrdevice['hrDeviceIndex']."</td>");
|
||||
|
||||
if ($hrdevice['hrDeviceType'] == "hrDeviceProcessor")
|
||||
{
|
||||
$proc_id = mysql_result(mysql_query("SELECT processor_id FROM processors WHERE device_id = '".$device['device_id']."' AND hrDeviceIndex = '".$hrdevice['hrDeviceIndex']."'"),0);
|
||||
$proc_id = dbFetchCell("SELECT processor_id FROM processors WHERE device_id = '".$device['device_id']."' AND hrDeviceIndex = '".$hrdevice['hrDeviceIndex']."'");
|
||||
$proc_url = "device/".$device['device_id']."/health/processor/";
|
||||
$proc_popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$hrdevice['hrDeviceDescr'];
|
||||
$proc_popup .= "</div><img src=\'graph.php?id=" . $proc_id . "&type=processor_usage&from=$month&to=$now&width=400&height=125\'>";
|
||||
@@ -32,7 +30,7 @@ while ($hrdevice = mysql_fetch_assoc($hrdevices))
|
||||
elseif ($hrdevice['hrDeviceType'] == "hrDeviceNetwork")
|
||||
{
|
||||
$int = str_replace("network interface ", "", $hrdevice['hrDeviceDescr']);
|
||||
$interface = mysql_fetch_assoc(mysql_query("SELECT * FROM ports WHERE device_id = '".$device['device_id']."' AND ifDescr = '".$int."'"));
|
||||
$interface = dbFetchRow("SELECT * FROM ports WHERE device_id = ? AND ifDescr = ?", array($device['device_id'], $int));
|
||||
if ($interface['ifIndex'])
|
||||
{
|
||||
echo("<td>".generate_port_link($interface)."</td>");
|
||||
@@ -65,4 +63,4 @@ while ($hrdevice = mysql_fetch_assoc($hrdevices))
|
||||
|
||||
echo('</table>');
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
|
||||
$overview = 1;
|
||||
|
||||
$ports['total'] = mysql_result(mysql_query("SELECT count(*) FROM ports WHERE device_id = '" . $device['device_id'] . "'"),0);
|
||||
$ports['up'] = mysql_result(mysql_query("SELECT count(*) FROM ports WHERE device_id = '" . $device['device_id'] . "' AND ifOperStatus = 'up'"),0);
|
||||
$ports['down'] = mysql_result(mysql_query("SELECT count(*) FROM ports WHERE device_id = '" . $device['device_id'] . "' AND ifOperStatus = 'down' AND ifAdminStatus = 'up'"),0);
|
||||
$ports['disabled'] = mysql_result(mysql_query("SELECT count(*) FROM ports WHERE device_id = '" . $device['device_id'] . "' AND ifAdminStatus = 'down'"),0);
|
||||
$ports['total'] = dbFetchCell("SELECT COUNT(*) FROM `ports` WHERE device_id = ?", array($device['device_id']));
|
||||
$ports['up'] = dbFetchCell("SELECT COUNT(*) FROM `ports` WHERE device_id = ? AND `ifOperStatus` = 'up'", array($device['device_id']));
|
||||
$ports['down'] = dbFetchCell("SELECT COUNT(*) FROM `ports` WHERE device_id = ? AND `ifOperStatus` = 'down' AND `ifAdminStatus` = 'up'", array($device['device_id']));
|
||||
$ports['disabled'] = dbFetchCell("SELECT COUNT(*) FROM `ports` WHERE device_id = ? AND `ifAdminStatus` = 'down'", array($device['device_id']));
|
||||
|
||||
$services['total'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE device_id = '" . $device['device_id'] . "'"),0);
|
||||
$services['up'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE device_id = '" . $device['device_id'] . "' AND service_status = '1' AND service_ignore ='0'"),0);
|
||||
$services['down'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE device_id = '" . $device['device_id'] . "' AND service_status = '0' AND service_ignore = '0'"),0);
|
||||
$services['disabled'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE device_id = '" . $device['device_id'] . "' AND service_ignore = '1'"),0);
|
||||
$services['total'] = dbFetchCell("SELECT COUNT(service_id) FROM `services` WHERE `device_id` = ?", array($device['device_id']));
|
||||
$services['up'] = dbFetchCell("SELECT COUNT(service_id) FROM `services` WHERE `device_id` = ? AND `service_status` = '1' AND `service_ignore` ='0'", array($device['device_id']));
|
||||
$services['down'] = dbFetchCell("SELECT COUNT(service_id) FROM `services` WHERE `device_id` = ? AND `service_status` = '0' AND `service_ignore` = '0'", array($device['device_id']));
|
||||
$services['disabled'] = dbFetchCell("SELECT COUNT(service_id) FROM `services` WHERE `device_id` = ? AND `service_ignore` = '1'", array($device['device_id']));
|
||||
|
||||
if ($services['down']) { $services_colour = $warn_colour_a; } else { $services_colour = $list_colour_a; }
|
||||
if ($ports['down']) { $ports_colour = $warn_colour_a; } else { $ports_colour = $list_colour_a; }
|
||||
@@ -44,9 +44,7 @@ if ($services['total'])
|
||||
|
||||
echo("<div style='padding: 8px; font-size: 11px; font-weight: bold;'>");
|
||||
|
||||
$sql = "SELECT * FROM services WHERE device_id = '" . $device['device_id'] . "' ORDER BY service_type";
|
||||
$query = mysql_query($sql);
|
||||
while ($data = mysql_fetch_assoc($query))
|
||||
foreach (dbFetchRows("SELECT * FROM services WHERE device_id = ? ORDER BY service_type", array($device['device_id'])) as $data)
|
||||
{
|
||||
if ($data[service_status] == "0" && $data[service_ignore] == "1") { $status = "grey"; }
|
||||
if ($data[service_status] == "1" && $data[service_ignore] == "1") { $status = "green"; }
|
||||
@@ -60,16 +58,15 @@ if ($services['total'])
|
||||
echo("</div>");
|
||||
}
|
||||
|
||||
$sql = "SELECT *, DATE_FORMAT(timestamp, '%d/%b/%y %T') AS date from syslog WHERE device_id = '" . $device['device_id'] . "' $where";
|
||||
$sql .= " ORDER BY timestamp DESC LIMIT 20";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
if (mysql_affected_rows() > "0")
|
||||
### FIXME - split this into overview/syslog.inc.php?
|
||||
$syslog = dbFetchRows("SELECT *, DATE_FORMAT(timestamp, '%d/%b/%y %T') AS date from syslog WHERE device_id = ? ORDER BY timestamp DESC LIMIT 20");
|
||||
if (is_array($syslog))
|
||||
{
|
||||
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
|
||||
echo("<p style='padding: 0px 5px 5px;' class=sectionhead><img align='absmiddle' src='".$device['base_url']."/images/16/printer.png'> Recent Syslog</p>");
|
||||
echo("<table cellspacing=0 cellpadding=2 width=100%>");
|
||||
while ($entry = mysql_fetch_assoc($query)) { include("includes/print-syslog.inc.php"); }
|
||||
foreach ($syslog as $entry) { include("includes/print-syslog.inc.php"); }
|
||||
echo("</table>");
|
||||
echo("</div>");
|
||||
}
|
||||
@@ -81,9 +78,6 @@ echo("<div style='float:right; width: 50%;'>");
|
||||
### Right Pane
|
||||
include("overview/processors.inc.php");
|
||||
include("overview/mempools.inc.php");
|
||||
#include("overview/cemp.inc.php");
|
||||
#include("overview/cmp.inc.php");
|
||||
#include("overview/hrStorage.inc.php");
|
||||
include("overview/storage.inc.php");
|
||||
include("overview/sensors/temperatures.inc.php");
|
||||
include("overview/sensors/humidity.inc.php");
|
||||
@@ -98,12 +92,10 @@ echo("<p style='padding: 0px 5px 5px;' class=sectionhead>");
|
||||
echo('<a class="sectionhead" href="device/'.$device['device_id'].'/events/">');
|
||||
echo("<img align='absmiddle' src='".$config['base_url']."/images/16/report.png'> Recent Events</a></p>");
|
||||
|
||||
$query = "SELECT *,DATE_FORMAT(datetime, '%d/%b/%y %T') as humandate FROM `eventlog` WHERE `host` = '" . $device['device_id'] . "' ORDER BY `datetime` DESC LIMIT 0,10";
|
||||
$data = mysql_query($query);
|
||||
|
||||
echo("<table cellspacing=0 cellpadding=2 width=100%>");
|
||||
|
||||
while ($entry = mysql_fetch_assoc($data))
|
||||
$eventlog = dbFetchRows("SELECT *,DATE_FORMAT(datetime, '%d/%b/%y %T') as humandate FROM `eventlog` WHERE `host` = ? ORDER BY `datetime` DESC LIMIT 0,10", array($device['device_id']));
|
||||
foreach ($eventlog as $entry)
|
||||
{
|
||||
include("includes/print-event-short.inc.php");
|
||||
}
|
||||
@@ -111,4 +103,4 @@ while ($entry = mysql_fetch_assoc($data))
|
||||
echo("</table>");
|
||||
echo("</div>");
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
if (!isset($_GET['optb']) ) { $_GET['optb'] = "graphs"; }
|
||||
|
||||
$interface_query = mysql_query("select * from ports WHERE interface_id = '".$_GET['opta']."'");
|
||||
$interface = mysql_fetch_assoc($interface_query);
|
||||
$interface = dbFetchRow("SELECT * FROM `ports` WHERE `interface_id` = ?", array($_GET['opta']));
|
||||
|
||||
$port_details = 1;
|
||||
|
||||
@@ -57,7 +56,7 @@ echo("<a href='".$config['base_url']."/device/" . $device['device_id'] . "/port/
|
||||
if ($_GET['optb'] == "graphs" || !$_GET['optb']) { echo("</span>"); }
|
||||
|
||||
|
||||
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ports_adsl` WHERE `interface_id` = '".$interface['interface_id']."'"),0) )
|
||||
if (dbFetchCell("SELECT COUNT(*) FROM `ports_adsl` WHERE `interface_id` = '".$interface['interface_id']."'") )
|
||||
{
|
||||
echo(" | ");
|
||||
if ($_GET['optb'] == "adsl") { echo("<span class='pagemenu-selected'>"); }
|
||||
@@ -71,8 +70,8 @@ if ($_GET['optb'] == "arp") { echo("<span class='pagemenu-selected'>"); }
|
||||
echo("<a href='".$config['base_url']."/device/" . $device['device_id'] . "/port/".$interface['interface_id']."/arp/'>ARP Table</a>");
|
||||
if ($_GET['optb'] == "arp") { echo("</span>"); }
|
||||
|
||||
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ports` WHERE `pagpGroupIfIndex` = '".
|
||||
$interface['ifIndex']."' and `device_id` = '".$device['device_id']."'"),0) )
|
||||
if (dbFetchCell("SELECT COUNT(*) FROM `ports` WHERE `pagpGroupIfIndex` = '".
|
||||
$interface['ifIndex']."' and `device_id` = '".$device['device_id']."'") )
|
||||
{
|
||||
echo(" | ");
|
||||
if ($_GET['optb'] == "pagp") { echo("<span class='pagemenu-selected'>"); }
|
||||
@@ -81,7 +80,7 @@ if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ports` WHERE `pagpGroupIfInd
|
||||
}
|
||||
|
||||
|
||||
if (mysql_result(mysql_query("SELECT count(*) FROM mac_accounting WHERE interface_id = '".$interface['interface_id']."'"),0) > "0" )
|
||||
if (dbFetchCell("SELECT count(*) FROM mac_accounting WHERE interface_id = '".$interface['interface_id']."'") > "0" )
|
||||
{
|
||||
echo(" | Mac Accounting : ");
|
||||
if ($_GET['optb'] == "macaccounting" && $_GET['optc'] == "bits" && !$_GET['optd']) { echo("<span class='pagemenu-selected'>"); }
|
||||
@@ -106,7 +105,7 @@ if (mysql_result(mysql_query("SELECT count(*) FROM mac_accounting WHERE interfac
|
||||
echo(")");
|
||||
}
|
||||
|
||||
if (mysql_result(mysql_query("SELECT COUNT(*) FROM juniAtmVp WHERE interface_id = '".$interface['interface_id']."'"),0) > "0" )
|
||||
if (dbFetchCell("SELECT COUNT(*) FROM juniAtmVp WHERE interface_id = '".$interface['interface_id']."'") > "0" )
|
||||
{
|
||||
echo(" | ATM VPs : ");
|
||||
if ($_GET['optb'] == "junose-atm-vp" && $_GET['optc'] == "bits") { echo("<span class='pagemenu-selected'>"); }
|
||||
|
||||
@@ -11,11 +11,11 @@ $menu_options['basic'] = 'Basic';
|
||||
$menu_options['details'] = 'Details';
|
||||
$menu_options['arp'] = 'ARP Table';
|
||||
|
||||
if(mysql_result(mysql_query("SELECT * FROM links AS L, ports AS I WHERE I.device_id = '".$device['device_id']."' AND I.interface_id = L.local_interface_id"),0))
|
||||
if(dbFetchCell("SELECT * FROM links AS L, ports AS I WHERE I.device_id = '".$device['device_id']."' AND I.interface_id = L.local_interface_id"))
|
||||
{
|
||||
$menu_options['neighbours'] = 'Neighbours';
|
||||
}
|
||||
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `ports` WHERE `ifType` = 'adsl'"),0))
|
||||
if(dbFetchCell("SELECT COUNT(*) FROM `ports` WHERE `ifType` = 'adsl'"))
|
||||
{
|
||||
$menu_options['adsl'] = 'ADSL';
|
||||
}
|
||||
@@ -64,10 +64,8 @@ if ($_GET['optc'] == thumbs)
|
||||
$timeperiods = array('-1day','-1week','-1month','-1year');
|
||||
$from = '-1day';
|
||||
echo("<div style='display: block; clear: both; margin: auto; min-height: 500px;'>");
|
||||
$sql = "select * from ports WHERE device_id = '".$device['device_id']."' ORDER BY ifIndex";
|
||||
$query = mysql_query($sql);
|
||||
unset ($seperator);
|
||||
while ($interface = mysql_fetch_assoc($query))
|
||||
foreach (dbFetchRows("select * from ports WHERE device_id = ? ORDER BY ifIndex", array($device['device_id'])) as $interface)
|
||||
{
|
||||
echo("<div style='display: block; padding: 3px; margin: 3px; min-width: 183px; max-width:183px; min-height:90px; max-height:90px; text-align: center; float: left; background-color: #e9e9e9;'>
|
||||
<div style='font-weight: bold;'>".makeshortif($interface['ifDescr'])."</div>
|
||||
@@ -90,8 +88,7 @@ if ($_GET['optc'] == thumbs)
|
||||
if ($_GET['opta'] == "details") { $port_details = 1; }
|
||||
echo("<div style='margin: 0px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
|
||||
$i = "1";
|
||||
$interface_query = mysql_query("select * from ports WHERE device_id = '".$device['device_id']."' AND deleted = '0' ORDER BY `ifIndex` ASC");
|
||||
while ($interface = mysql_fetch_assoc($interface_query))
|
||||
foreach (dbFetchRows("SELECT * FROM `ports` WHERE `device_id` = ? AND `deleted` = '0' ORDER BY `ifIndex` ASC", array($device['device_id'])) as $interface)
|
||||
{
|
||||
include("includes/print-interface.inc.php");
|
||||
$i++;
|
||||
|
||||
@@ -25,12 +25,11 @@ unset($sep);
|
||||
|
||||
print_optionbar_end();
|
||||
|
||||
if (mysql_result(mysql_query("select count(service_id) from services WHERE device_id = '".$device['device_id']."'"), 0) > '0')
|
||||
if (dbFetchCell"select count(service_id) from services WHERE device_id = ?", array($device['device_id'])) > '0')
|
||||
{
|
||||
echo("<div style='margin: 5px;'><table cellpadding=7 border=0 cellspacing=0 width=100%>");
|
||||
$i = "1";
|
||||
$service_query = mysql_query("select * from services WHERE device_id = '".$device['device_id']."' ORDER BY service_type");
|
||||
while ($service = mysql_fetch_assoc($service_query))
|
||||
foreach (mysql_query("SELECT * FROM `services` WHERE `device_id` = ? ORDER BY `service_type`", array($device['device_id'])) as $service)
|
||||
{
|
||||
include("includes/print-service.inc.php");
|
||||
|
||||
@@ -53,9 +52,7 @@ if (mysql_result(mysql_query("select count(service_id) from services WHERE devic
|
||||
}
|
||||
echo("</td></tr>");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
echo("</table></div>");
|
||||
}
|
||||
else
|
||||
|
||||
@@ -13,8 +13,8 @@ print_optionbar_start('25');
|
||||
<select name="program" id="program">
|
||||
<option value="">All Programs</option>
|
||||
<?php
|
||||
$query = mysql_query("SELECT `program` FROM `syslog` WHERE device_id = '" . $device['device_id'] . "' GROUP BY `program` ORDER BY `program`");
|
||||
while ($data = mysql_fetch_assoc($query)) {
|
||||
$datas = dbFetchRows("SELECT `program` FROM `syslog` WHERE device_id = ? GROUP BY `program` ORDER BY `program`", array($device['device_id']));
|
||||
foreach ($datas as $data) {
|
||||
echo("<option value='".$data['program']."'");
|
||||
if ($data['program'] == $_POST['program']) { echo("selected"); }
|
||||
echo(">".$data['program']."</option>");
|
||||
@@ -29,21 +29,24 @@ print_optionbar_start('25');
|
||||
|
||||
print_optionbar_end();
|
||||
|
||||
$param = array($device['device_id']);
|
||||
|
||||
if ($_POST['string'])
|
||||
{
|
||||
$where = " AND msg LIKE '%".$_POST['string']."%'";
|
||||
$where = " AND msg LIKE ?";
|
||||
$param[] = "%".$_POST['string']."%";
|
||||
}
|
||||
|
||||
if ($_POST['program'])
|
||||
{
|
||||
$where .= " AND program = '".$_POST['program']."'";
|
||||
$where .= " AND program = ?";
|
||||
$param[] = $_POST['program'];
|
||||
}
|
||||
|
||||
$sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from syslog WHERE device_id = '" . $device['device_id'] . "' $where";
|
||||
$sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from syslog WHERE device_id = ? $where";
|
||||
$sql .= " ORDER BY timestamp DESC LIMIT 1000";
|
||||
$query = mysql_query($sql);
|
||||
echo("<table cellspacing=0 cellpadding=2 width=100%>");
|
||||
while ($entry = mysql_fetch_assoc($query)) { include("includes/print-syslog.inc.php"); }
|
||||
foreach (dbFetchRows($sql, $param) as $entry) { include("includes/print-syslog.inc.php"); }
|
||||
echo("</table>");
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -17,9 +17,8 @@ print_optionbar_end();
|
||||
echo('<table border="0" cellspacing="0" cellpadding="5" width="100%">');
|
||||
|
||||
$i = "1";
|
||||
$vlan_query = mysql_query("select * from vlans WHERE device_id = '".$device['device_id']."' ORDER BY 'vlan_vlan'");
|
||||
|
||||
while ($vlan = mysql_fetch_assoc($vlan_query))
|
||||
foreach (dbFetchRows("SELECT * FROM `vlans` WHERE `device_id` = ? ORDER BY 'vlan_vlan'", array($device['device_id'])) as $vlan)
|
||||
{
|
||||
include("includes/print-vlan.inc.php");
|
||||
$i++;
|
||||
|
||||
@@ -3,9 +3,8 @@
|
||||
echo('<table border="0" cellspacing="0" cellpadding="5" width="100%" class="sortable"><tr class="tablehead"><th>Server Name</th><th>Power Status</th><th>Operating System</th><th>Memory</th><th>CPU</th></tr>');
|
||||
|
||||
$i = "1";
|
||||
$vm_query = mysql_query("SELECT id, vmwVmVMID, vmwVmDisplayName, vmwVmGuestOS, vmwVmMemSize, vmwVmCpus, vmwVmState FROM vminfo WHERE device_id = '".$device['device_id']."' ORDER BY vmwVmDisplayName");
|
||||
|
||||
while ($vm = mysql_fetch_assoc($vm_query))
|
||||
foreach (dbFetchRows("SELECT * FROM vminfo WHERE device_id = ? ORDER BY vmwVmDisplayName", array($device['device_id'])) as $vm)
|
||||
{
|
||||
include("includes/print-vm.inc.php");
|
||||
$i++;
|
||||
|
||||
Reference in New Issue
Block a user