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@2336 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?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>");
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -22,37 +22,33 @@ if ($handle = opendir($config['install_dir'] . "/includes/polling/applications/"
|
||||
if ($_POST['device'])
|
||||
{
|
||||
$updated = 0;
|
||||
|
||||
$param = array($device['device_id']);
|
||||
foreach (array_keys($_POST) as $key)
|
||||
{
|
||||
if (substr($key,0,4) == 'app_')
|
||||
{
|
||||
$enabled[] = "'" . substr($key,4) . "'";
|
||||
$param[] = substr($key,4);
|
||||
$enabled[] = substr($key,4);
|
||||
$query[] = "?";
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "DELETE FROM applications WHERE device_id=" . $device['device_id'];
|
||||
if ($enabled)
|
||||
{
|
||||
$sql .= " AND app_type NOT IN (" . implode(',',$enabled) . ")";
|
||||
if(count($enabled)) {
|
||||
$updated += dbDelete('applications', "`device_id` = ? AND `app_type` NOT IN (".implode(',',$query).")", array($param));
|
||||
} else {
|
||||
$updated += dbDelete('applications', "`device_id` = ?", array($param));
|
||||
}
|
||||
mysql_query($sql);
|
||||
$updated += mysql_affected_rows();
|
||||
|
||||
$sql = "SELECT app_type FROM applications WHERE device_id=" . $device['device_id'];
|
||||
$result = mysql_query($sql);
|
||||
while ($row = mysql_fetch_assoc($result))
|
||||
foreach (dbFetchRows( "SELECT `app_type` FROM `applications` WHERE `device_id` = ?", array($device['device_id'])) as $row)
|
||||
{
|
||||
$app_in_db[] = $row['app_type'];
|
||||
}
|
||||
|
||||
foreach ($enabled as $app)
|
||||
{
|
||||
if (!in_array(trim($app,"'"),$app_in_db))
|
||||
if (!in_array($app,$app_in_db))
|
||||
{
|
||||
$sql = "INSERT INTO applications (device_id,app_type) VALUES (" . $device['device_id'] . ", " . $app . ")";
|
||||
mysql_query($sql);
|
||||
$updated += mysql_affected_rows();
|
||||
$updated += dbInsert(array('device_id' => $device['device_id'], 'app_type' => $app), 'applications');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,10 +65,10 @@ if ($_POST['device'])
|
||||
# Show list of apps with checkboxes
|
||||
echo('<div style="padding: 10px;">');
|
||||
|
||||
if (mysql_result(mysql_query("SELECT COUNT(*) from `applications` WHERE `device_id` = '".$device['device_id']."'"), 0) > '0')
|
||||
$apps_enabled = dbFetchRows("SELECT * from `applications` WHERE `device_id` = ? ORDER BY app_type", array($device['device_id']));
|
||||
if (count($apps_enabled))
|
||||
{
|
||||
$app_query = mysql_query("select * from applications WHERE device_id = '".$device['device_id']."' ORDER BY app_type");
|
||||
while ($application = mysql_fetch_assoc($app_query))
|
||||
foreach ($apps_enabled as $application)
|
||||
{
|
||||
$app_enabled[] = $application['app_type'];
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ if ($_POST['editing'])
|
||||
|
||||
if ($rows_updated > 0)
|
||||
{
|
||||
$update_message = mysql_affected_rows() . " Device record updated.";
|
||||
$update_message = $rows_updated . " Device record updated.";
|
||||
$updated = 1;
|
||||
} elseif ($rows_updated = '-1') {
|
||||
$update_message = "Device record unchanged. No update necessary.";
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
<?php
|
||||
|
||||
$sql = "SELECT * FROM `sensors` WHERE sensor_class='".$class."' AND device_id = '" . $device['device_id'] . "' ORDER BY sensor_descr";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
echo("<table cellspacing=0 cellpadding=5 width=100%>");
|
||||
|
||||
$row = 1;
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
<?php
|
||||
|
||||
$results = mysql_query("SELECT * FROM sensors WHERE sensor_class='" . $sensor_class . "' AND device_id = '" . $device['device_id'] . "' ORDER BY sensor_index");
|
||||
$sensors = dbFetchRows("SELECT * FROM `sensors` WHERE `sensor_class` = ? AND device_id = ? ORDER BY `sensor_index`", array($sensor_class, $device['device_id']));
|
||||
|
||||
if (mysql_num_rows($results))
|
||||
if (count($sensors))
|
||||
{
|
||||
$rows = round(mysql_num_rows($results) / 2,0);
|
||||
echo('<div style="background-color: #eeeeee; margin: 5px; padding: 5px;">');
|
||||
echo('<p style="padding: 0px 5px 5px;" class="sectionhead"><a class="sectionhead" href="device/'.$device['device_id'].'/health/' . strtolower($sensor_type) . '/"><img align="absmiddle" src="'.$config['base_url'].'/images/icons/' . strtolower($sensor_type) . '.png"> ' . $sensor_type . '</a></p>');
|
||||
$i = '1';
|
||||
echo('<table width="100%" valign="top">');
|
||||
while ($sensor = mysql_fetch_assoc($results))
|
||||
foreach ($sensors as $sensor)
|
||||
{
|
||||
if (is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
|
||||
@@ -38,4 +37,4 @@ if (mysql_num_rows($results))
|
||||
echo("</div>");
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
$graph_type = "mempool_usage";
|
||||
|
||||
if (mysql_result(mysql_query("SELECT count(*) from mempools WHERE device_id = '" . $device['device_id'] . "'"),0))
|
||||
$mempools = dbFetchRows("SELECT * FROM `mempools` WHERE device_id = ?", array($device['device_id']));
|
||||
|
||||
if (count($mempools))
|
||||
{
|
||||
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
|
||||
echo("<p style='padding: 0px 5px 5px;' class=sectionhead>");
|
||||
@@ -10,9 +12,8 @@ if (mysql_result(mysql_query("SELECT count(*) from mempools WHERE device_id = '"
|
||||
echo("<img align='absmiddle' src='".$config['base_url']."/images/icons/memory.png'> Memory Pools</a></p>");
|
||||
echo("<table width=100% cellspacing=0 cellpadding=5>");
|
||||
$mempool_rows = '0';
|
||||
$mempools = mysql_query("SELECT * FROM `mempools` WHERE device_id = '" . $device['device_id'] . "'");
|
||||
|
||||
while ($mempool = mysql_fetch_assoc($mempools))
|
||||
foreach($mempools as $mempool)
|
||||
{
|
||||
if (is_integer($mempool_rows/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
$perc = round($mempool['mempool_perc'],0);
|
||||
|
||||
@@ -44,11 +44,9 @@ if ($ports['total'])
|
||||
|
||||
echo(' <div style="margin: 8px; font-size: 11px; font-weight: bold;">');
|
||||
|
||||
$sql = "SELECT * FROM ports WHERE `device_id` = '" . $device['device_id'] . "' AND deleted != '1'";
|
||||
$query = mysql_query($sql);
|
||||
$ifsep = "";
|
||||
|
||||
while ($data = mysql_fetch_assoc($query))
|
||||
foreach (dbFetchRows("SELECT * FROM `ports` WHERE device_id = ? AND `deleted` != '1'", array($device['device_id'])) as $data)
|
||||
{
|
||||
$data = ifNameDescr($data);
|
||||
$data = array_merge($data, $device);
|
||||
@@ -61,4 +59,4 @@ if ($ports['total'])
|
||||
echo("</div>");
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
$graph_type = "processor_usage";
|
||||
|
||||
if (mysql_result(mysql_query("SELECT count(*) from processors WHERE device_id = '" . $device['device_id'] . "'"),0))
|
||||
$processors = dbFetchRows("SELECT * FROM `processors` WHERE device_id = ?", array($device['device_id']));
|
||||
|
||||
if (count($processors))
|
||||
{
|
||||
$processor_rows = 0;
|
||||
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
|
||||
@@ -10,8 +12,8 @@ if (mysql_result(mysql_query("SELECT count(*) from processors WHERE device_id =
|
||||
echo('<a class="sectionhead" href="device/'.$device['device_id'].'/health/processor/">');
|
||||
echo("<img align='absmiddle' src='".$config['base_url']."/images/icons/processor.png'> Processors</a></p>");
|
||||
echo("<table width=100% cellspacing=0 cellpadding=5>");
|
||||
$procs = mysql_query("SELECT * FROM `processors` WHERE device_id = '" . $device['device_id'] . "' ORDER BY processor_descr ASC");
|
||||
while ($proc = mysql_fetch_assoc($procs))
|
||||
|
||||
foreach($processors as $proc)
|
||||
{
|
||||
if (is_integer($processor_rows/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
$graph_type = "storage_usage";
|
||||
|
||||
if (mysql_result(mysql_query("SELECT count(storage_id) from storage WHERE device_id = '" . $device['device_id'] . "'"),0))
|
||||
$drives = dbFetchRows("SELECT * FROM `storage` WHERE device_id = ? ORDER BY `storage_descr` ASC", array($device['device_id']));
|
||||
|
||||
if (count($drives))
|
||||
{
|
||||
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
|
||||
echo("<p style='padding: 0px 5px 5px;' class=sectionhead>");
|
||||
@@ -11,8 +13,7 @@ if (mysql_result(mysql_query("SELECT count(storage_id) from storage WHERE device
|
||||
echo("<table width=100% cellspacing=0 cellpadding=5>");
|
||||
$drive_rows = '0';
|
||||
|
||||
$drives = mysql_query("SELECT * FROM `storage` WHERE device_id = '" . $device['device_id'] . "' ORDER BY storage_descr ASC");
|
||||
while ($drive = mysql_fetch_assoc($drives))
|
||||
foreach ($drives as $drive)
|
||||
{
|
||||
$skipdrive = 0;
|
||||
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
<?php
|
||||
|
||||
$sql = "SELECT * FROM `ospf_instances` WHERE `device_id` = '".$device['device_id']."'";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
$i_i = "0";
|
||||
|
||||
echo('<table width=100% border=0 cellpadding=5>');
|
||||
|
||||
#### Loop Instances
|
||||
|
||||
while ($instance = mysql_fetch_assoc($query))
|
||||
foreach (dbFetchRows("SELECT * FROM `ospf_instances` WHERE `device_id` = ?", array($device['device_id'])) as $instance)
|
||||
{
|
||||
if (!is_integer($i_i/2)) { $instance_bg = $list_colour_a; } else { $instance_bg = $list_colour_b; }
|
||||
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
|
||||
<?php
|
||||
|
||||
echo("<strong>AS".$device['bgpLocalAs']."</strong>");
|
||||
|
||||
echo("<br />");
|
||||
|
||||
$total = mysql_result(mysql_query("SELECT count(*) FROM `bgpPeers` WHERE `device_id` = '".$device['device_id']."'"),0);
|
||||
$up = mysql_result(mysql_query("SELECT count(*) FROM `bgpPeers` WHERE `device_id` = '".$device['device_id']."' AND `bgpPeerState` = 'established'"),0);
|
||||
$stop = mysql_result(mysql_query("SELECT count(*) FROM `bgpPeers` WHERE `device_id` = '".$device['device_id']."' AND `bgpPeerAdminStatus` = 'stop'"),0);
|
||||
|
||||
echo("Sessions: ".$total." Up: ".$up." Down: ".($total-$up) . ($stop != 0 ? " ( Shutdown: ".$stop." )" : ""));
|
||||
|
||||
?>
|
||||
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
|
||||
$sql = "SELECT * FROM `ospf_instances` WHERE `device_id` = '".$device['device_id']."'";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
$i_i = "1";
|
||||
|
||||
echo('<table width=100%>');
|
||||
|
||||
#### Loop Instances
|
||||
|
||||
while ($instance = mysql_fetch_assoc($query))
|
||||
{
|
||||
if (!is_integer($i_i/2)) { $instance_bg = $list_colour_a; } else { $instance_bg = $list_colour_b; }
|
||||
|
||||
$area_count = mysql_result(mysql_query("SELECT COUNT(*) FROM `ospf_areas` WHERE `device_id` = '".$device['device_id']."'"),0);
|
||||
$port_count = mysql_result(mysql_query("SELECT COUNT(*) FROM `ospf_ports` WHERE `device_id` = '".$device['device_id']."'"),0);
|
||||
|
||||
$query = "SELECT * FROM ipv4_addresses AS A, ports AS I WHERE ";
|
||||
$query .= "(A.ipv4_address = '".$peer['bgpPeerIdentifier']."' AND I.interface_id = A.interface_id)";
|
||||
$query .= " AND I.device_id = '".$device['device_id']."'";
|
||||
$ipv4_host = mysql_fetch_assoc(mysql_query($query));
|
||||
|
||||
if ($instance['ospfAdminStat'] == "enabled") { $enabled = '<span style="color: #00aa00">enabled</span>'; } else { $enabled = '<span style="color: #aaaaaa">disabled</span>'; }
|
||||
if ($instance['ospfAreaBdrRtrStatus'] == "true") { $abr = '<span style="color: #00aa00">yes</span>'; } else { $abr = '<span style="color: #aaaaaa">no</span>'; }
|
||||
if ($instance['ospfASBdrRtrStatus'] == "true") { $asbr = '<span style="color: #00aa00">yes</span>'; } else { $asbr = '<span style="color: #aaaaaa">no</span>'; }
|
||||
|
||||
echo('<tr><th>Router Id</th><th>Status</th><th>ABR</th><th>ASBR</th><th>Areas</th><th>Ports</th><th>Neighbours</th></tr>');
|
||||
echo('<tr bgcolor="'.$instance_bg.'">');
|
||||
echo(' <td class="list-large">'.$instance['ospfRouterId'] . '</td>');
|
||||
echo(' <td>' . $enabled . '</td>');
|
||||
echo(' <td>' . $abr . '</td>');
|
||||
echo(' <td>' . $asbr . '</td>');
|
||||
echo(' <td>' . $area_count . '</td>');
|
||||
echo(' <td>' . $port_count . '</td>');
|
||||
echo(' <td>' . ($neighbour_count+0) . '</td>');
|
||||
echo('</tr>');
|
||||
|
||||
$i_i++;
|
||||
} ### End loop instances
|
||||
|
||||
echo('</table>');
|
||||
|
||||
?>
|
||||
@@ -5,16 +5,16 @@
|
||||
<?php
|
||||
|
||||
$nodes = array();
|
||||
|
||||
$param = array();
|
||||
$uptimesql = "";
|
||||
if (filter_var($config['uptime_warning'], FILTER_VALIDATE_FLOAT) !== FALSE && $config['uptime_warning'] > 0)
|
||||
{
|
||||
$uptimesql = " AND A.attrib_value < '" . $config['uptime_warning'] . "'";
|
||||
$uptimesql = " AND A.attrib_value < ?";
|
||||
$param = array($config['uptime_warning']);
|
||||
}
|
||||
|
||||
$sql = mysql_query("SELECT * FROM `devices` AS D, `devices_attribs` AS A WHERE D.status = '1' AND A.device_id = D.device_id AND A.attrib_type = 'uptime' AND A.attrib_value > '0' " . $uptimesql);
|
||||
|
||||
while ($device = mysql_fetch_assoc($sql)){
|
||||
foreach (dbFetchRows("SELECT * FROM `devices` AS D, `devices_attribs` AS A WHERE D.status = '1' AND A.device_id = D.device_id AND A.attrib_type = 'uptime' AND A.attrib_value > '0' " . $uptimesql, $param) as $device)
|
||||
{
|
||||
unset($already);
|
||||
$i = 0;
|
||||
while ($i <= count($nodes)) {
|
||||
@@ -28,8 +28,8 @@ while ($device = mysql_fetch_assoc($sql)){
|
||||
}
|
||||
|
||||
|
||||
$sql = mysql_query("SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0'");
|
||||
while ($device = mysql_fetch_assoc($sql)){
|
||||
foreach (dbFetchRows("SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0'") as $device)
|
||||
{
|
||||
if (device_permitted($device['device_id'])) {
|
||||
echo("<div style='text-align: center; margin: 2px; border: solid 2px #d0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffbbbb;'>
|
||||
<strong>".generate_device_link($device, shorthost($device['hostname']))."</strong><br />
|
||||
@@ -41,8 +41,8 @@ while ($device = mysql_fetch_assoc($sql)){
|
||||
|
||||
if ($config['warn']['ifdown']) {
|
||||
|
||||
$sql = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'");
|
||||
while ($interface = mysql_fetch_assoc($sql)){
|
||||
foreach (dbFetchRows("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'") as $interface)
|
||||
{
|
||||
if (port_permitted($interface['interface_id'])) {
|
||||
echo("<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>
|
||||
<strong>".generate_device_link($interface, shorthost($interface['hostname']))."</strong><br />
|
||||
@@ -55,8 +55,8 @@ while ($interface = mysql_fetch_assoc($sql)){
|
||||
|
||||
}
|
||||
|
||||
$sql = mysql_query("SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0'");
|
||||
while ($service = mysql_fetch_assoc($sql)){
|
||||
foreach (dbFetchRows("SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0'") as $service)
|
||||
{
|
||||
if (device_permitted($service['device_id'])) {
|
||||
echo("<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>
|
||||
<strong>".generate_device_link($service, shorthost($service['hostname']))."</strong><br />
|
||||
@@ -67,8 +67,8 @@ while ($service = mysql_fetch_assoc($sql)){
|
||||
}
|
||||
}
|
||||
|
||||
$sql = mysql_query("SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerAdminStatus = 'start' AND bgpPeerState != 'established' AND B.device_id = D.device_id");
|
||||
while ($peer = mysql_fetch_assoc($sql)){
|
||||
foreach (dbFetchRows("SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerAdminStatus = 'start' AND bgpPeerState != 'established' AND B.device_id = D.device_id") as $peer)
|
||||
{
|
||||
if (device_permitted($peer['device_id'])) {
|
||||
echo("<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>
|
||||
<strong>".generate_device_link($peer, shorthost($peer['hostname']))."</strong><br />
|
||||
@@ -81,8 +81,7 @@ while ($peer = mysql_fetch_assoc($sql)){
|
||||
|
||||
if (filter_var($config['uptime_warning'], FILTER_VALIDATE_FLOAT) !== FALSE && $config['uptime_warning'] > 0)
|
||||
{
|
||||
$sql = mysql_query("SELECT * FROM devices_attribs AS A, `devices` AS D WHERE A.attrib_value < '" . $config['uptime_warning'] . "' AND A.attrib_type = 'uptime' AND A.device_id = D.device_id AND ignore = '0' AND disabled = '0'");
|
||||
while ($device = mysql_fetch_assoc($sql)){
|
||||
foreach (dbFetchRows("SELECT * FROM devices_attribs AS A, `devices` AS D WHERE A.attrib_value < ? AND A.attrib_type = 'uptime' AND A.device_id = D.device_id AND ignore = '0' AND disabled = '0'", array($config['uptime_warning'])) as $device){
|
||||
if (device_permitted($device['device_id']) && $device['attrib_value'] < $config['uptime_warning'] && $device['attrib_type'] == "uptime") {
|
||||
echo("<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ddffdd;'>
|
||||
<strong>".generate_device_link($device, shorthost($device['hostname']))."</strong><br />
|
||||
|
||||
@@ -19,7 +19,7 @@ print_optionbar_start();
|
||||
echo("<span style='font-weight: bold;'>Routing</span> » ");
|
||||
|
||||
unset($sep);
|
||||
foreach ($datas as $type)
|
||||
foreach ($routing_count as $type => $value)
|
||||
{
|
||||
if (!$_GET['opta']) { $_GET['opta'] = $type; }
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
<?php
|
||||
|
||||
$sql = "SELECT * FROM `ospf_instances` WHERE `ospfAdminStat` = 'enabled'";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
$i_i = "0";
|
||||
|
||||
echo('<table width=100% border=0 cellpadding=10>');
|
||||
@@ -10,7 +7,7 @@ echo('<tr><th>Device</th><th>Router Id</th><th>Status</th><th>ABR</th><th>ASBR</
|
||||
|
||||
#### Loop Instances
|
||||
|
||||
while ($instance = mysql_fetch_assoc($query))
|
||||
foreach (dbFetchRows("SELECT * FROM `ospf_instances` WHERE `ospfAdminStat` = 'enabled'") as $instance)
|
||||
{
|
||||
if (!is_integer($i_i/2)) { $instance_bg = $list_colour_a; } else { $instance_bg = $list_colour_b; }
|
||||
|
||||
|
||||
@@ -53,9 +53,8 @@ if($_GET['optb'] == "all" ) {
|
||||
echo("<td width=100 class=box-desc>" . $vrf['mplsVpnVrfRouteDistinguisher'] . "</td>");
|
||||
#echo("<td width=200 class=box-desc>" . $vrf['mplsVpnVrfDescription'] . "</td>");
|
||||
echo("<td><table border=0 cellspacing=0 cellpadding=5 width=100%>");
|
||||
$devices = mysql_query("SELECT * FROM `vrfs` AS V, `devices` AS D WHERE `mplsVpnVrfRouteDistinguisher` = '".$vrf['mplsVpnVrfRouteDistinguisher']."' AND D.device_id = V.device_id");
|
||||
$x=1;
|
||||
while ($device = mysql_fetch_assoc($devices))
|
||||
foreach (dbFetchRows("SELECT * FROM `vrfs` AS V, `devices` AS D WHERE `mplsVpnVrfRouteDistinguisher` = ? AND D.device_id = V.device_id", array($vrf['mplsVpnVrfRouteDistinguisher'])) as $device)
|
||||
{
|
||||
if (!is_integer($i/2))
|
||||
{
|
||||
|
||||
+34
-1
@@ -135,6 +135,7 @@ function dbDelete($table, $where = null, $parameters = array()) {
|
||||
* Most other retrieval functions build off this
|
||||
* */
|
||||
function dbFetchRows($sql, $parameters = array()) {
|
||||
global $db_stats;
|
||||
$result = dbQuery($sql, $parameters);
|
||||
if(mysql_num_rows($result) > 0) {
|
||||
$rows = array();
|
||||
@@ -144,7 +145,14 @@ function dbFetchRows($sql, $parameters = array()) {
|
||||
mysql_free_result($result);
|
||||
return $rows;
|
||||
}
|
||||
mysql_free_result($result);
|
||||
|
||||
$time_start = microtime(true);
|
||||
mysql_free_result($result);
|
||||
$time_end = microtime(true);
|
||||
|
||||
$db_stats['fetchrows_sec'] += number_format($time_end - $time_start, 8);
|
||||
$db_stats['fetchrows']++;
|
||||
|
||||
// no records, thus return empty array
|
||||
// which should evaluate to false, and will prevent foreach notices/warnings
|
||||
return array();
|
||||
@@ -172,10 +180,20 @@ function dbFetch($sql, $parameters = array()) {
|
||||
* The first argument is an sprintf-ready query stringTypes
|
||||
* */
|
||||
function dbFetchRow($sql = null, $parameters = array()) {
|
||||
global $db_stats;
|
||||
$time_start = microtime(true);
|
||||
|
||||
$result = dbQuery($sql, $parameters);
|
||||
$time_start = microtime(true);
|
||||
|
||||
if($result) {
|
||||
$row = mysql_fetch_assoc($result);
|
||||
mysql_free_result($result);
|
||||
$time_end = microtime(true);
|
||||
|
||||
$db_stats['fetchrow_sec'] += number_format($time_end - $time_start, 8);
|
||||
$db_stats['fetchrow']++;
|
||||
|
||||
return $row;
|
||||
} else {
|
||||
return null;
|
||||
@@ -186,10 +204,18 @@ function dbFetchRow($sql = null, $parameters = array()) {
|
||||
* Fetches the first call from the first row returned by the query
|
||||
* */
|
||||
function dbFetchCell($sql, $parameters = array()) {
|
||||
global $db_stats;
|
||||
$time_start = microtime(true);
|
||||
|
||||
$row = dbFetchRow($sql, $parameters);
|
||||
if($row) {
|
||||
return array_shift($row); // shift first field off first row
|
||||
}
|
||||
$time_end = microtime(true);
|
||||
|
||||
$db_stats['fetchcell_sec'] += number_format($time_end - $time_start, 8);
|
||||
$db_stats['fetchcell']++;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -198,10 +224,17 @@ function dbFetchCell($sql, $parameters = array()) {
|
||||
* It fetches one cell from each row and places all the values in 1 array
|
||||
* */
|
||||
function dbFetchColumn($sql, $parameters = array()) {
|
||||
global $db_stats;
|
||||
$time_start = microtime(true);
|
||||
$cells = array();
|
||||
foreach(dbFetch($sql, $parameters) as $row) {
|
||||
$cells[] = array_shift($row);
|
||||
}
|
||||
$time_end = microtime(true);
|
||||
|
||||
$db_stats['fetchcol_sec'] += number_format($time_end - $time_start, 8);
|
||||
$db_stats['fetchcol']++;
|
||||
|
||||
return $cells;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user