replace duplicate code block with non duplicate code block. for fun.

git-svn-id: http://www.observium.org/svn/observer/trunk@2478 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-09-16 01:58:23 +00:00
parent c3bb80fa64
commit 7ba4385fe9
2 changed files with 24 additions and 12 deletions
+1 -1
View File
@@ -248,7 +248,7 @@ if($format == "graph")
{
$graph_type = "device_".$subformat;
echo("<div style='display: block; padding: 1px; margin: 2px; min-width: 393px; max-width:393px; min-height:180px; max-height:180px; text-align: center; float: left; background-color: #f5f5f5;'>
echo("<div style='display: block; padding: 1px; margin: 2px; min-width: 393px; max-width:393px; min-height:170px; max-height:170px; text-align: center; float: left; background-color: #f5f5f5;'>
<a href='device/".$device['device_id']."/' onmouseover=\"return overlib('\
<div style=\'font-size: 16px; padding:5px; font-weight: bold; color: #e5e5e5;\'>".$device['hostname']." - ".$interface['ifDescr']."</div>\
<img src=\'graph.php?type=$graph_type&amp;id=".$device['device_id']."&amp;from=".$config['time']['day']."&amp;to=".$config['time']['now']."&amp;width=450&amp;height=150&amp;title=yes\'>\
+23 -11
View File
@@ -1,17 +1,29 @@
<?php
poll_sensor($device,'current','A');
poll_sensor($device,'frequency', 'Hz');
poll_sensor($device,'fanspeed', 'rpm');
poll_sensor($device,'humidity', '%');
poll_sensor($device,'power', 'W');
poll_sensor($device,'voltage', 'V');
poll_sensor($device,'temperature', 'C');
/* Observium Network Management and Monitoring System
* Copyright (C) 2006-2011, Observium Developers - http://www.observium.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* See COPYING for more details.
*/
# FIXME voltages have other filenames
#include('includes/polling/voltages.inc.php');
## Call poll_sensor for each sensor type that we support.
# FIXME also convert temperature, but there's some special code in there?
#include('includes/polling/temperatures.inc.php');
$supported_sensors = array('current' => 'A',
'frequency' => 'Hz',
'humidity' => '%',
'fanspeed' => 'rpm',
'power' => 'W',
'voltage' => 'V',
'temperature' => 'C');
foreach ($supported_sensors as $sensor_type => $sensor_unit)
{
poll_sensor($device, $sensor_type, $sensor_unit);
}
?>