mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
correctly calculate limits for negative voltage sensors
git-svn-id: http://www.observium.org/svn/observer/trunk@2192 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -2,6 +2,15 @@
|
||||
|
||||
## Common Functions
|
||||
|
||||
function sgn($int){
|
||||
if($int < 0)
|
||||
return -1;
|
||||
elseif($int == 0)
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
function get_sensor_rrd($device, $sensor)
|
||||
{
|
||||
global $config;
|
||||
|
||||
@@ -87,7 +87,7 @@ function sensor_low_limit($class, $current)
|
||||
$limit = $current * 0.7;
|
||||
break;
|
||||
case 'voltage':
|
||||
$limit = $current * 0.85;
|
||||
$limit = $current * (1 - (sgn($current) * 0.15));
|
||||
break;
|
||||
case 'humidity':
|
||||
$limit = "70";
|
||||
@@ -119,7 +119,7 @@ function sensor_limit($class, $current)
|
||||
$limit = $current * 1.60;
|
||||
break;
|
||||
case 'voltage':
|
||||
$limit = $current * 1.15;
|
||||
$limit = $current * (1 + (sgn($current) * 0.15));
|
||||
break;
|
||||
case 'humidity':
|
||||
$limit = "70";
|
||||
|
||||
Reference in New Issue
Block a user