Files
librenms-librenms/html/includes/graphs/sensor/power_factor.inc.php
Martijn Schmidt e0da083f5c New OS: Schleifenbauer, entity-physical improvements, various html page fixes (#9471)
* Fix some comment and documentation typos.

* Fix various entphysical page display issues.

- Resolve flickering during loading (missing liClosed for nested items).
- Clicking a sensor actually takes you to the matching graph now.

* Add a few nicecase() calls to clean up html page display.

* Create discover_entity_physical() function

- Add discover_entity_physical() function into includes/discovery/functions.inc.php
- This allows for an easy implementation of OS-specific entity-physical discovery.
- Update includes/discovery/entity-physical/entity-physical.inc.php to use the new function.

* Add power_consumed and power_factor sensors.

* Two new icons, make more entPhysical data visible.

* Pre-commit fix: blank line found at end of control structure.

* Add Schleifenbauer OS support.

* Now really fix the comment typo.

* Fix parsing mistakes.

* Add a generic count sensor.

* Make the Schleifenbauer discovery use count instead of state sensors.

* Don't place count sensor at the top, add sane limits for Schleifenbauer

* Finetuning the rrd_options, changing Schleifenbauer sensor names.

* Update schleifenbauer.svg

* optimize logo too

* add test data

* fix sensor value display (spaces break it)

* update entPhysicalIndex
2019-01-20 12:24:11 -06:00

26 lines
1.1 KiB
PHP

<?php
// Power factor can be positive (drawing power from a source) or negative (feeding power to a sink).
// However, most equipment only deals with power in a single direction so we can overwrite the defaults where relevant.
is_numeric($sensor['sensor_limit_low']) ? $scale_min = $sensor['sensor_limit_low'] : $scale_min = '-1';
is_numeric($sensor['sensor_limit']) ? $scale_max = $sensor['sensor_limit'] : $scale_max = '1';
require 'includes/graphs/common.inc.php';
$rrd_options .= " COMMENT:' Min Max Last\\n'";
$rrd_options .= " DEF:sensor=$rrd_filename:sensor:AVERAGE";
$rrd_options .= " LINE1.5:sensor#cc0000:'".rrdtool_escape($sensor['sensor_descr'], 30)."'";
$rrd_options .= ' GPRINT:sensor:MIN:%1.4lf';
$rrd_options .= ' GPRINT:sensor:MAX:%1.4lf';
$rrd_options .= ' GPRINT:sensor:LAST:%1.4lf\l';
if (is_numeric($sensor['sensor_limit'])) {
$rrd_options .= ' HRULE:'.$sensor['sensor_limit'].'#999999::dashes';
}
$rrd_options .= ' HRULE:0#999999';
if (is_numeric($sensor['sensor_limit_low'])) {
$rrd_options .= ' HRULE:'.$sensor['sensor_limit_low'].'#999999::dashes';
}