We have a tiny sensor/discovery module (gist below) that picks up the (back)pressure, in Bar, of a cooling system.
However when we add below to config.php:
$config['sensor_types']['pressure']['symbol']='B'; $config['sensor_types']['pressure']['text']='Pressure'; $config['sensor_types']['pressure']['icon']=‘oicon-omega’;
it seems that these values are wiped/overwritten by the values from definitions.dat.
What, or perhaps, where, is the proper way to add these ?
Thanks,
Dw.
<?php /* — Fetch backpressure on various P, C and I flows. dirkx(at)apache.org */ $oids = snmpwalk_cache_multi_oid($device, “backPressureTable", array(), “DANFLOSS-MIB"); foreach ($oids as $index => $entry) { $label = $entry[‘backPressureLabel']; $descr = $entry[‘backPressureDescr’];
// The older units have just a count - prefix with the label (firmware issue on the pump itself, // cannot be remedied through the puppet/config-deploy). // if (strlen($descr) < 3) { $descr = "$label $descr”; }; $type = ‘pressure';
foreach(array(‘backPressureTop', 'backPressureEgress','backPressureCompressure') as $field) { $oid = snmp_translate($field.'.'.$index, "DANFLOSS-MIB"); $value = $entry[ $field ];
$divisor = $entry[ $field.'Divisor' ]; if (!$divisor) $divisor = 1;
if (is_numeric($value)) { /* Longer term - these prolly should go in one custom graph - rather than three */ discover_sensor($valid['sensor'], $type, $device, $oid, "$field.$index", ‘danfloss', $descr.' '.$field, 1.0/$divisor, $value); }; }; };
Hi,
note, observium used only SI units!
For pressure do not use "Bar", only pascal: "Pa", see: https://en.wikipedia.org/wiki/Pressure
On Sat, Feb 6, 2016 at 1:46 AM, Dirk-Willem van Gulik dirkx@webweaving.org wrote:
We have a tiny sensor/discovery module (gist below) that picks up the (back)pressure, in Bar, of a cooling system.
However when we add below to config.php:
$config['sensor_types']['pressure']['symbol']='B'; $config['sensor_types']['pressure']['text']='Pressure'; $config['sensor_types']['pressure']['icon']=‘oicon-omega’;
it seems that these values are wiped/overwritten by the values from definitions.dat.
What, or perhaps, where, is the proper way to add these ?
Thanks,
Dw.
<?php /* — Fetch backpressure on various P, C and I flows. dirkx(at)apache.org */ $oids = snmpwalk_cache_multi_oid($device, “backPressureTable", array(), “DANFLOSS-MIB"); foreach ($oids as $index => $entry) { $label = $entry[‘backPressureLabel']; $descr = $entry[‘backPressureDescr’];
// The older units have just a count - prefix with the label (firmware issue on the pump itself, // cannot be remedied through the puppet/config-deploy). // if (strlen($descr) < 3) { $descr = "$label $descr”; }; $type = ‘pressure';
foreach(array(‘backPressureTop', 'backPressureEgress','backPressureCompressure') as $field) { $oid = snmp_translate($field.'.'.$index, "DANFLOSS-MIB"); $value = $entry[ $field ];
$divisor = $entry[ $field.'Divisor' ]; if (!$divisor) $divisor = 1; if (is_numeric($value)) { /* Longer term - these prolly should go in one custom graph -
rather than three */ discover_sensor($valid['sensor'], $type, $device, $oid, "$field.$index", ‘danfloss', $descr.' '.$field, 1.0/$divisor, $value); }; }; }; _______________________________________________ observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
On 06 Feb 2016, at 10:00, Mike Stupalov mike@observium.org wrote:
For pressure do not use "Bar", only pascal: "Pa", see: https://en.wikipedia.org/wiki/Pressure
That is going to be a lovely puzzle - though I guess one could use Mega pascals or something like that. And in actual reality - it is not Bar but bar — i.e. relative.
Grin,
Dw.
On 05 Feb 2016, at 23:46, Dirk-Willem van Gulik dirkx@webweaving.org wrote:
We have a tiny sensor/discovery module (gist below) that picks up the (back)pressure, in Bar, of a cooling system.
However when we add below to config.php:
$config['sensor_types']['pressure']['symbol']='B'; $config['sensor_types']['pressure']['text']='Pressure'; $config['sensor_types']['pressure']['icon']=‘oicon-omega’;
it seems that these values are wiped/overwritten by the values from definitions.dat.
What, or perhaps, where, is the proper way to add these ?
To refine this a bit more - when we add above to config.php along with an entry config[silly]=test; we see below [1] in http://10.11.0.132/settings/format=changed_config/.
Pretty much as you’d expect.
On http://10.11.0.132/settings/format=config/ we see ‘test-silly (second screenshot) - confirming that this shows the full set of data.
Sofar so good. However if we scroll to sensor types - we do NOT see the extra 2 entries from config.php (screenshot 3).
So something is amiss here.
However if we move these entries to definitions.inc.php - post the reading of definitions.dat - all is well again (screenshot 4).
So I guess the bug is in the array merge.
Tiny SVN patch attached below.. I suspect it may be worthwhile to poke a bit more at this - as some issues with the detected mibs posted about half a year ago smell the same.
Dw.
beeb:includes dirkx$ svn diff Index: definitions.inc.php =================================================================== --- definitions.inc.php +++ definitions.inc.php (working copy) @@ -146,7 +146,7 @@ //var_dump($config_tmp); if (is_array($config_tmp) && isset($config_tmp['os'])) // Simple check for passed correct data { - $config = array_merge($config, $config_tmp); + $config = array_merge_recursive($config, $config_tmp); } unset($config_tmp); }
participants (2)
-
Dirk-Willem van Gulik
-
Mike Stupalov