mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
cleanups in device graphs
git-svn-id: http://www.observium.org/svn/observer/trunk@1892 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
if(is_numeric($id) && ($config['allow_unauth_graphs'] || device_permitted($id)))
|
||||
if (is_numeric($id) && ($config['allow_unauth_graphs'] || device_permitted($id)))
|
||||
{
|
||||
$device = device_by_id_cache($id);
|
||||
$title = generate_device_link($device);
|
||||
|
@@ -8,7 +8,7 @@ $rrd_options .= " -l 0 -E ";
|
||||
$iter = "1";
|
||||
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='current' AND device_id = '$id'");
|
||||
$rrd_options .= " COMMENT:' Cur Min Max\\n'";
|
||||
while($current = mysql_fetch_array($sql))
|
||||
while ($current = mysql_fetch_array($sql))
|
||||
{
|
||||
switch ($iter)
|
||||
{
|
||||
@@ -51,5 +51,4 @@ while($current = mysql_fetch_array($sql))
|
||||
$iter++;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
?>
|
@@ -1,16 +1,15 @@
|
||||
<?php
|
||||
|
||||
#print_r($_GET);
|
||||
if ($_GET['id']) { $id = mres($_GET['id']); }
|
||||
if ($_GET['device']) { $id = mres($_GET['device']); }
|
||||
|
||||
if($_GET['id']) { $id = mres($_GET['id']); }
|
||||
if($_GET['device']) { $id = mres($_GET['device']); }
|
||||
|
||||
$i=1;
|
||||
$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_array($query)) {
|
||||
while ($disk = mysql_fetch_array($query))
|
||||
{
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $disk['hostname'] . "/ucd_diskio-" . safename($disk['diskio_descr'] . ".rrd");
|
||||
if(is_file($rrd_filename))
|
||||
if (is_file($rrd_filename))
|
||||
{
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $disk['diskio_descr'];
|
||||
@@ -20,9 +19,9 @@ while($disk = mysql_fetch_array($query)) {
|
||||
}
|
||||
}
|
||||
|
||||
$units='bps';
|
||||
$total_units='B';
|
||||
$colours_in='greens';
|
||||
$units ='bps';
|
||||
$total_units ='B';
|
||||
$colours_in ='greens';
|
||||
$multiplier = "8";
|
||||
$colours_out = 'blues';
|
||||
|
||||
@@ -32,4 +31,4 @@ $rra_out = "written";
|
||||
|
||||
include ("includes/graphs/generic_multi_bits_separated.inc.php");
|
||||
|
||||
?>
|
||||
?>
|
@@ -1,16 +1,16 @@
|
||||
<?php
|
||||
|
||||
#print_r($_GET);
|
||||
if ($_GET['id']) { $id = mres($_GET['id']); }
|
||||
if ($_GET['device']) { $id = mres($_GET['device']); }
|
||||
|
||||
if($_GET['id']) { $id = mres($_GET['id']); }
|
||||
if($_GET['device']) { $id = mres($_GET['device']); }
|
||||
|
||||
$i=1;
|
||||
$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_array($query)) {
|
||||
|
||||
while ($disk = mysql_fetch_array($query))
|
||||
{
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $disk['hostname'] . "/ucd_diskio-" . safename($disk['diskio_descr'] . ".rrd");
|
||||
if(is_file($rrd_filename))
|
||||
if (is_file($rrd_filename))
|
||||
{
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $disk['diskio_descr'];
|
||||
@@ -20,16 +20,15 @@ while($disk = mysql_fetch_array($query)) {
|
||||
}
|
||||
}
|
||||
|
||||
$units='';
|
||||
$units_descr='Operations/sec';
|
||||
$total_units='B';
|
||||
$colours_in='greens';
|
||||
$units = '';
|
||||
$units_descr = 'Operations/sec';
|
||||
$total_units = 'B';
|
||||
$colours_in = 'greens';
|
||||
$multiplier = "1";
|
||||
$colours_out = 'blues';
|
||||
|
||||
$nototal = 1;
|
||||
|
||||
|
||||
include ("includes/graphs/generic_multi_seperated.inc.php");
|
||||
|
||||
?>
|
||||
?>
|
@@ -9,7 +9,8 @@ $rrd_options .= " -l 0 -E ";
|
||||
$iter = "1";
|
||||
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='fanspeed' AND device_id = '$id'");
|
||||
$rrd_options .= " COMMENT:'RPM Cur Min Max\\n'";
|
||||
while($fanspeed = mysql_fetch_array($sql))
|
||||
|
||||
while ($fanspeed = mysql_fetch_array($sql))
|
||||
{
|
||||
switch ($iter)
|
||||
{
|
||||
@@ -51,4 +52,4 @@ while($fanspeed = mysql_fetch_array($sql))
|
||||
$iter++;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
@@ -9,14 +9,18 @@ $rrd_options .= " -u 100 -l 0 -E -b 1024 ";
|
||||
|
||||
$iter = "1"; $i=1;
|
||||
$rrd_options .= " COMMENT:' Min Cur Max\\n'";
|
||||
while($mempool = mysql_fetch_array($query)) {
|
||||
if($iter=="1") {$colour="CC0000";} elseif($iter=="2") {$colour="008C00";} elseif($iter=="3") {$colour="4096EE";
|
||||
} elseif($iter=="4") {$colour="73880A";} elseif($iter=="5") {$colour="D01F3C";} elseif($iter=="6") {$colour="36393D";
|
||||
} elseif($iter=="7") {$colour="FF0084"; unset($iter); }
|
||||
|
||||
while ($mempool = mysql_fetch_array($query))
|
||||
{
|
||||
if ($iter=="1") { $colour="CC0000"; } elseif ($iter=="2") { $colour="008C00"; } elseif ($iter=="3") { $colour="4096EE"; }
|
||||
elseif ($iter=="4") { $colour="73880A"; } elseif ($iter=="5") { $colour="D01F3C"; } elseif ($iter=="6") { $colour="36393D"; }
|
||||
elseif ($iter=="7") { $colour="FF0084"; unset($iter); }
|
||||
|
||||
$descr = substr(str_pad(short_hrDeviceDescr($mempool['mempool_descr']), 22),0,22);
|
||||
$descr = str_replace(":", "\:", $descr);
|
||||
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("mempool-".$mempool['mempool_type']."-".$mempool['mempool_index'].".rrd");
|
||||
if(is_file($rrd_filename))
|
||||
|
||||
if (is_file($rrd_filename))
|
||||
{
|
||||
$rrd_options .= " DEF:mempoolfree$i=$rrd_filename:free:AVERAGE ";
|
||||
$rrd_options .= " DEF:mempoolused$i=$rrd_filename:used:AVERAGE ";
|
||||
@@ -28,6 +32,7 @@ while($mempool = mysql_fetch_array($query)) {
|
||||
$iter++; $i++;
|
||||
}
|
||||
}
|
||||
|
||||
$rrd_options .= " HRULE:0#999999";
|
||||
|
||||
?>
|
||||
?>
|
@@ -3,13 +3,14 @@
|
||||
$device = device_by_id_cache($id);
|
||||
$query = mysql_query("SELECT * FROM `processors` where `device_id` = '".$id."'");
|
||||
|
||||
$i=0;
|
||||
while($proc = mysql_fetch_array($query)) {
|
||||
$i = 0;
|
||||
|
||||
while ($proc = mysql_fetch_array($query))
|
||||
{
|
||||
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("processor-" . $proc['processor_type'] . "-" . $proc['processor_index'] . ".rrd");
|
||||
|
||||
if(is_file($rrd_filename)) {
|
||||
|
||||
if (is_file($rrd_filename))
|
||||
{
|
||||
$descr = short_hrDeviceDescr($proc['processor_descr']);
|
||||
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
@@ -21,9 +22,9 @@ while($proc = mysql_fetch_array($query)) {
|
||||
|
||||
$unit_text = "Load %";
|
||||
|
||||
$units='%';
|
||||
$total_units='%';
|
||||
$colours='mixed';
|
||||
$units ='%';
|
||||
$total_units ='%';
|
||||
$colours ='mixed';
|
||||
|
||||
$scale_min = "0";
|
||||
$scale_max = "100";
|
||||
@@ -32,4 +33,4 @@ $nototal = 1;
|
||||
|
||||
include ("includes/graphs/generic_multi_line.inc.php");
|
||||
|
||||
?>
|
||||
?>
|
@@ -7,26 +7,27 @@ include("includes/graphs/common.inc.php");
|
||||
|
||||
$device = device_by_id_cache($id);
|
||||
|
||||
$iter = "1";
|
||||
$sql = mysql_query("SELECT * FROM storage where device_id = '$id'");
|
||||
$rrd_options .= " COMMENT:' Size Used %age\\l'";
|
||||
while($storage = mysql_fetch_array($sql)) {
|
||||
if($iter=="1") {$colour="CC0000";} elseif($iter=="2") {$colour="008C00";} elseif($iter=="3") {$colour="4096EE";
|
||||
} elseif($iter=="4") {$colour="73880A";} elseif($iter=="5") {$colour="D01F3C";} elseif($iter=="6") {$colour="36393D";
|
||||
} elseif($iter=="7") {$colour="FF0084"; $iter = "0"; }
|
||||
$descr = substr(str_pad($storage[storage_descr], 12),0,12);
|
||||
$descr = str_replace(":","\:",$descr);
|
||||
$rrd = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("storage-".$storage['storage_mib']."-".$storage['storage_descr'].".rrd");
|
||||
$rrd_options .= " DEF:$storage[storage_id]used=$rrd:used:AVERAGE";
|
||||
$rrd_options .= " DEF:$storage[storage_id]free=$rrd:free:AVERAGE";
|
||||
$rrd_options .= " CDEF:$storage[storage_id]size=$storage[storage_id]used,$storage[storage_id]free,+";
|
||||
$rrd_options .= " CDEF:$storage[storage_id]perc=$storage[storage_id]used,$storage[storage_id]size,/,100,*";
|
||||
$rrd_options .= " LINE1.25:$storage[storage_id]perc#" . $colour . ":'$descr'";
|
||||
$rrd_options .= " GPRINT:$storage[storage_id]size:LAST:%6.2lf%sB";
|
||||
$rrd_options .= " GPRINT:$storage[storage_id]used:LAST:%6.2lf%sB";
|
||||
$rrd_options .= " GPRINT:$storage[storage_id]perc:LAST:%5.2lf%%\\\\l";
|
||||
$iter++;
|
||||
}
|
||||
$iter = "1";
|
||||
$sql = mysql_query("SELECT * FROM storage where device_id = '$id'");
|
||||
$rrd_options .= " COMMENT:' Size Used %age\\l'";
|
||||
while ($storage = mysql_fetch_array($sql))
|
||||
{
|
||||
if ($iter=="1") { $colour="CC0000"; } elseif ($iter=="2") { $colour="008C00"; } elseif ($iter=="3") { $colour="4096EE"; }
|
||||
elseif ($iter=="4") { $colour="73880A"; } elseif ($iter=="5") { $colour="D01F3C"; } elseif ($iter=="6") { $colour="36393D"; }
|
||||
elseif ($iter=="7") { $colour="FF0084"; $iter = "0"; }
|
||||
|
||||
$descr = substr(str_pad($storage[storage_descr], 12),0,12);
|
||||
$descr = str_replace(":","\:",$descr);
|
||||
$rrd = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("storage-".$storage['storage_mib']."-".$storage['storage_descr'].".rrd");
|
||||
$rrd_options .= " DEF:$storage[storage_id]used=$rrd:used:AVERAGE";
|
||||
$rrd_options .= " DEF:$storage[storage_id]free=$rrd:free:AVERAGE";
|
||||
$rrd_options .= " CDEF:$storage[storage_id]size=$storage[storage_id]used,$storage[storage_id]free,+";
|
||||
$rrd_options .= " CDEF:$storage[storage_id]perc=$storage[storage_id]used,$storage[storage_id]size,/,100,*";
|
||||
$rrd_options .= " LINE1.25:$storage[storage_id]perc#" . $colour . ":'$descr'";
|
||||
$rrd_options .= " GPRINT:$storage[storage_id]size:LAST:%6.2lf%sB";
|
||||
$rrd_options .= " GPRINT:$storage[storage_id]used:LAST:%6.2lf%sB";
|
||||
$rrd_options .= " GPRINT:$storage[storage_id]perc:LAST:%5.2lf%%\\\\l";
|
||||
$iter++;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
?>
|
@@ -3,13 +3,13 @@
|
||||
include("includes/graphs/common.inc.php");
|
||||
$device = device_by_id_cache($id);
|
||||
|
||||
if($_GET['width'] > "300") { $descr_len = "40"; } else { $descr_len = "22"; }
|
||||
if ($_GET['width'] > "300") { $descr_len = "40"; } else { $descr_len = "22"; }
|
||||
|
||||
$rrd_options .= " -l 0 -E ";
|
||||
$iter = "1";
|
||||
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='temperature' AND device_id = '$id' ORDER BY sensor_index");
|
||||
$rrd_options .= " COMMENT:'".str_pad('',$descr_len)." Cur Min Max\\n'";
|
||||
while($temperature = mysql_fetch_array($sql))
|
||||
while ($temperature = mysql_fetch_array($sql))
|
||||
{
|
||||
switch ($iter)
|
||||
{
|
||||
@@ -48,5 +48,4 @@ while($temperature = mysql_fetch_array($sql))
|
||||
$iter++;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
@@ -8,7 +8,7 @@ $rrd_options .= " -l 0 -E ";
|
||||
$iter = "1";
|
||||
$sql = mysql_query("SELECT * FROM toner where device_id = '$id'");
|
||||
$rrd_options .= " COMMENT:'Toner level Cur Min Max\\n'";
|
||||
while($toner = mysql_fetch_array($sql))
|
||||
while ($toner = mysql_fetch_array($sql))
|
||||
{
|
||||
switch ($iter)
|
||||
{
|
||||
@@ -57,4 +57,4 @@ while($toner = mysql_fetch_array($sql))
|
||||
$iter++;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
@@ -5,12 +5,12 @@ $device = device_by_id_cache($id);
|
||||
|
||||
$rrd_options .= " -l 0 -E ";
|
||||
|
||||
if($_GET['width'] > "300") { $descr_len = "38"; } else { $descr_len = "18"; }
|
||||
if ($_GET['width'] > "300") { $descr_len = "38"; } else { $descr_len = "18"; }
|
||||
$rrd_options .= " COMMENT:'".str_pad('',$descr_len)." Cur Min Max\\n'";
|
||||
|
||||
$iter = "1";
|
||||
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='voltage' AND device_id = '$id'");
|
||||
while($sensor = mysql_fetch_array($sql))
|
||||
while ($sensor = mysql_fetch_array($sql))
|
||||
{
|
||||
switch ($iter)
|
||||
{
|
||||
@@ -39,7 +39,6 @@ while($sensor = mysql_fetch_array($sql))
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], $descr_len),0,$descr_len);
|
||||
$sensor['sensor_descr_fixed'] = str_replace(':','\:',str_replace('\*','*',$sensor['sensor_descr_fixed']));
|
||||
|
||||
@@ -54,5 +53,4 @@ while($sensor = mysql_fetch_array($sql))
|
||||
$iter++;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
?>
|
Reference in New Issue
Block a user