mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-01 00:24:21 +02:00
Move voltages to sensors table, clean up some unused functions and move web-only functions to the html includes file
git-svn-id: http://www.observium.org/svn/observer/trunk@1311 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -240,4 +240,43 @@ function print_optionbar_end ()
|
||||
</div>");
|
||||
}
|
||||
|
||||
function geteventicon ($message)
|
||||
{
|
||||
if ($message == "Device status changed to Down") { $icon = "server_connect.png"; }
|
||||
if ($message == "Device status changed to Up") { $icon = "server_go.png"; }
|
||||
if ($message == "Interface went down" || $message == "Interface changed state to Down" ) { $icon = "if-disconnect.png"; }
|
||||
if ($message == "Interface went up" || $message == "Interface changed state to Up" ) { $icon = "if-connect.png"; }
|
||||
if ($message == "Interface disabled") { $icon = "if-disable.png"; }
|
||||
if ($message == "Interface enabled") { $icon = "if-enable.png"; }
|
||||
if (isset($icon)) { return $icon; } else { return false; }
|
||||
}
|
||||
|
||||
function overlibprint($text) {
|
||||
return "onmouseover=\"return overlib('" . $text . "');\" onmouseout=\"return nd();\"";
|
||||
}
|
||||
|
||||
function humanmedia($media)
|
||||
{
|
||||
array_preg_replace($rewrite_iftype, $media);
|
||||
return $media;
|
||||
}
|
||||
|
||||
function humanspeed($speed)
|
||||
{
|
||||
$speed = formatRates($speed);
|
||||
if ($speed == "") { $speed = "-"; }
|
||||
return $speed;
|
||||
}
|
||||
|
||||
function print_error($text)
|
||||
{
|
||||
echo('<table class="errorbox" cellpadding="3"><tr><td><img src="/images/15/exclamation.png" align="absmiddle">'.$text.'</td></tr></table>');
|
||||
}
|
||||
|
||||
function print_message($text)
|
||||
{
|
||||
echo('<table class="messagebox" cellpadding="3"><tr><td><img src="/images/16/tick.png" align="absmiddle">'.$text.'</td></tr></table>');
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@@ -6,7 +6,7 @@ $device = device_by_id_cache($id);
|
||||
$rrd_options .= " -l 0 -E ";
|
||||
|
||||
$iter = "1";
|
||||
$sql = mysql_query("SELECT * FROM voltage where device_id = '$id'");
|
||||
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='voltage' AND device_id = '$id'");
|
||||
$rrd_options .= " COMMENT:' Cur Min Max\\n'";
|
||||
while($voltage = mysql_fetch_array($sql))
|
||||
{
|
||||
@@ -39,9 +39,9 @@ while($voltage = mysql_fetch_array($sql))
|
||||
|
||||
$hostname = gethostbyid($voltage['device_id']);
|
||||
|
||||
$descr = substr(str_pad($voltage['volt_descr'], 15),0,15);
|
||||
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("volt-" . $voltage['volt_descr'] . ".rrd");
|
||||
$volt_id = $voltage['volt_id'];
|
||||
$descr = substr(str_pad($voltage['sensor_descr'], 15),0,15);
|
||||
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("volt-" . $voltage['sensor_descr'] . ".rrd");
|
||||
$volt_id = $voltage['sensor_id'];
|
||||
|
||||
$rrd_options .= " DEF:volt$volt_id=$rrd_filename:volt:AVERAGE";
|
||||
$rrd_options .= " LINE1:volt$volt_id#".$colour.":'" . $descr . "'";
|
||||
|
||||
@@ -8,13 +8,13 @@ $rrd_options .= " -A ";
|
||||
|
||||
$rrd_options .= " COMMENT:' Last Max\\n'";
|
||||
|
||||
$voltage = mysql_fetch_array(mysql_query("SELECT * FROM voltage where volt_id = '".mres($_GET['id'])."'"));
|
||||
$voltage = mysql_fetch_array(mysql_query("SELECT * FROM sensors WHERE sensor_class='voltage' AND sensor_id = '".mres($_GET['id'])."'"));
|
||||
|
||||
$hostname = mysql_result(mysql_query("SELECT hostname FROM devices WHERE device_id = '" . $voltage['device_id'] . "'"),0);
|
||||
|
||||
$voltage['volt_descr_fixed'] = substr(str_pad($voltage['volt_descr'], 22),0,22);
|
||||
$voltage['sensor_descr_fixed'] = substr(str_pad($voltage['sensor_descr'], 22),0,22);
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/".$hostname."/" . safename("volt-" . $voltage['volt_descr'] . ".rrd");
|
||||
$rrd_filename = $config['rrd_dir'] . "/".$hostname."/" . safename("volt-" . $voltage['sensor_descr'] . ".rrd");
|
||||
|
||||
$rrd_options .= " DEF:volt=$rrd_filename:volt:AVERAGE";
|
||||
$rrd_options .= " DEF:volt_max=$rrd_filename:volt:MAX";
|
||||
@@ -24,7 +24,7 @@ $rrd_options .= " -A ";
|
||||
$rrd_options .= " AREA:volt_min#ffffffff";
|
||||
|
||||
#$rrd_options .= " AREA:volt#FFFF99";
|
||||
$rrd_options .= " LINE1.5:volt#cc0000:'" . $voltage['volt_descr_fixed']."'";
|
||||
$rrd_options .= " LINE1.5:volt#cc0000:'" . $voltage['sensor_descr_fixed']."'";
|
||||
$rrd_options .= " GPRINT:volt:LAST:%3.2lfV";
|
||||
$rrd_options .= " GPRINT:volt:MAX:%3.2lfV\\\\l";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user