more db* make diskio_ a bit more generic

git-svn-id: http://www.observium.org/svn/observer/trunk@2305 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-05-13 12:57:11 +00:00
parent 993b5c5ead
commit 8576fdd5ad
6 changed files with 29 additions and 50 deletions

View File

@@ -4,7 +4,7 @@
$i = 0;
while ($port = mysql_fetch_assoc($ports))
foreach ($ports as $port)
{
if (is_file($config['rrd_dir'] . "/" . $port['hostname'] . "/port-" . safename($port['ifIndex'] . ".rrd")))
{

View File

@@ -2,8 +2,7 @@
## Generate a list of ports and then call the multi_bits grapher to generate from the list
$query = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE `port_descr_type` = 'cust' AND `port_descr_descr` = '".mres($_GET['id'])."' AND D.device_id = I.device_id");
while ($int = mysql_fetch_assoc($query))
foreach(dbFetchRows("SELECT * FROM `ports` AS I, `devices` AS D WHERE `port_descr_type` = 'cust' AND `port_descr_descr` = ? AND D.device_id = I.device_id", array($_GET['id'])) as $int)
{
if (is_file($config['rrd_dir'] . "/" . $int['hostname'] . "/port-" . safename($int['ifIndex'] . ".rrd")))
{

View File

@@ -4,8 +4,7 @@
$device = device_by_id_cache($id);
$query = mysql_query("SELECT * FROM `ports` WHERE `device_id` = '".$id."'");
while ($int = mysql_fetch_assoc($query))
foreach (dbFetchRows("SELECT * FROM `ports` WHERE `device_id` = ?", array($id)) as $int)
{
$ignore = 0;
if (is_array($config['device_traffic_iftype']))

View File

@@ -1,24 +1,5 @@
<?php
if ($_GET['id']) { $id = mres($_GET['id']); }
if ($_GET['device']) { $id = mres($_GET['device']); }
$i = 1;
$query = mysql_query("SELECT * FROM `ucd_diskio` AS U, `devices` AS D WHERE D.device_id = '".$id."' AND U.device_id = D.device_id");
while ($disk = mysql_fetch_assoc($query))
{
$rrd_filename = $config['rrd_dir'] . "/" . $disk['hostname'] . "/ucd_diskio-" . safename($disk['diskio_descr'] . ".rrd");
if (is_file($rrd_filename))
{
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $disk['diskio_descr'];
$rrd_list[$i]['rra_in'] = "reads";
$rrd_list[$i]['rra_out'] = "writes";
$i++;
}
}
$units ='bps';
$total_units ='B';
$colours_in ='greens';
@@ -29,6 +10,6 @@ $nototal = 1;
$rra_in = "read";
$rra_out = "written";
include("includes/graphs/generic_multi_bits_separated.inc.php");
include("includes/graphs/device/diskio_common.inc.php");
?>

View File

@@ -0,0 +1,20 @@
<?php
$i = 1;
foreach (dbFetchRows("SELECT * FROM `ucd_diskio` AS U, `devices` AS D WHERE D.device_id = ? AND U.device_id = D.device_id", array($id)) as $disk)
{
$rrd_filename = $config['rrd_dir'] . "/" . $disk['hostname'] . "/ucd_diskio-" . safename($disk['diskio_descr'] . ".rrd");
if (is_file($rrd_filename))
{
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $disk['diskio_descr'];
$rrd_list[$i]['rra_in'] = "reads";
$rrd_list[$i]['rra_out'] = "writes";
$i++;
}
}
include("includes/graphs/generic_multi_bits_separated.inc.php");
?>

View File

@@ -1,25 +1,5 @@
<?php
if ($_GET['id']) { $id = mres($_GET['id']); }
if ($_GET['device']) { $id = mres($_GET['device']); }
$i = 1;
$query = mysql_query("SELECT * FROM `ucd_diskio` AS U, `devices` AS D WHERE D.device_id = '".$id."' AND U.device_id = D.device_id");
while ($disk = mysql_fetch_assoc($query))
{
$rrd_filename = $config['rrd_dir'] . "/" . $disk['hostname'] . "/ucd_diskio-" . safename($disk['diskio_descr'] . ".rrd");
if (is_file($rrd_filename))
{
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $disk['diskio_descr'];
$rrd_list[$i]['rra_in'] = "reads";
$rrd_list[$i]['rra_out'] = "writes";
$i++;
}
}
$units = '';
$units_descr = 'Operations/sec';
$total_units = 'B';
@@ -29,6 +9,6 @@ $colours_out = 'blues';
$nototal = 1;
include("includes/graphs/generic_multi_seperated.inc.php");
include("includes/graphs/device/diskio_common.inc.php");
?>