mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
graphing system updates
git-svn-id: http://www.observium.org/svn/observer/trunk@1599 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -2,12 +2,7 @@
|
||||
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
$query = mysql_query("SELECT * FROM `applications` AS A, `devices` AS D WHERE A.app_id = '".mres($_GET['id'])."'
|
||||
AND A.device_id = D.device_id");
|
||||
|
||||
$app = mysql_fetch_array($query);
|
||||
|
||||
$apache_rrd = $config['rrd_dir'] . "/" . $app['hostname'] . "/app-apache-".$app['app_id'].".rrd";
|
||||
$apache_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-apache-".$app['app_id'].".rrd";
|
||||
|
||||
if(is_file($apache_rrd)) {
|
||||
$rrd_filename = $apache_rrd;
|
||||
|
@@ -2,12 +2,7 @@
|
||||
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
$query = mysql_query("SELECT * FROM `applications` AS A, `devices` AS D WHERE A.app_id = '".mres($_GET['id'])."'
|
||||
AND A.device_id = D.device_id");
|
||||
|
||||
$app = mysql_fetch_array($query);
|
||||
|
||||
$apache_rrd = $config['rrd_dir'] . "/" . $app['hostname'] . "/app-apache-".$app['app_id'].".rrd";
|
||||
$apache_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-apache-".$app['app_id'].".rrd";
|
||||
|
||||
if(is_file($apache_rrd)) {
|
||||
$rrd_filename = $apache_rrd;
|
||||
|
@@ -2,12 +2,7 @@
|
||||
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
$query = mysql_query("SELECT * FROM `applications` AS A, `devices` AS D WHERE A.app_id = '".mres($_GET['id'])."'
|
||||
AND A.device_id = D.device_id");
|
||||
|
||||
$app = mysql_fetch_array($query);
|
||||
|
||||
$apache_rrd = $config['rrd_dir'] . "/" . $app['hostname'] . "/app-apache-".$app['app_id'].".rrd";
|
||||
$apache_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-apache-".$app['app_id'].".rrd";
|
||||
|
||||
if(is_file($apache_rrd)) {
|
||||
$rrd_filename = $apache_rrd;
|
||||
|
@@ -2,12 +2,7 @@
|
||||
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
$query = mysql_query("SELECT * FROM `applications` AS A, `devices` AS D WHERE A.app_id = '".mres($_GET['id'])."'
|
||||
AND A.device_id = D.device_id");
|
||||
|
||||
$app = mysql_fetch_array($query);
|
||||
|
||||
$apache_rrd = $config['rrd_dir'] . "/" . $app['hostname'] . "/app-apache-".$app['app_id'].".rrd";
|
||||
$apache_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-apache-".$app['app_id'].".rrd";
|
||||
|
||||
if(is_file($apache_rrd)) {
|
||||
$rrd_filename = $apache_rrd;
|
||||
|
12
html/includes/graphs/application/auth.inc.php
Normal file
12
html/includes/graphs/application/auth.inc.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?
|
||||
|
||||
if(is_numeric($id) && application_permitted($id))
|
||||
{
|
||||
$app = get_application_by_id($id);
|
||||
$device = device_by_id_cache($app['device_id']);
|
||||
$title = generatedevicelink($device);
|
||||
$title .= $graph_subtype;
|
||||
$auth = TRUE;
|
||||
}
|
||||
|
||||
?>
|
10
html/includes/graphs/customer/auth.inc.php
Executable file
10
html/includes/graphs/customer/auth.inc.php
Executable file
@@ -0,0 +1,10 @@
|
||||
<?
|
||||
|
||||
if ($_SESSION['userlevel'] >= "5")
|
||||
{
|
||||
$id = mres($_GET['id']);
|
||||
$title = generatedevicelink($device);
|
||||
$auth = TRUE;
|
||||
}
|
||||
|
||||
?>
|
@@ -1,11 +1,10 @@
|
||||
<?
|
||||
|
||||
if(is_numeric($id)) {
|
||||
if(is_numeric($id) && device_permitted($id))
|
||||
{
|
||||
$device = device_by_id_cache($id);
|
||||
$title = generatedevicelink($device);
|
||||
$auth = TRUE;
|
||||
}
|
||||
|
||||
#if(!device_permitted($device['device_id'])) { echo("Not Permitted"); exit; }
|
||||
|
||||
$title = generatedevicelink($device);
|
||||
|
||||
?>
|
||||
|
24
html/includes/graphs/diskio/auth.inc.php
Normal file
24
html/includes/graphs/diskio/auth.inc.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
if(is_numeric($id))
|
||||
{
|
||||
|
||||
$query = mysql_query("SELECT * FROM `ucd_diskio` AS U, `devices` AS D WHERE U.diskio_id = '".$id."' AND U.device_id = D.device_id");
|
||||
$disk = mysql_fetch_array($query);
|
||||
|
||||
if(is_numeric($disk['device_id']) && device_permitted($disk['device_id']))
|
||||
{
|
||||
$device = device_by_id_cache($disk['device_id']);
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $disk['hostname'] . "/ucd_diskio-" . safename($disk['diskio_descr'] . ".rrd");
|
||||
|
||||
$title = generatedevicelink($device);
|
||||
$title .= " :: Disk :: " . htmlentities($disk['diskio_descr']);
|
||||
$auth = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
@@ -1,14 +1,5 @@
|
||||
<?php
|
||||
|
||||
if($_GET['id']) { $id = $_GET['id']; }
|
||||
|
||||
$query = mysql_query("SELECT * FROM `ucd_diskio` AS U, `devices` AS D WHERE U.diskio_id = '".$id."' AND U.device_id = D.device_id");
|
||||
|
||||
$disk = mysql_fetch_array($query);
|
||||
if(is_file($config['rrd_dir'] . "/" . $disk['hostname'] . "/ucd_diskio-" . safename($disk['diskio_descr'] . ".rrd"))) {
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $disk['hostname'] . "/ucd_diskio-" . safename($disk['diskio_descr'] . ".rrd");
|
||||
}
|
||||
|
||||
$rra_in = "read";
|
||||
$rra_out = "written";
|
||||
|
||||
|
@@ -69,35 +69,42 @@ if($_GET['debug']) {
|
||||
|
||||
if(is_file($config['install_dir'] . "/html/includes/graphs/$type/$subtype.inc.php")) {
|
||||
include($config['install_dir'] . "/html/includes/graphs/$type/auth.inc.php");
|
||||
include($config['install_dir'] . "/html/includes/graphs/$type/$subtype.inc.php");
|
||||
if($auth) {
|
||||
include($config['install_dir'] . "/html/includes/graphs/$type/$subtype.inc.php");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($rrd_options) {
|
||||
if($auth)
|
||||
{
|
||||
if($rrd_options)
|
||||
{
|
||||
|
||||
if($config['rrdcached']) { $rrd_switches = " --daemon ".$config['rrdcached'] . " "; }
|
||||
$rrd_cmd = $config['rrdtool'] . " graph $graphfile $rrd_options" . $rrd_switches;
|
||||
$woo = shell_exec($rrd_cmd);
|
||||
if($_GET['debug']) { echo("<pre>".$rrd_cmd."</pre>"); }
|
||||
# $thing = popen($config['rrdtool'] . " -",'w');
|
||||
# fputs($thing, "graph $graphfile $rrd_options");
|
||||
# pclose($thing);
|
||||
if(is_file($graphfile)) {
|
||||
header('Content-type: image/png');
|
||||
$fd = fopen($graphfile,'r');fpassthru($fd);fclose($fd);
|
||||
unlink($graphfile);
|
||||
} else {
|
||||
header('Content-type: image/png');
|
||||
$string = "Graph Generation Error";
|
||||
$im = imagecreate($width, $height);
|
||||
$orange = imagecolorallocate($im, 255, 255, 255);
|
||||
$px = (imagesx($im) - 7.5 * strlen($string)) / 2;
|
||||
imagestring($im, 3, $px, $height / 2 - 8, $string, imagecolorallocate($im, 128, 0, 0));
|
||||
imagepng($im);
|
||||
imagedestroy($im);
|
||||
if($config['rrdcached']) { $rrd_switches = " --daemon ".$config['rrdcached'] . " "; }
|
||||
$rrd_cmd = $config['rrdtool'] . " graph $graphfile $rrd_options" . $rrd_switches;
|
||||
$woo = shell_exec($rrd_cmd);
|
||||
if($_GET['debug']) { echo("<pre>".$rrd_cmd."</pre>"); }
|
||||
# $thing = popen($config['rrdtool'] . " -",'w');
|
||||
# fputs($thing, "graph $graphfile $rrd_options");
|
||||
# pclose($thing);
|
||||
if(is_file($graphfile)) {
|
||||
header('Content-type: image/png');
|
||||
$fd = fopen($graphfile,'r');fpassthru($fd);fclose($fd);
|
||||
unlink($graphfile);
|
||||
} else {
|
||||
header('Content-type: image/png');
|
||||
$string = "Graph Generation Error";
|
||||
$im = imagecreate($width, $height);
|
||||
$orange = imagecolorallocate($im, 255, 255, 255);
|
||||
$px = (imagesx($im) - 7.5 * strlen($string)) / 2;
|
||||
imagestring($im, 3, $px, $height / 2 - 8, $string, imagecolorallocate($im, 128, 0, 0));
|
||||
imagepng($im);
|
||||
imagedestroy($im);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$fd = fopen($config['install_dir']."/html/images/no-48.png",r);fpassthru($fd);fclose($fd);
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
18
html/includes/graphs/mempool/auth.inc.php
Executable file
18
html/includes/graphs/mempool/auth.inc.php
Executable file
@@ -0,0 +1,18 @@
|
||||
<?
|
||||
|
||||
if(is_numeric($_GET['id']))
|
||||
{
|
||||
$sql = mysql_query("SELECT * FROM `mempools` AS C, `devices` AS D where C.`mempool_id` = '".mres($_GET['id'])."' AND C.device_id = D.device_id");
|
||||
$mempool = mysql_fetch_assoc($sql);
|
||||
|
||||
if(is_numeric($mempool['device_id']) && device_permitted($mempool['device_id']))
|
||||
{
|
||||
$device = device_by_id_cache($mempool['device_id']);
|
||||
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("mempool-".$mempool['mempool_type']."-".$mempool['mempool_index'].".rrd");
|
||||
$title = generatedevicelink($device);
|
||||
$title .= " :: Memory Pool :: " . htmlentities($mempool['mempool_descr']);
|
||||
$auth = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@@ -5,27 +5,23 @@ include("includes/graphs/common.inc.php");
|
||||
$rrd_options .= " -u 100 -l 0 -E -b 1024 ";
|
||||
|
||||
$iter = "1";
|
||||
$sql = mysql_query("SELECT * FROM `mempools` AS C, `devices` AS D where C.`mempool_id` = '".mres($_GET['id'])."' AND C.device_id = D.device_id");
|
||||
$rrd_options .= " COMMENT:' Used\\n'";
|
||||
while($mempool = 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"; unset($iter); }
|
||||
$descr = substr(str_pad(short_hrDeviceDescr($mempool['mempool_descr']), 24),0,24);
|
||||
$descr = str_replace(":", "\:", $descr);
|
||||
$rrd = $config['rrd_dir'] . "/".$mempool['hostname']."/" . safename("mempool-".$mempool['mempool_type']."-".$mempool['mempool_index'].".rrd");
|
||||
$rrd_options .= " DEF:mempoolfree=$rrd:free:AVERAGE ";
|
||||
$rrd_options .= " DEF:mempoolused=$rrd:used:AVERAGE ";
|
||||
$rrd_options .= " CDEF:mempooltotal=mempoolused,mempoolfree,+ ";
|
||||
$rrd_options .= " CDEF:mempoolperc=mempoolused,mempoolused,mempoolfree,+,/,100,* ";
|
||||
$rrd_options .= " LINE1:mempoolperc#" . $colour . ":'" . $descr . "' ";
|
||||
$rrd_options .= " GPRINT:mempoolused:LAST:%6.2lf%sB";
|
||||
#$rrd_options .= " GPRINT:mempooltotal:LAST:%6.2lf%sB";
|
||||
$rrd_options .= " GPRINT:mempoolperc:LAST:%3.0lf%%\\\\n";
|
||||
#$rrd_options .= " GPRINT:mempoolperc:MAX:%3.0lf";
|
||||
|
||||
$iter++;
|
||||
}
|
||||
$rrd_options .= " COMMENT:' Used\\n'";
|
||||
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']), 24),0,24);
|
||||
$descr = str_replace(":", "\:", $descr);
|
||||
|
||||
$rrd_options .= " DEF:mempoolfree=$rrd_filename:free:AVERAGE ";
|
||||
$rrd_options .= " DEF:mempoolused=$rrd_filename:used:AVERAGE ";
|
||||
$rrd_options .= " CDEF:mempooltotal=mempoolused,mempoolfree,+ ";
|
||||
$rrd_options .= " CDEF:mempoolperc=mempoolused,mempoolused,mempoolfree,+,/,100,* ";
|
||||
$rrd_options .= " LINE1:mempoolperc#" . $colour . ":'" . $descr . "' ";
|
||||
$rrd_options .= " GPRINT:mempoolused:LAST:%6.2lf%sB";
|
||||
#$rrd_options .= " GPRINT:mempooltotal:LAST:%6.2lf%sB";
|
||||
$rrd_options .= " GPRINT:mempoolperc:LAST:%3.0lf%%\\\\n";
|
||||
#$rrd_options .= " GPRINT:mempoolperc:MAX:%3.0lf";
|
||||
|
||||
|
||||
?>
|
||||
|
@@ -1,14 +1,11 @@
|
||||
<?
|
||||
|
||||
if(is_numeric($_GET['id']) && interfacepermitted($_GET['id'])) {
|
||||
$port = get_port_by_id($_GET['id']);
|
||||
if(is_numeric($id) && port_permitted($id)) {
|
||||
$port = get_port_by_id($id);
|
||||
$device = device_by_id_cache($port['device_id']);
|
||||
|
||||
$title = generatedevicelink($device);
|
||||
$title .= " :: Port ".generateiflink($port);
|
||||
|
||||
$auth = TRUE;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
15
html/includes/graphs/processor/auth.inc.php
Executable file
15
html/includes/graphs/processor/auth.inc.php
Executable file
@@ -0,0 +1,15 @@
|
||||
<?
|
||||
|
||||
$sql = mysql_query("SELECT * FROM `processors` where `processor_id` = '".mres($_GET['id'])."'");
|
||||
$proc = mysql_fetch_assoc($sql);
|
||||
|
||||
if(is_numeric($proc['device_id']) && device_permitted($proc['device_id']))
|
||||
{
|
||||
$device = device_by_id_cache($proc['device_id']);
|
||||
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("processor-" . $proc['processor_type'] . "-" . $proc['processor_index'] . ".rrd");
|
||||
$title = generatedevicelink($device);
|
||||
$title .= " :: Processor :: " . htmlentities($proc['processor_descr']);
|
||||
$auth = TRUE;
|
||||
}
|
||||
|
||||
?>
|
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
$scale_min = "0";
|
||||
$scale_max = "100";
|
||||
|
||||
@@ -7,27 +6,24 @@ include("includes/graphs/common.inc.php");
|
||||
|
||||
$iter = "1";
|
||||
|
||||
$sql = mysql_query("SELECT * FROM `processors` AS P, `devices` AS D where P.`processor_id` = '".mres($_GET['id'])."' AND P.device_id = D.device_id");
|
||||
$rrd_options .= " COMMENT:' Cur Max\\n'";
|
||||
while($proc = 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"; unset($iter); }
|
||||
$descr = substr(str_pad(short_hrDeviceDescr($proc['processor_descr']), 28),0,28);
|
||||
$descr = str_replace(":", "\:", $descr);
|
||||
$rrd = $config['rrd_dir'] . "/".$proc['hostname']."/" . safename("processor-" . $proc['processor_type'] . "-" . $proc['processor_index'] . ".rrd");
|
||||
$rrd_options .= " DEF:proc" . $proc['hrDeviceIndex'] . "=$rrd:usage:AVERAGE ";
|
||||
$rrd_options .= " DEF:proc_max=$rrd:usage:MAX";
|
||||
$rrd_options .= " DEF:proc_min=$rrd:usage:MIN";
|
||||
|
||||
$rrd_options .= " AREA:proc_max#c5c5c5";
|
||||
$rrd_options .= " AREA:proc_min#ffffffff";
|
||||
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($proc['processor_descr']), 28),0,28);
|
||||
$descr = str_replace(":", "\:", $descr);
|
||||
|
||||
$rrd_options .= " LINE1:proc" . $proc['hrDeviceIndex'] . "#" . $colour . ":'" . $descr . "' ";
|
||||
$rrd_options .= " GPRINT:proc" . $proc['hrDeviceIndex'] . ":LAST:%3.0lf";
|
||||
$rrd_options .= " GPRINT:proc" . $proc['hrDeviceIndex'] . ":MAX:%3.0lf\\\l ";
|
||||
$iter++;
|
||||
}
|
||||
$rrd_options .= " DEF:proc" . $proc['hrDeviceIndex'] . "=".$rrd_filename.":usage:AVERAGE ";
|
||||
$rrd_options .= " DEF:proc_max=".$rrd_filename.":usage:MAX";
|
||||
$rrd_options .= " DEF:proc_min=".$rrd_filename.":usage:MIN";
|
||||
|
||||
$rrd_options .= " AREA:proc_max#c5c5c5";
|
||||
$rrd_options .= " AREA:proc_min#ffffffff";
|
||||
|
||||
$rrd_options .= " LINE1:proc" . $proc['hrDeviceIndex'] . "#" . $colour . ":'" . $descr . "' ";
|
||||
$rrd_options .= " GPRINT:proc" . $proc['hrDeviceIndex'] . ":LAST:%3.0lf";
|
||||
$rrd_options .= " GPRINT:proc" . $proc['hrDeviceIndex'] . ":MAX:%3.0lf\\\l ";
|
||||
$iter++;
|
||||
|
||||
?>
|
||||
|
@@ -1,8 +1,23 @@
|
||||
<?php
|
||||
|
||||
$sensor = mysql_fetch_array(mysql_query("SELECT * FROM sensors WHERE sensor_id = '".mres($_GET['id'])."'"));
|
||||
$device = device_by_id_cache($sensor['device_id']);
|
||||
if(is_numeric($id))
|
||||
{
|
||||
$sensor = mysql_fetch_assoc(mysql_query("SELECT * FROM sensors WHERE sensor_id = '".mres($id)."'"));
|
||||
|
||||
if(is_numeric($sensor['device_id']) && device_permitted($sensor['device_id']))
|
||||
{
|
||||
$device = device_by_id_cache($sensor['device_id']);
|
||||
|
||||
### This doesn't quite work for all yet.
|
||||
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename($sensor['sensor_class']."-" . $sensor['sensor_type'] . "-".$sensor['sensor_index'].".rrd");
|
||||
|
||||
$title = generatedevicelink($device);
|
||||
$title .= " :: Sensor :: " . htmlentities($sensor['sensor_descr']);
|
||||
$auth = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
## FIXME WE ACTUALLY NEED TO AUTH, OK?
|
||||
|
||||
?>
|
||||
|
@@ -4,18 +4,14 @@ $scale_min = "0";
|
||||
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("current-" . $sensor['sensor_descr'] . ".rrd");
|
||||
|
||||
$rrd_options .= " COMMENT:' Last Max\\n'";
|
||||
|
||||
$current = mysql_fetch_array(mysql_query("SELECT * FROM sensors WHERE sensor_class='current' AND sensor_id = '".mres($_GET['id'])."'"));
|
||||
|
||||
$hostname = mysql_result(mysql_query("SELECT hostname FROM devices WHERE device_id = '" . $current['device_id'] . "'"),0);
|
||||
|
||||
$current['sensor_descr_fixed'] = substr(str_pad($current['sensor_descr'], 28),0,28);
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/".$hostname."/" . safename("current-" . $current['sensor_descr'] . ".rrd");
|
||||
$sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], 28),0,28);
|
||||
|
||||
$rrd_options .= " DEF:current=$rrd_filename:current:AVERAGE";
|
||||
$rrd_options .= " LINE1.5:current#cc0000:'" . $current['sensor_descr_fixed']."'";
|
||||
$rrd_options .= " LINE1.5:current#cc0000:'" . $sensor['sensor_descr_fixed']."'";
|
||||
$rrd_options .= " GPRINT:current:LAST:%3.0lfA";
|
||||
$rrd_options .= " GPRINT:current:MAX:%3.0lfA\\\\l";
|
||||
|
||||
|
18
html/includes/graphs/sensor/fanspeed.inc.php
Normal file
18
html/includes/graphs/sensor/fanspeed.inc.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
$scale_min = "0";
|
||||
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
$rrd_options .= " COMMENT:' Last Max\\n'";
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("fan-" . $sensor['sensor_descr'] . ".rrd");
|
||||
|
||||
$sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], 20),0,20);
|
||||
|
||||
$rrd_options .= " DEF:fan=$rrd_filename:fan:AVERAGE";
|
||||
$rrd_options .= " LINE1.5:fan#cc0000:'" . str_replace(':','\:',str_replace('\*','*',quotemeta($sensor['sensor_descr_fixed'])))."'"; # Ugly hack :(
|
||||
$rrd_options .= " GPRINT:fan:LAST:%3.0lfrpm";
|
||||
$rrd_options .= " GPRINT:fan:MAX:%3.0lfrpm\\\\l";
|
||||
|
||||
?>
|
@@ -4,18 +4,14 @@ $scale_min = "0";
|
||||
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("freq-" . $sensor['sensor_descr'] . ".rrd");
|
||||
|
||||
$rrd_options .= " COMMENT:' Last Max\\n'";
|
||||
|
||||
$frequency = mysql_fetch_array(mysql_query("SELECT * FROM sensors where sensor_class='freq' AND sensor_id = '".mres($_GET['id'])."'"));
|
||||
|
||||
$hostname = mysql_result(mysql_query("SELECT hostname FROM devices WHERE device_id = '" . $frequency['device_id'] . "'"),0);
|
||||
|
||||
$frequency['sensor_descr_fixed'] = substr(str_pad($frequency['sensor_descr'], 28),0,28);
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/".$hostname."/" . safename("freq-" . $frequency['sensor_descr'] . ".rrd");
|
||||
$sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], 28),0,28);
|
||||
|
||||
$rrd_options .= " DEF:freq=$rrd_filename:freq:AVERAGE";
|
||||
$rrd_options .= " LINE1.5:freq#cc0000:'" . $frequency['sensor_descr_fixed']."'";
|
||||
$rrd_options .= " LINE1.5:freq#cc0000:'" . $sensor['sensor_descr_fixed']."'";
|
||||
$rrd_options .= " GPRINT:freq:LAST:%3.0lfHz";
|
||||
$rrd_options .= " GPRINT:freq:MAX:%3.0lfHz\\\\l";
|
||||
|
||||
|
@@ -7,29 +7,23 @@ include("includes/graphs/common.inc.php");
|
||||
|
||||
$rrd_options .= " COMMENT:' Last Max\\n'";
|
||||
|
||||
$humidity = mysql_fetch_array(mysql_query("SELECT * FROM sensors WHERE sensor_class='humidity' AND sensor_id = '".mres($_GET['id'])."'"));
|
||||
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("humidity-" . $sensor['sensor_descr'] . ".rrd");
|
||||
|
||||
$hostname = mysql_result(mysql_query("SELECT hostname FROM devices WHERE device_id = '" . $humidity['device_id'] . "'"),0);
|
||||
|
||||
$humidity['sensor_descr_fixed'] = substr(str_pad($humidity['sensor_descr'], 28),0,28);
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/".$hostname."/" . safename("humidity-" . $humidity['sensor_descr'] . ".rrd");
|
||||
|
||||
$sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], 28),0,28);
|
||||
|
||||
$rrd_options .= " DEF:humidity=$rrd_filename:humidity:AVERAGE";
|
||||
$rrd_options .= " DEF:humidity_max=$rrd_filename:humidity:MAX";
|
||||
$rrd_options .= " DEF:humidity_min=$rrd_filename:humidity:MIN";
|
||||
$rrd_options .= " CDEF:humiditywarm=humidity_max,".$humidity['sensor_limit'].",GT,humidity,UNKN,IF";
|
||||
$rrd_options .= " CDEF:humiditywarm=humidity_max,".$sensor['sensor_limit'].",GT,humidity,UNKN,IF";
|
||||
$rrd_options .= " CDEF:humiditycold=humidity_min,20,LT,humidity,UNKN,IF";
|
||||
$rrd_options .= " AREA:humidity_max#c5c5c5";
|
||||
$rrd_options .= " AREA:humidity_min#ffffffff";
|
||||
|
||||
|
||||
|
||||
# $rrd_options .= " AREA:humidity#bbd392";
|
||||
# $rrd_options .= " AREA:humiditywarm#FFCCCC";
|
||||
# $rrd_options .= " AREA:humiditycold#CCCCFF";
|
||||
$rrd_options .= " LINE1:humidity#cc0000:'" . str_replace(':','\:',str_replace('\*','*',quotemeta($humidity['sensor_descr_fixed'])))."'"; # Ugly hack :(
|
||||
$rrd_options .= " LINE1:humidity#cc0000:'" . str_replace(':','\:',str_replace('\*','*',quotemeta($sensor['sensor_descr_fixed'])))."'"; # Ugly hack :(
|
||||
$rrd_options .= " LINE1:humiditywarm#660000";
|
||||
$rrd_options .= " GPRINT:humidity:LAST:%3.0lf%%";
|
||||
$rrd_options .= " GPRINT:humidity:MAX:%3.0lf%%\\\\l";
|
||||
|
@@ -7,14 +7,13 @@ include("includes/graphs/common.inc.php");
|
||||
|
||||
$rrd_options .= " COMMENT:' Cur Min Max\\n'";
|
||||
|
||||
$sensor = mysql_fetch_array(mysql_query("SELECT * FROM sensors where sensor_id = '".mres($_GET['id'])."'"));
|
||||
$device = device_by_id_cache($sensor['device_id']);
|
||||
### FIXME: Overwrite default because it won't work here yet
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/temp-" . safename($sensor['sensor_type']."-".$sensor['sensor_index']) . ".rrd";
|
||||
|
||||
|
||||
$sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], 22),0,22);
|
||||
$sensor['sensor_descr_fixed'] = str_replace(':','\:',str_replace('\*','*',$sensor['sensor_descr_fixed']));
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/temp-" . safename($sensor['sensor_type']."-".$sensor['sensor_index']) . ".rrd";
|
||||
|
||||
$rrd_options .= " DEF:temp=$rrd_filename:temp:AVERAGE";
|
||||
$rrd_options .= " DEF:temp_max=$rrd_filename:temp:MAX";
|
||||
$rrd_options .= " DEF:temp_min=$rrd_filename:temp:MIN";
|
||||
|
@@ -4,15 +4,14 @@ $scale_min = "0";
|
||||
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
$rrd_options .= " -A ";
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/volt-" . safename($sensor['sensor_type']."-".$sensor['sensor_index']) . ".rrd";
|
||||
|
||||
$rrd_options .= " -A ";
|
||||
$rrd_options .= " COMMENT:' Last Max\\n'";
|
||||
|
||||
$sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], 22),0,22);
|
||||
$sensor['sensor_descr_fixed'] = str_replace(':','\:',str_replace('\*','*',$sensor['sensor_descr_fixed']));
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/volt-" . safename($sensor['sensor_type']."-".$sensor['sensor_index']) . ".rrd";
|
||||
|
||||
$rrd_options .= " DEF:volt=$rrd_filename:volt:AVERAGE";
|
||||
$rrd_options .= " DEF:volt_max=$rrd_filename:volt:MAX";
|
||||
$rrd_options .= " DEF:volt_min=$rrd_filename:volt:MIN";
|
||||
|
@@ -9,18 +9,17 @@ $rrd_options .= " -b 1024";
|
||||
|
||||
|
||||
$iter = "1";
|
||||
$sql = mysql_query("SELECT * FROM storage where storage_id = '".mres($_GET['id'])."'");
|
||||
|
||||
$rrd_options .= " COMMENT:' Size Free % Used\\n'";
|
||||
while($storage = mysql_fetch_array($sql)) {
|
||||
|
||||
$hostname = gethostbyid($storage['device_id']);
|
||||
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'] . "/" . $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 .= " DEF:$storage[storage_id]used=$rrd_filename:used:AVERAGE";
|
||||
$rrd_options .= " DEF:$storage[storage_id]free=$rrd_filename: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'";
|
||||
@@ -28,6 +27,5 @@ $rrd_options .= " -b 1024";
|
||||
$rrd_options .= " GPRINT:$storage[storage_id]free:LAST:%6.2lf%sB";
|
||||
$rrd_options .= " GPRINT:$storage[storage_id]perc:LAST:%5.2lf%%\\\\n";
|
||||
$iter++;
|
||||
}
|
||||
|
||||
?>
|
||||
|
Reference in New Issue
Block a user