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



--
Mike Stupalov
http://observium.org/