mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Sensors - Allow changing RRD type in YAML and PHP sensor discovery (#14208)
* new row variant * syntax * syntax * DB * syntax * schema * test * allAdvaTests * Tests * Tests * Tests * missingMigration * missingMigration * Tests * Tests * Tests * Tests * tests * tests * tests * tests * tests * test * fix_Aos7 * fix snmprec arista * fix snmprec arista * fix snmprec arista * tests * merge_fix * aos7 backslash * aos7 * more * more * defaultValue * arista * typehint * tests * tests * voss * aos7 * aos7 * aos7 * testWithoutarista-mos_metamux48-c-0-16.json * tests * ciscosb * new tests with 2004 and only sensors module * adding wireless module again * adding wireless module again (cont) * airos * aos7 * arista * arista * bdcom * fortigate * fortigate * fortigate * ftos * ftos * tests on 1804 * tests once more * tests once more, cont * tests once more, cont * tests once more, cont * tests once more, cont * tests once more, cont * more * bdcom * comware * edgeosolt * enexus * arista-mos * removeAristaAgain * ies500_manual_edit * ies500_manual_edit * mni * volius * zywal * manually imported arista-mos * manually imported arista-mos * arista-mos test is triggering something ... * restoreArista * tests * tests * aristamos * ies52xxM_4206.json * revert linux_supermicro.json * revert linux_supermicro.json * benuos * fortiadc * rnx-updu
This commit is contained in:
@@ -1160,6 +1160,11 @@ function get_sensor_label_color($sensor, $type = 'sensors')
|
||||
return "<span class='label $label_style'>" . trim($sensor['sensor_current']) . ' ' . $unit . '</span>';
|
||||
}
|
||||
|
||||
if (in_array($sensor['rrd_type'], ['COUNTER', 'DERIVE', 'DCOUNTER', 'DDERIVE'])) {
|
||||
//compute and display an approx rate for this sensor
|
||||
return "<span class='label $label_style'>" . trim(Number::formatSi(max(0, $sensor['sensor_current'] - $sensor['sensor_prev']) / Config::get('rrd.step', 300), 2, 3, $unit)) . '</span>';
|
||||
}
|
||||
|
||||
if ($type == 'wireless' && $sensor['sensor_class'] == 'frequency') {
|
||||
return "<span class='label $label_style'>" . trim(Number::formatSi($sensor['sensor_current'] * 1000000, 2, 3, 'Hz')) . '</span>';
|
||||
}
|
||||
|
Reference in New Issue
Block a user