mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
syslog fix + device_fanspeeds graph for health main page
git-svn-id: http://www.observium.org/svn/observer/trunk@951 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
55
html/includes/graphs/device_fanspeeds.inc.php
Normal file
55
html/includes/graphs/device_fanspeeds.inc.php
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
include("common.inc.php");
|
||||||
|
|
||||||
|
$rrd_options .= " -l 0 -E ";
|
||||||
|
|
||||||
|
$iter = "1";
|
||||||
|
$sql = mysql_query("SELECT * FROM fanspeed where device_id = '$device_id'");
|
||||||
|
$rrd_options .= " COMMENT:'RPM Cur Min Max\\n'";
|
||||||
|
while($fanspeed = mysql_fetch_array($sql))
|
||||||
|
{
|
||||||
|
switch ($iter)
|
||||||
|
{
|
||||||
|
case "1":
|
||||||
|
$colour= "CC0000";
|
||||||
|
break;
|
||||||
|
case "2":
|
||||||
|
$colour= "008C00";
|
||||||
|
break;
|
||||||
|
case "3":
|
||||||
|
$colour= "4096EE";
|
||||||
|
break;
|
||||||
|
case "4":
|
||||||
|
$colour= "73880A";
|
||||||
|
break;
|
||||||
|
case "5":
|
||||||
|
$colour= "D01F3C";
|
||||||
|
break;
|
||||||
|
case "6":
|
||||||
|
$colour= "36393D";
|
||||||
|
break;
|
||||||
|
case "7":
|
||||||
|
default:
|
||||||
|
$colour= "FF0084";
|
||||||
|
unset($iter);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$hostname = gethostbyid($fanspeed['device_id']);
|
||||||
|
|
||||||
|
$descr = substr(str_pad($fanspeed['fan_descr'], 17),0,17);
|
||||||
|
$rrd_filename = $config['rrd_dir'] . "/".$hostname."/" . safename("fan-" . $fanspeed['fan_descr'] . ".rrd");
|
||||||
|
$fan_id = $fanspeed['fan_id'];
|
||||||
|
|
||||||
|
$rrd_options .= " DEF:fan$fan_id=$rrd_filename:fan:AVERAGE";
|
||||||
|
$rrd_options .= " LINE1:fan$fan_id#".$colour.":'" . $descr . "'";
|
||||||
|
$rrd_options .= " GPRINT:fan$fan_id:AVERAGE:%5.0lf\ ";
|
||||||
|
$rrd_options .= " GPRINT:fan$fan_id:MIN:%5.0lf\ ";
|
||||||
|
$rrd_options .= " GPRINT:fan$fan_id:MAX:%5.0lf\\\\l";
|
||||||
|
|
||||||
|
$iter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -62,7 +62,7 @@ function process_syslog ($entry, $update) {
|
|||||||
$x .= "VALUES ('".$entry['device_id']."','".$entry['program']."','".$entry['facility']."','".$entry['priority']."', '".$entry['level']."', '".$entry['tag']."', '".$entry['msg']."','".$entry['timestamp']."')";
|
$x .= "VALUES ('".$entry['device_id']."','".$entry['program']."','".$entry['facility']."','".$entry['priority']."', '".$entry['level']."', '".$entry['tag']."', '".$entry['msg']."','".$entry['timestamp']."')";
|
||||||
if($update && $entry['device_id']) { mysql_query($x); }
|
if($update && $entry['device_id']) { mysql_query($x); }
|
||||||
unset ($fix);
|
unset ($fix);
|
||||||
}
|
} else { print_r($entry); echo("D-$delete");}
|
||||||
|
|
||||||
return $entry;
|
return $entry;
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
include("config.php");
|
include("config.php");
|
||||||
include("includes/syslog.php");
|
include("includes/syslog.php");
|
||||||
|
include("includes/common.php");
|
||||||
|
|
||||||
$i="1";
|
$i="1";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user