mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix unsetting of cache in the wrong place on discovery of bgp peers on junos, whoops
git-svn-id: http://www.observium.org/svn/observer/trunk@1738 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
<?php
|
||||
|
||||
$graph_type = "sensor_current";
|
||||
$unit = "A";
|
||||
|
||||
if($_SESSION['userlevel'] >= '5') {
|
||||
$sql = "SELECT * FROM `sensors` AS S, `devices` AS D WHERE S.sensor_class='current' AND S.device_id = D.device_id ORDER BY D.hostname, S.sensor_descr";
|
||||
} else {
|
||||
$sql = "SELECT * FROM `current` AS S, `devices` AS D, devices_perms as P WHERE S.sensor_class='current' AND S.device_id = D.device_id AND D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' ORDER BY D.hostname, S.sensor_descr";
|
||||
}
|
||||
|
||||
$graph_type = "sensor_current";
|
||||
|
||||
$query = mysql_query($sql);
|
||||
|
||||
echo('<table cellspacing="0" cellpadding="6" width="100%">');
|
||||
@@ -25,51 +26,51 @@ echo('<tr class=tablehead>
|
||||
|
||||
$row = 1;
|
||||
|
||||
while($current = mysql_fetch_array($query))
|
||||
while($sensor = mysql_fetch_array($query))
|
||||
{
|
||||
if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
|
||||
$weekly_current = "graph.php?id=" . $current['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=500&height=150";
|
||||
$current_popup = "<a href=\"graphs/" . $current['sensor_id'] . "/".$graph_type."/\" onmouseover=\"return overlib('<img src=\'$weekly_current\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
" . $current['sensor_descr'] . "</a>";
|
||||
$weekly_sensor = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=500&height=150";
|
||||
$sensor_popup = "<a href=\"graphs/" . $sensor['sensor_id'] . "/".$graph_type."/\" onmouseover=\"return overlib('<img src=\'$weekly_sensor\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
" . $sensor['sensor_descr'] . "</a>";
|
||||
|
||||
if($current['sensor_current'] >= $current['sensor_limit']) { $alert = '<img src="images/16/flag_red.png" alt="alert" />'; } else { $alert = ""; }
|
||||
if($sensor['sensor_current'] >= $sensor['sensor_limit']) { $alert = '<img src="images/16/flag_red.png" alt="alert" />'; } else { $alert = ""; }
|
||||
|
||||
$current_day = "graph.php?id=" . $current['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=300&height=100";
|
||||
$current_week = "graph.php?id=" . $current['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=300&height=100";
|
||||
$current_month = "graph.php?id=" . $current['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=300&height=100";
|
||||
$current_year = "graph.php?id=" . $current['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=300&height=100";
|
||||
$sensor_day = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=300&height=100";
|
||||
$sensor_week = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=300&height=100";
|
||||
$sensor_month = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=300&height=100";
|
||||
$sensor_year = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=300&height=100";
|
||||
|
||||
$current_minigraph = "<img src='graph.php?id=" . $current['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=100&height=20'";
|
||||
$current_minigraph .= " onmouseover=\"return overlib('<div class=list-large>".$current['hostname']." - ".$current['sensor_descr'];
|
||||
$current_minigraph .= "</div><div style=\'width: 750px\'><img src=\'$current_day\'><img src=\'$current_week\'><img src=\'$current_month\'><img src=\'$current_year\'></div>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
|
||||
$sensor_minigraph = "<img src='graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=100&height=20'";
|
||||
$sensor_minigraph .= " onmouseover=\"return overlib('<div class=list-large>".$sensor['hostname']." - ".$sensor['sensor_descr'];
|
||||
$sensor_minigraph .= "</div><div style=\'width: 750px\'><img src=\'$sensor_day\'><img src=\'$sensor_week\'><img src=\'$sensor_month\'><img src=\'$sensor_year\'></div>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
|
||||
|
||||
echo("<tr bgcolor=$row_colour>
|
||||
<td class=list-bold>" . generate_device_link($current) . "</td>
|
||||
<td>$current_popup</td>
|
||||
<td>$current_minigraph</td>
|
||||
<td class=list-bold>" . generate_device_link($sensor) . "</td>
|
||||
<td>$sensor_popup</td>
|
||||
<td>$sensor_minigraph</td>
|
||||
<td width=100>$alert</td>
|
||||
<td style='text-align: center; font-weight: bold;'>" . $current['sensor_current'] . "A</td>
|
||||
<td style='text-align: center'>" . $current['sensor_limit_warn'] . "A</td>
|
||||
<td style='text-align: center'>" . $current['sensor_limit'] . "A</td>
|
||||
<td>" . (isset($current['sensor_notes']) ? $current['sensor_notes'] : '') . "</td>
|
||||
<td style='text-align: center; font-weight: bold;'>" . $sensor['sensor_current'] . "A</td>
|
||||
<td style='text-align: center'>" . $sensor['sensor_limit_warn'] . $unit . "</td>
|
||||
<td style='text-align: center'>" . $sensor['sensor_limit'] . $unit . "</td>
|
||||
<td>" . (isset($sensor['sensor_notes']) ? $sensor['sensor_notes'] : '') . "</td>
|
||||
</tr>\n");
|
||||
|
||||
if($_GET['optb'] == "graphs") { ## If graphs
|
||||
|
||||
echo("<tr bgcolor='$row_colour'><td colspan=7>");
|
||||
|
||||
$daily_graph = "graph.php?id=" . $current['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100";
|
||||
$daily_url = "graph.php?id=" . $current['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150";
|
||||
$daily_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100";
|
||||
$daily_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150";
|
||||
|
||||
$weekly_graph = "graph.php?id=" . $current['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100";
|
||||
$weekly_url = "graph.php?id=" . $current['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150";
|
||||
$weekly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100";
|
||||
$weekly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150";
|
||||
|
||||
$monthly_graph = "graph.php?id=" . $current['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100";
|
||||
$monthly_url = "graph.php?id=" . $current['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150";
|
||||
$monthly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100";
|
||||
$monthly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150";
|
||||
|
||||
$yearly_graph = "graph.php?id=" . $current['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100";
|
||||
$yearly_url = "graph.php?id=" . $current['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150";
|
||||
$yearly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100";
|
||||
$yearly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150";
|
||||
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
<img src='$daily_graph' border=0></a> ");
|
||||
|
@@ -1,13 +1,14 @@
|
||||
<?php
|
||||
|
||||
$graph_type = "sensor_fanspeed";
|
||||
$unit = "rpm";
|
||||
|
||||
if($_SESSION['userlevel'] >= '5') {
|
||||
$sql = "SELECT * FROM `sensors` AS S, `devices` AS D WHERE S.sensor_class='fanspeed' AND S.device_id = D.device_id ORDER BY D.hostname, S.sensor_descr";
|
||||
} else {
|
||||
$sql = "SELECT * FROM `sensors` AS S, `devices` AS D, devices_perms as P WHERE S.sensor_class='fanspeed' AND S.device_id = D.device_id AND D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' ORDER BY D.hostname, S.sensor_descr";
|
||||
}
|
||||
|
||||
$graph_type = "sensor_fanspeed";
|
||||
|
||||
$query = mysql_query($sql);
|
||||
|
||||
echo('<table cellspacing="0" cellpadding="2" width="100%">');
|
||||
@@ -24,50 +25,50 @@ echo('<tr class=tablehead>
|
||||
|
||||
$row = 1;
|
||||
|
||||
while($fan = mysql_fetch_array($query))
|
||||
while($sensor = mysql_fetch_array($query))
|
||||
{
|
||||
if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
|
||||
$weekly_fan = "graph.php?id=" . $fan['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=500&height=150";
|
||||
$fan_popup = "<a href=\"graphs/" . $fan['sensor_id'] . "/".$graph_type."/\" onmouseover=\"return overlib('<img src=\'$weekly_fan\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
" . $fan['sensor_descr'] . "</a>";
|
||||
$weekly_sensor = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=500&height=150";
|
||||
$sensor_popup = "<a href=\"graphs/" . $sensor['sensor_id'] . "/".$graph_type."/\" onmouseover=\"return overlib('<img src=\'$weekly_sensor\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
" . $sensor['sensor_descr'] . "</a>";
|
||||
|
||||
if($fan['sensor_current'] <= $fan['sensor_limit']) { $alert = '<img src="images/16/flag_red.png" alt="alert" />'; } else { $alert = ""; }
|
||||
if($sensor['sensor_current'] <= $sensor['sensor_limit']) { $alert = '<img src="images/16/flag_red.png" alt="alert" />'; } else { $alert = ""; }
|
||||
|
||||
$fan_day = "graph.php?id=" . $fan['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=300&height=100";
|
||||
$fan_week = "graph.php?id=" . $fan['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=300&height=100";
|
||||
$fan_month = "graph.php?id=" . $fan['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=300&height=100";
|
||||
$fan_year = "graph.php?id=" . $fan['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=300&height=100";
|
||||
$sensor_day = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=300&height=100";
|
||||
$sensor_week = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=300&height=100";
|
||||
$sensor_month = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=300&height=100";
|
||||
$sensor_year = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=300&height=100";
|
||||
|
||||
$fan_minigraph = "<img src='graph.php?id=" . $fan['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=100&height=20'";
|
||||
$fan_minigraph .= " onmouseover=\"return overlib('<div class=list-large>".$fan['hostname']." - ".$fan['sensor_descr'];
|
||||
$fan_minigraph .= "</div><div style=\'width: 750px\'><img src=\'$fan_day\'><img src=\'$fan_week\'><img src=\'$fan_month\'><img src=\'$fan_year\'></div>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
|
||||
$sensor_minigraph = "<img src='graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=100&height=20'";
|
||||
$sensor_minigraph .= " onmouseover=\"return overlib('<div class=list-large>".$sensor['hostname']." - ".$sensor['sensor_descr'];
|
||||
$sensor_minigraph .= "</div><div style=\'width: 750px\'><img src=\'$sensor_day\'><img src=\'$sensor_week\'><img src=\'$sensor_month\'><img src=\'$sensor_year\'></div>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
|
||||
|
||||
echo("<tr bgcolor=$row_colour>
|
||||
<td class=list-bold>" . generate_device_link($fan) . "</td>
|
||||
<td>$fan_popup</td>
|
||||
<td>$fan_minigraph</td>
|
||||
<td class=list-bold>" . generate_device_link($sensor) . "</td>
|
||||
<td>$sensor_popup</td>
|
||||
<td>$sensor_minigraph</td>
|
||||
<td width=100>$alert</td>
|
||||
<td style='text-align: center; font-weight: bold;'>" . $fan['sensor_current'] . " rpm</td>
|
||||
<td style='text-align: center'>" . $fan['sensor_limit'] . " rpm</td>
|
||||
<td>" . (isset($fan['sensor_notes']) ? $fan['sensor_notes'] : '') . "</td>
|
||||
<td style='text-align: center; font-weight: bold;'>" . $sensor['sensor_current'] . $unit . "</td>
|
||||
<td style='text-align: center'>" . $sensor['sensor_limit'] . $unit . "</td>
|
||||
<td>" . (isset($sensor['sensor_notes']) ? $sensor['sensor_notes'] : '') . "</td>
|
||||
</tr>\n");
|
||||
|
||||
if($_GET['optb'] == "graphs") { ## If graphs
|
||||
|
||||
echo("<tr bgcolor='$row_colour'><td colspan=6>");
|
||||
|
||||
$daily_graph = "graph.php?id=" . $fan['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100";
|
||||
$daily_url = "graph.php?id=" . $fan['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150";
|
||||
$daily_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100";
|
||||
$daily_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150";
|
||||
|
||||
$weekly_graph = "graph.php?id=" . $fan['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100";
|
||||
$weekly_url = "graph.php?id=" . $fan['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150";
|
||||
$weekly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100";
|
||||
$weekly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150";
|
||||
|
||||
$monthly_graph = "graph.php?id=" . $fan['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100";
|
||||
$monthly_url = "graph.php?id=" . $fan['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150";
|
||||
$monthly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100";
|
||||
$monthly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150";
|
||||
|
||||
$yearly_graph = "graph.php?id=" . $fan['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100";
|
||||
$yearly_url = "graph.php?id=" . $fan['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150";
|
||||
$yearly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100";
|
||||
$yearly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150";
|
||||
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
<img src='$daily_graph' border=0></a> ");
|
||||
|
@@ -1,13 +1,14 @@
|
||||
<?php
|
||||
|
||||
$graph_type = "sensor_frequency";
|
||||
$unit = "Hz";
|
||||
|
||||
if($_SESSION['userlevel'] >= '5') {
|
||||
$sql = "SELECT * FROM `sensors` AS V, `devices` AS D WHERE V.sensor_class='freq' AND V.device_id = D.device_id ORDER BY D.hostname, V.sensor_descr";
|
||||
} else {
|
||||
$sql = "SELECT * FROM `sensors` AS V, `devices` AS D, devices_perms as P WHERE V.sensor_class='freq' V.device_id = D.device_id AND D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' ORDER BY D.hostname, V.sensor_descr";
|
||||
}
|
||||
|
||||
$graph_type = "sensor_frequency";
|
||||
|
||||
$query = mysql_query($sql);
|
||||
|
||||
echo('<table cellspacing="0" cellpadding="6" width="100%">');
|
||||
@@ -24,50 +25,50 @@ echo('<tr class=tablehead>
|
||||
|
||||
$row = 1;
|
||||
|
||||
while($freq = mysql_fetch_array($query))
|
||||
while($sensor = mysql_fetch_array($query))
|
||||
{
|
||||
if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
|
||||
$weekly_freq = "graph.php?id=" . $freq['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=500&height=150";
|
||||
$sensor_popup = "<a href=\"graphs/" . $freq['sensor_id'] . "/".$graph_type."/\" onmouseover=\"return overlib('<img src=\'$weekly_freq\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
" . $freq['sensor_descr'] . "</a>";
|
||||
$weekly_sensor = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=500&height=150";
|
||||
$sensor_popup = "<a href=\"graphs/" . $sensor['sensor_id'] . "/".$graph_type."/\" onmouseover=\"return overlib('<img src=\'$weekly_sensor\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
" . $sensor['sensor_descr'] . "</a>";
|
||||
|
||||
if($freq['sensor_current'] >= $freq['sensor_limit']) { $alert = '<img src="images/16/flag_red.png" alt="alert" />'; } else { $alert = ""; }
|
||||
if($sensor['sensor_current'] >= $sensor['sensor_limit']) { $alert = '<img src="images/16/flag_red.png" alt="alert" />'; } else { $alert = ""; }
|
||||
|
||||
$sensor_day = "graph.php?id=" . $freq['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=300&height=100";
|
||||
$sensor_week = "graph.php?id=" . $freq['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=300&height=100";
|
||||
$sensor_month = "graph.php?id=" . $freq['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=300&height=100";
|
||||
$sensor_year = "graph.php?id=" . $freq['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=300&height=100";
|
||||
$sensor_day = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=300&height=100";
|
||||
$sensor_week = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=300&height=100";
|
||||
$sensor_month = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=300&height=100";
|
||||
$sensor_year = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=300&height=100";
|
||||
|
||||
$sensor_minigraph = "<img src='graph.php?id=" . $freq['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=100&height=20'";
|
||||
$sensor_minigraph .= " onmouseover=\"return overlib('<div class=list-large>".$freq['hostname']." - ".$freq['sensor_descr'];
|
||||
$sensor_minigraph = "<img src='graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=100&height=20'";
|
||||
$sensor_minigraph .= " onmouseover=\"return overlib('<div class=list-large>".$sensor['hostname']." - ".$sensor['sensor_descr'];
|
||||
$sensor_minigraph .= "</div><div style=\'width: 750px\'><img src=\'$sensor_day\'><img src=\'$sensor_week\'><img src=\'$sensor_month\'><img src=\'$sensor_year\'></div>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
|
||||
|
||||
echo("<tr bgcolor=$row_colour>
|
||||
<td class=list-bold>" . generate_device_link($freq) . "</td>
|
||||
<td class=list-bold>" . generate_device_link($sensor) . "</td>
|
||||
<td>$sensor_popup</td>
|
||||
<td>$sensor_minigraph</td>
|
||||
<td width=100>$alert</td>
|
||||
<td style='text-align: center; font-weight: bold;'>" . $freq['sensor_current'] . "Hz</td>
|
||||
<td style='text-align: center'>" . $freq['sensor_limit_low'] . "Hz - " . $freq['sensor_limit'] . "Hz</td>
|
||||
<td>" . (isset($freq['sensor_notes']) ? $freq['sensor_notes'] : '') . "</td>
|
||||
<td style='text-align: center; font-weight: bold;'>" . $sensor['sensor_current'] . $unit . "</td>
|
||||
<td style='text-align: center'>" . $sensor['sensor_limit_low'] . $unit . " - " . $sensor['sensor_limit'] . $unit . "</td>
|
||||
<td>" . (isset($sensor['sensor_notes']) ? $sensor['sensor_notes'] : '') . "</td>
|
||||
</tr>\n");
|
||||
|
||||
if($_GET['optb'] == "graphs") { ## If graphs
|
||||
|
||||
echo("<tr bgcolor='$row_colour'><td colspan=6>");
|
||||
|
||||
$daily_graph = "graph.php?id=" . $freq['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100";
|
||||
$daily_url = "graph.php?id=" . $freq['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150";
|
||||
$daily_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100";
|
||||
$daily_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150";
|
||||
|
||||
$weekly_graph = "graph.php?id=" . $freq['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100";
|
||||
$weekly_url = "graph.php?id=" . $freq['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150";
|
||||
$weekly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100";
|
||||
$weekly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150";
|
||||
|
||||
$monthly_graph = "graph.php?id=" . $freq['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100";
|
||||
$monthly_url = "graph.php?id=" . $freq['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150";
|
||||
$monthly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100";
|
||||
$monthly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150";
|
||||
|
||||
$yearly_graph = "graph.php?id=" . $freq['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100";
|
||||
$yearly_url = "graph.php?id=" . $freq['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150";
|
||||
$yearly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100";
|
||||
$yearly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150";
|
||||
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
<img src='$daily_graph' border=0></a> ");
|
||||
|
@@ -1,5 +1,8 @@
|
||||
<?php
|
||||
|
||||
$graph_type = "sensor_humidity";
|
||||
$unit = "%";
|
||||
|
||||
if($_SESSION['userlevel'] >= '5') {
|
||||
$sql = "SELECT * FROM `sensors` AS S, `devices` AS D WHERE S.sensor_class='humidity' AND S.device_id = D.device_id ORDER BY D.hostname, S.sensor_index, S.sensor_descr";
|
||||
} else {
|
||||
@@ -8,8 +11,6 @@ if($_SESSION['userlevel'] >= '5') {
|
||||
|
||||
$query = mysql_query($sql);
|
||||
|
||||
$graph_type = "sensor_humidity";
|
||||
|
||||
echo('<table cellspacing="0" cellpadding="6" width="100%">');
|
||||
|
||||
echo('<tr class=tablehead>
|
||||
@@ -24,55 +25,55 @@ echo('<tr class=tablehead>
|
||||
|
||||
$row = 1;
|
||||
|
||||
while($humidity = mysql_fetch_array($query))
|
||||
while($sensor = mysql_fetch_array($query))
|
||||
{
|
||||
if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
|
||||
$weekly_humidity = "graph.php?id=" . $humidity['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=500&height=150";
|
||||
$humidity_popup = "<a href=\"graphs/" . $humidity['sensor_id'] . "/".$graph_type."/\" onmouseover=\"return overlib('<img src=\'$weekly_humidity\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
" . $humidity['sensor_descr'] . "</a>";
|
||||
$weekly_sensor = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=500&height=150";
|
||||
$sensor_popup = "<a href=\"graphs/" . $sensor['sensor_id'] . "/".$graph_type."/\" onmouseover=\"return overlib('<img src=\'$weekly_sensor\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
" . $sensor['sensor_descr'] . "</a>";
|
||||
|
||||
$humidity['sensor_current'] = round($humidity['sensor_current'],1);
|
||||
$sensor['sensor_current'] = round($sensor['sensor_current'],1);
|
||||
|
||||
$humidity_perc = $humidity['sensor_current'] / $humidity['sensor_limit'] * 100;
|
||||
$humidity_colour = percent_colour($humidity_perc);
|
||||
$sensor_perc = $sensor['sensor_current'] / $sensor['sensor_limit'] * 100;
|
||||
$sensor_colour = percent_colour($sensor_perc);
|
||||
|
||||
if($humidity['sensor_current'] >= $humidity['sensor_limit']) { $alert = '<img src="images/16/flag_red.png" alt="alert" />'; } else { $alert = ""; }
|
||||
if($sensor['sensor_current'] >= $sensor['sensor_limit']) { $alert = '<img src="images/16/flag_red.png" alt="alert" />'; } else { $alert = ""; }
|
||||
|
||||
$humidity_day = "graph.php?id=" . $humidity['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=300&height=100";
|
||||
$humidity_week = "graph.php?id=" . $humidity['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=300&height=100";
|
||||
$humidity_month = "graph.php?id=" . $humidity['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=300&height=100";
|
||||
$humidity_year = "graph.php?id=" . $humidity['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=300&height=100";
|
||||
$sensor_day = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=300&height=100";
|
||||
$sensor_week = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=300&height=100";
|
||||
$sensor_month = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=300&height=100";
|
||||
$sensor_year = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=300&height=100";
|
||||
|
||||
$humidity_minigraph = "<img src='graph.php?id=" . $humidity['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=100&height=20'";
|
||||
$humidity_minigraph .= " onmouseover=\"return overlib('<div class=list-large>".$humidity['hostname']." - ".$humidity['sensor_descr'];
|
||||
$humidity_minigraph .= "</div><div style=\'width: 750px\'><img src=\'$humidity_day\'><img src=\'$humidity_week\'><img src=\'$humidity_month\'><img src=\'$humidity_year\'></div>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
|
||||
$sensor_minigraph = "<img src='graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=100&height=20'";
|
||||
$sensor_minigraph .= " onmouseover=\"return overlib('<div class=list-large>".$sensor['hostname']." - ".$sensor['sensor_descr'];
|
||||
$sensor_minigraph .= "</div><div style=\'width: 750px\'><img src=\'$sensor_day\'><img src=\'$sensor_week\'><img src=\'$sensor_month\'><img src=\'$sensor_year\'></div>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
|
||||
|
||||
echo("<tr bgcolor=$row_colour>
|
||||
<td class=list-bold>" . generate_device_link($humidity) . "</td>
|
||||
<td>$humidity_popup</td>
|
||||
<td>$humidity_minigraph</td>
|
||||
<td class=list-bold>" . generate_device_link($sensor) . "</td>
|
||||
<td>$sensor_popup</td>
|
||||
<td>$sensor_minigraph</td>
|
||||
<td width=100>$alert</td>
|
||||
<td style='color: $humidity_colour; text-align: center; font-weight: bold;'>" . $humidity['sensor_current'] . " %</td>
|
||||
<td style='text-align: center'>" . $humidity['sensor_limit'] . " %</td>
|
||||
<td>" . (isset($humidity['sensor_notes']) ? $humidity['sensor_notes'] : '') . "</td>
|
||||
<td style='color: $sensor_colour; text-align: center; font-weight: bold;'>" . $sensor['sensor_current'] . $unit . "</td>
|
||||
<td style='text-align: center'>" . $sensor['sensor_limit'] . $unit . "</td>
|
||||
<td>" . (isset($sensor['sensor_notes']) ? $sensor['sensor_notes'] : '') . "</td>
|
||||
</tr>\n");
|
||||
|
||||
if($_GET['optb'] == "graphs") { ## If graphs
|
||||
|
||||
echo("<tr bgcolor='$row_colour'><td colspan=7>");
|
||||
|
||||
$daily_graph = "graph.php?id=" . $humidity['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100";
|
||||
$daily_url = "graph.php?id=" . $humidity['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150";
|
||||
$daily_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100";
|
||||
$daily_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150";
|
||||
|
||||
$weekly_graph = "graph.php?id=" . $humidity['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100";
|
||||
$weekly_url = "graph.php?id=" . $humidity['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150";
|
||||
$weekly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100";
|
||||
$weekly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150";
|
||||
|
||||
$monthly_graph = "graph.php?id=" . $humidity['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100";
|
||||
$monthly_url = "graph.php?id=" . $humidity['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150";
|
||||
$monthly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100";
|
||||
$monthly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150";
|
||||
|
||||
$yearly_graph = "graph.php?id=" . $humidity['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100";
|
||||
$yearly_url = "graph.php?id=" . $humidity['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150";
|
||||
$yearly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100";
|
||||
$yearly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150";
|
||||
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
<img src='$daily_graph' border=0></a> ");
|
||||
|
@@ -1,13 +1,14 @@
|
||||
<?php
|
||||
|
||||
$graph_type = "sensor_temperature";
|
||||
$unit = "°C";
|
||||
|
||||
if($_SESSION['userlevel'] >= '5') {
|
||||
$sql = "SELECT * FROM `sensors` AS S, `devices` AS D WHERE S.sensor_class='temperature' AND S.device_id = D.device_id ORDER BY D.hostname, S.sensor_index, S.sensor_descr";
|
||||
} else {
|
||||
$sql = "SELECT * FROM `sensors` AS S, `devices` AS D, devices_perms as P WHERE S.sensor_class='temperature' AND S.device_id = D.device_id AND D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' ORDER BY D.hostname, S.sensor_index, S.sensor_descr";
|
||||
}
|
||||
|
||||
$graph_type = "sensor_temperature";
|
||||
|
||||
$query = mysql_query($sql);
|
||||
|
||||
echo('<table cellspacing="0" cellpadding="6" width="100%">');
|
||||
@@ -24,55 +25,55 @@ echo('<tr class=tablehead>
|
||||
|
||||
$row = 1;
|
||||
|
||||
while($temp = mysql_fetch_array($query))
|
||||
while($sensor = mysql_fetch_array($query))
|
||||
{
|
||||
if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
|
||||
$weekly_temp = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=500&height=150";
|
||||
$temp_popup = "<a href=\"graphs/" . $temp['sensor_id'] . "/".$graph_type."/\" onmouseover=\"return overlib('<img src=\'$weekly_temp\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
" . $temp['sensor_descr'] . "</a>";
|
||||
$weekly_sensor = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=500&height=150";
|
||||
$sensor_popup = "<a href=\"graphs/" . $sensor['sensor_id'] . "/".$graph_type."/\" onmouseover=\"return overlib('<img src=\'$weekly_sensor\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
" . $sensor['sensor_descr'] . "</a>";
|
||||
|
||||
$temp['sensor_current'] = round($temp['sensor_current'],1);
|
||||
$sensor['sensor_current'] = round($sensor['sensor_current'],1);
|
||||
|
||||
$temp_perc = $temp['sensor_current'] / $temp['sensor_limit'] * 100;
|
||||
$temp_colour = percent_colour($temp_perc);
|
||||
$sensor_perc = $sensor['sensor_current'] / $sensor['sensor_limit'] * 100;
|
||||
$sensor_colour = percent_colour($sensor_perc);
|
||||
|
||||
if($temp['sensor_current'] >= $temp['sensor_limit']) { $alert = '<img src="images/16/flag_red.png" alt="alert" />'; } else { $alert = ""; }
|
||||
if($sensor['sensor_current'] >= $sensor['sensor_limit']) { $alert = '<img src="images/16/flag_red.png" alt="alert" />'; } else { $alert = ""; }
|
||||
|
||||
$temp_day = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=300&height=100";
|
||||
$temp_week = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=300&height=100";
|
||||
$temp_month = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=300&height=100";
|
||||
$temp_year = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=300&height=100";
|
||||
$sensor_day = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=300&height=100";
|
||||
$sensor_week = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=300&height=100";
|
||||
$sensor_month = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=300&height=100";
|
||||
$sensor_year = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=300&height=100";
|
||||
|
||||
$temp_minigraph = "<img src='graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=100&height=20'";
|
||||
$temp_minigraph .= " onmouseover=\"return overlib('<div class=list-large>".$temp['hostname']." - ".$temp['sensor_descr'];
|
||||
$temp_minigraph .= "</div><div style=\'width: 750px\'><img src=\'$temp_day\'><img src=\'$temp_week\'><img src=\'$temp_month\'><img src=\'$temp_year\'></div>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
|
||||
$sensor_minigraph = "<img src='graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=100&height=20'";
|
||||
$sensor_minigraph .= " onmouseover=\"return overlib('<div class=list-large>".$sensor['hostname']." - ".$sensor['sensor_descr'];
|
||||
$sensor_minigraph .= "</div><div style=\'width: 750px\'><img src=\'$sensor_day\'><img src=\'$sensor_week\'><img src=\'$sensor_month\'><img src=\'$sensor_year\'></div>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
|
||||
|
||||
echo("<tr bgcolor=$row_colour>
|
||||
<td class=list-bold>" . generate_device_link($temp) . "</td>
|
||||
<td>$temp_popup</td>
|
||||
<td>$temp_minigraph</td>
|
||||
<td class=list-bold>" . generate_device_link($sensor) . "</td>
|
||||
<td>$sensor_popup</td>
|
||||
<td>$sensor_minigraph</td>
|
||||
<td width=100>$alert</td>
|
||||
<td style='color: $temp_colour; text-align: center; font-weight: bold;'>" . $temp['sensor_current'] . " °C</td>
|
||||
<td style='text-align: center'>" . $temp['sensor_limit'] . " °C</td>
|
||||
<td>" . (isset($temp['sensor_notes']) ? $temp['sensor_notes'] : '') . "</td>
|
||||
<td style='color: $sensor_colour; text-align: center; font-weight: bold;'>" . $sensor['sensor_current'] . $unit . "</td>
|
||||
<td style='text-align: center'>" . $sensor['sensor_limit'] . $unit . "</td>
|
||||
<td>" . (isset($sensor['sensor_notes']) ? $sensor['sensor_notes'] : '') . "</td>
|
||||
</tr>\n");
|
||||
|
||||
if($_GET['optb'] == "graphs") { ## If graphs
|
||||
|
||||
echo("<tr bgcolor='$row_colour'><td colspan=7>");
|
||||
|
||||
$daily_graph = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100";
|
||||
$daily_url = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150";
|
||||
$daily_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100";
|
||||
$daily_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150";
|
||||
|
||||
$weekly_graph = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100";
|
||||
$weekly_url = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150";
|
||||
$weekly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100";
|
||||
$weekly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150";
|
||||
|
||||
$monthly_graph = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100";
|
||||
$monthly_url = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150";
|
||||
$monthly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100";
|
||||
$monthly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150";
|
||||
|
||||
$yearly_graph = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100";
|
||||
$yearly_url = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150";
|
||||
$yearly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100";
|
||||
$yearly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150";
|
||||
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
<img src='$daily_graph' border=0></a> ");
|
||||
|
@@ -1,13 +1,14 @@
|
||||
<?php
|
||||
|
||||
$graph_type = "sensor_voltage";
|
||||
$unit = "V";
|
||||
|
||||
if($_SESSION['userlevel'] >= '5') {
|
||||
$sql = "SELECT * FROM `sensors` AS S, `devices` AS D WHERE S.sensor_class='voltage' AND S.device_id = D.device_id ORDER BY D.hostname, S.sensor_descr";
|
||||
} else {
|
||||
$sql = "SELECT * FROM `sensors` AS S, `devices` AS D, devices_perms as P WHERE S.sensor_class='voltage' AND S.device_id = D.device_id AND D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' ORDER BY D.hostname, S.sensor_descr";
|
||||
}
|
||||
|
||||
$graph_type = "sensor_voltage";
|
||||
|
||||
$query = mysql_query($sql);
|
||||
|
||||
echo('<table cellspacing="0" cellpadding="6" width="100%">');
|
||||
@@ -24,50 +25,50 @@ echo('<tr class=tablehead>
|
||||
|
||||
$row = 1;
|
||||
|
||||
while($volt = mysql_fetch_array($query))
|
||||
while($sensor = mysql_fetch_array($query))
|
||||
{
|
||||
if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
|
||||
$weekly_volt = "graph.php?id=" . $volt['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=500&height=150";
|
||||
$volt_popup = "<a href=\"graphs/" . $volt['sensor_id'] . "/".$graph_type."/\" onmouseover=\"return overlib('<img src=\'$weekly_volt\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
" . $volt['sensor_descr'] . "</a>";
|
||||
$weekly_sensor = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=500&height=150";
|
||||
$sensor_popup = "<a href=\"graphs/" . $sensor['sensor_id'] . "/".$graph_type."/\" onmouseover=\"return overlib('<img src=\'$weekly_sensor\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
" . $sensor['sensor_descr'] . "</a>";
|
||||
|
||||
if($volt['sensor_current'] >= $volt['sensor_limit']) { $alert = '<img src="images/16/flag_red.png" alt="alert" />'; } else { $alert = ""; }
|
||||
if($sensor['sensor_current'] >= $sensor['sensor_limit']) { $alert = '<img src="images/16/flag_red.png" alt="alert" />'; } else { $alert = ""; }
|
||||
|
||||
$volt_day = "graph.php?id=" . $volt['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=300&height=100";
|
||||
$volt_week = "graph.php?id=" . $volt['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=300&height=100";
|
||||
$volt_month = "graph.php?id=" . $volt['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=300&height=100";
|
||||
$volt_year = "graph.php?id=" . $volt['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=300&height=100";
|
||||
$sensor_day = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=300&height=100";
|
||||
$sensor_week = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=300&height=100";
|
||||
$sensor_month = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=300&height=100";
|
||||
$sensor_year = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=300&height=100";
|
||||
|
||||
$volt_minigraph = "<img src='graph.php?id=" . $volt['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=100&height=20'";
|
||||
$volt_minigraph .= " onmouseover=\"return overlib('<div class=list-large>".$volt['hostname']." - ".mres($volt['sensor_descr']);
|
||||
$volt_minigraph .= "</div><div style=\'width: 750px\'><img src=\'$volt_day\'><img src=\'$volt_week\'><img src=\'$volt_month\'><img src=\'$volt_year\'></div>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
|
||||
$sensor_minigraph = "<img src='graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=100&height=20'";
|
||||
$sensor_minigraph .= " onmouseover=\"return overlib('<div class=list-large>".$sensor['hostname']." - ".mres($sensor['sensor_descr']);
|
||||
$sensor_minigraph .= "</div><div style=\'width: 750px\'><img src=\'$sensor_day\'><img src=\'$sensor_week\'><img src=\'$sensor_month\'><img src=\'$sensor_year\'></div>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
|
||||
|
||||
echo("<tr bgcolor=$row_colour>
|
||||
<td class=list-bold>" . generate_device_link($volt) . "</td>
|
||||
<td>$volt_popup</td>
|
||||
<td>$volt_minigraph</td>
|
||||
<td class=list-bold>" . generate_device_link($sensor) . "</td>
|
||||
<td>$sensor_popup</td>
|
||||
<td>$sensor_minigraph</td>
|
||||
<td width=100>$alert</td>
|
||||
<td style='text-align: center; font-weight: bold;'>" . $volt['sensor_current'] . "V</td>
|
||||
<td style='text-align: center'>" . $volt['sensor_limit_low'] . "V - " . $volt['sensor_limit'] . "V</td>
|
||||
<td>" . (isset($volt['sensor_notes']) ? $volt['sensor_notes'] : '') . "</td>
|
||||
<td style='text-align: center; font-weight: bold;'>" . $sensor['sensor_current'] . $unit . "</td>
|
||||
<td style='text-align: center'>" . $sensor['sensor_limit_low'] . $unit . " - " . $sensor['sensor_limit'] . $unit . "</td>
|
||||
<td>" . (isset($sensor['sensor_notes']) ? $sensor['sensor_notes'] : '') . "</td>
|
||||
</tr>\n");
|
||||
|
||||
if($_GET['optb'] == "graphs") { ## If graphs
|
||||
|
||||
echo("<tr bgcolor='$row_colour'><td colspan=7>");
|
||||
|
||||
$daily_graph = "graph.php?id=" . $volt['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100";
|
||||
$daily_url = "graph.php?id=" . $volt['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150";
|
||||
$daily_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100";
|
||||
$daily_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150";
|
||||
|
||||
$weekly_graph = "graph.php?id=" . $volt['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100";
|
||||
$weekly_url = "graph.php?id=" . $volt['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150";
|
||||
$weekly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100";
|
||||
$weekly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150";
|
||||
|
||||
$monthly_graph = "graph.php?id=" . $volt['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100";
|
||||
$monthly_url = "graph.php?id=" . $volt['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150";
|
||||
$monthly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100";
|
||||
$monthly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150";
|
||||
|
||||
$yearly_graph = "graph.php?id=" . $volt['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100";
|
||||
$yearly_url = "graph.php?id=" . $volt['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150";
|
||||
$yearly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100";
|
||||
$yearly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150";
|
||||
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
<img src='$daily_graph' border=0></a> ");
|
||||
|
@@ -157,11 +157,6 @@ if (isset($peerlist))
|
||||
mysql_query("INSERT INTO `bgpPeers_cbgp` (device_id,bgpPeerIdentifier, afi, safi) VALUES ('".$device['device_id']."','".$peer['ip']."','$afi','$safi')");
|
||||
}
|
||||
}
|
||||
|
||||
unset($j_afisafi);
|
||||
unset($j_prefixes);
|
||||
unset($j_bgp);
|
||||
unset($j_peerIndexes);
|
||||
} # os=junos
|
||||
|
||||
$af_query = mysql_query("SELECT * FROM bgpPeers_cbgp WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '".$peer['ip']."'");
|
||||
@@ -176,6 +171,11 @@ if (isset($peerlist))
|
||||
} # AF list
|
||||
} # os=ios|junos
|
||||
} # Foreach
|
||||
|
||||
unset($j_afisafi);
|
||||
unset($j_prefixes);
|
||||
unset($j_bgp);
|
||||
unset($j_peerIndexes);
|
||||
} # isset
|
||||
|
||||
## Delete removed peers
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
$query = "SELECT * FROM sensors WHERE sensor_class='fanspeed' AND device_id = '" . $device['device_id'] . "'";
|
||||
$fan_data = mysql_query($query);
|
||||
while($fanspeed = mysql_fetch_array($fan_data)) {
|
||||
while ($fanspeed = mysql_fetch_array($fan_data)) {
|
||||
|
||||
echo("Checking fan " . $fanspeed['sensor_descr'] . "... ");
|
||||
|
||||
@@ -27,12 +27,21 @@ while($fanspeed = mysql_fetch_array($fan_data)) {
|
||||
|
||||
rrdtool_update($fanrrd,"N:$fan");
|
||||
|
||||
if($fanspeed['sensor_current'] > $fanspeed['sensor_limit'] && $fan <= $fanspeed['sensor_limit']) {
|
||||
$msg = "Fan Alarm: " . $device['hostname'] . " " . $fanspeed['sensor_descr'] . " is " . $fan . "rpm (Limit " . $fanspeed['sensor_limit'];
|
||||
if ($fanspeed['sensor_current'] > $fanspeed['sensor_limit_low'] && $fan <= $fanspeed['sensor_limit_low'])
|
||||
{
|
||||
$msg = "Fan Alarm: " . $device['hostname'] . " " . $fanspeed['sensor_descr'] . " is " . $fan . "rpm (Limit " . $fanspeed['sensor_limit_low'];
|
||||
$msg .= "rpm) at " . date($config['timestamp_format']);
|
||||
notify($device, "Fan Alarm: " . $device['hostname'] . " " . $fanspeed['sensor_descr'], $msg);
|
||||
echo("Alerting for " . $device['hostname'] . " " . $fanspeed['sensor_descr'] . "\n");
|
||||
log_event('Fan speed ' . $fanspeed['sensor_descr'] . " under threshold: " . $fanspeed['sensor_current'] . " rpm (> " . $fanspeed['sensor_limit'] . " rpm)", $device['device_id'], 'fanspeed', $fanspeed['sensor_id']);
|
||||
log_event('Fan speed ' . $fanspeed['sensor_descr'] . " under threshold: " . $fanspeed['sensor_current'] . " rpm (<= " . $fanspeed['sensor_limit_low'] . " rpm)", $device['device_id'], 'fanspeed', $fanspeed['sensor_id']);
|
||||
}
|
||||
else if ($fanspeed['sensor_current'] > $fanspeed['sensor_limit_warn'] && $fan <= $fanspeed['sensor_limit_low_warn'])
|
||||
{
|
||||
$msg = "Fan Warning: " . $device['hostname'] . " " . $fanspeed['sensor_descr'] . " is " . $fan . "rpm (Warning limit " . $fanspeed['sensor_limit_low_warn'];
|
||||
$msg .= "rpm) at " . date($config['timestamp_format']);
|
||||
notify($device, "Fan Warning: " . $device['hostname'] . " " . $fanspeed['sensor_descr'], $msg);
|
||||
echo("Alerting for " . $device['hostname'] . " " . $fanspeed['sensor_descr'] . "\n");
|
||||
log_event('Fan speed ' . $fanspeed['sensor_descr'] . " under warning threshold: " . $fanspeed['sensor_current'] . " rpm (<= " . $fanspeed['sensor_limit_low_warn'] . " rpm)", $device['device_id'], 'fanspeed', $fanspeed['sensor_id']);
|
||||
}
|
||||
|
||||
mysql_query("UPDATE sensors SET sensor_current = '$fan' WHERE sensor_class='fanspeed' AND sensor_id = '" . $fanspeed['sensor_id'] . "'");
|
||||
|
@@ -52,7 +52,7 @@ while($temperature = mysql_fetch_array($temp_data)) {
|
||||
$msg .= ") at " . date($config['timestamp_format']);
|
||||
notify($device, "Temp Alarm: " . $device['hostname'] . " " . $temperature['sensor_descr'], $msg);
|
||||
echo("Alerting for " . $device['hostname'] . " " . $temperature['sensor_descr'] . "\n");
|
||||
log_event('Temperature ' . $temperature['sensor_descr'] . " over threshold: " . $temp . " " . html_entity_decode('°') . "C (> " . $temperature['sensor_limit'] . " " . html_entity_decode('°') . 'C)', $device['device_id'], 'temperature', $temperature['sensor_id']);
|
||||
log_event('Temperature ' . $temperature['sensor_descr'] . " over threshold: " . $temp . " " . html_entity_decode('°') . "C (>= " . $temperature['sensor_limit'] . " " . html_entity_decode('°') . 'C)', $device['device_id'], 'temperature', $temperature['sensor_id']);
|
||||
}
|
||||
|
||||
mysql_query("UPDATE sensors SET sensor_current = '$temp' WHERE sensor_class='temperature' AND sensor_id = '" . $temperature['sensor_id'] . "'");
|
||||
|
Reference in New Issue
Block a user