Uploaded image for project: 'Observium'
  1. Observium
  2. OBS-3472

Add discovery/polling for AvTech Room Alert 32E

Details

    • Add New Device / OS
    • Resolution: Fixed
    • Major
    • None
    • Professional Edition
    • Discovery, Poller
    • Appliance with Digital Temperature & Humidity sensor attached.

    Description

      Request to please add support for [Room Alert 32E title|https://avtech.com/Products/Environment_Monitors/Room_Alert_32E.htm].  Code is based upon the work done for OBS-3059.  Also including the latest ROOMAERT32E-MIB file.

      Attachments

        Issue Links

          Activity

            [OBS-3472] Add discovery/polling for AvTech Room Alert 32E
            bot Observium Bot made changes -
            Status Original: Resolved [ 5 ] New: Closed [ 6 ]
            landy Mike Stupalov made changes -
            Resolution New: Fixed [ 1 ]
            Status Original: In Progress [ 3 ] New: Resolved [ 5 ]
            landy Mike Stupalov made changes -
            Comment [ {noformat}Index: includes/definitions/mibs/avtech.inc.php
            ===================================================================
            --- includes/definitions/mibs/avtech.inc.php (revision 10690)
            +++ includes/definitions/mibs/avtech.inc.php (working copy)
            @@ -140,4 +140,18 @@
             $config['mibs'][$mib]['mib_dir'] = 'avtech';
             $config['mibs'][$mib]['descr'] = '';
             
            +//New stuff
            +$mib = 'ROOMALERT32E-MIB';
            +$config['mibs'][$mib]['enable'] = 1;
            +$config['mibs'][$mib]['mib_dir'] = 'avtech';
            +$config['mibs'][$mib]['descr'] = '';
            +
            +$type = 'switch-sen';
            +$config['mibs'][$mib]['states'][$type][0] = array('name' => 'OPEN', 'event' => 'ok');
            +$config['mibs'][$mib]['states'][$type][1] = array('name' => 'CLOSED', 'event' => 'warning');
            +
            +$type = 'internal-power';
            +$config['mibs'][$mib]['states'][$type][0] = array('name' => 'BATTERY', 'event' => 'alert');
            +$config['mibs'][$mib]['states'][$type][1] = array('name' => 'UTILITY', 'event' => 'ok');
            +
             // EOF
            {noformat}
             
            {noformat}Index: includes/definitions/os.inc.php
            ===================================================================
            --- includes/definitions/os.inc.php (revision 10690)
            +++ includes/definitions/os.inc.php (working copy)
            @@ -2687,6 +2687,7 @@
             $config['os'][$os]['mibs'][] = "ROOMALERT12E-MIB";
             $config['os'][$os]['mibs'][] = "ROOMALERT4E-MIB";
             $config['os'][$os]['mibs'][] = "ROOMALERT3E-MIB";
            +$config['os'][$os]['mibs'][] = "ROOMALERT32E-MIB";
             
             $os = "ipoman";
             $config['os'][$os]['text'] = "Ingrasys iPoMan";

            {noformat}
             

            includes/discovery/sensors/roomalert32e-mib.inc.php
            {noformat}<?php/**
             * Observium
             *
             * This file is part of Observium.
             *
             * @package observium
             * @subpackage discovery
             * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
             *
             */// ATTENTION! In the SNMP settings of the device, there is a checkbox called [ ] Use 2 digit SNMP.
            // If checked, values will be rounded; SNMP will return 20 for 20.4 degrees. If unchecked, values are *1000, so 2040 for 20.4 degrees.
            $scale=.01;// Internal to device itself
            // ROOMALERT32E-MIB::internal-tempc.0 = INTEGER: 2880
            // ROOMALERT32E-MIB::internal-humidity.0 = INTEGER: 1767
            // ROOMALERT32E-MIB::internal-heat-indexC.0 = INTEGER: 2960
            // ROOMALERT32E-MIB::internal-dew-point-c.0 = INTEGER: 1304
            // ROOMALERT32E-MIB::internal-power.0 = INTEGER: 1
            $oids = snmpwalk_cache_oid($device, "internal", array(), "ROOMALERT32E-MIB");foreach($oids as $index => $entry)
            {
              //Is there a better way to do this?
              if($entry['internal-tempc'])
              {
                $oid_name = "internal-tempc";
                $oid_num = ".1.3.6.1.4.1.20916.1.8.1.1.1.2.$index";
                $type = $mib."-".$oid_name;
                $descr = "Internal Temperature";
                $sensor_index = $oid_name.".".$index;
                $value = $entry['internal-tempc']; discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $ndex, $type, $descr, $scale, $value);
              } if($entry['internal-humidity'])
              {
                $oid_name = "internal-humidity";
                $oid_num = ".1.3.6.1.4.1.20916.1.8.1.1.2.1.$index";
                $type = $mib."-".$oid_name;
                $descr = "Internal Humidity";
                $sensor_index = $oid_name.".".$index;
                $value = $entry['internal-humidity']; discover_sensor_ng($device, 'humidity', $mib, $oid_name, $oid_num, $index, $type, $descr, $scale, $value);
              } if($entry['internal-heat-indexC'])
              {
                $oid_name = "internal-heat-indexC";
                $oid_num = ".1.3.6.1.4.1.20916.1.8.1.1.4.2.$index";
                $type = $mib."-".$oid_name;
                $descr = "Internal Heat Index";
                $sensor_index = $oid_name.".".$index;
                $value = $entry['internal-heat-indexC']; discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $index, $type, $descr, $scale, $value);
              } if($entry['internal-dew-point-c'])
              {
                $oid_name = "internal-dew-point-c";
                $oid_num = ".1.3.6.1.4.1.20916.1.8.1.1.7.1.$index";
                $type = $mib."-".$oid_name;
                $descr = "Internal Dew Point";
                $sensor_index = $oid_name.".".$index;
                $value = $entry['internal-dew-point-c']; discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $index, $type, $descr, $scale, $value);
              } if($entry['internal-power'])
              {
                $oid_name = "internal-power";
                $oid_num = ".1.3.6.1.4.1.20916.1.8.1.1.3.1.$index";
                //Not sure why the format for status is different
                $type = $oid_name;
                $descr = "Internal Power Source";
                $sensor_index = $oid_name.".".$index;
                $value = $entry['internal-power']; discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr, $value);
              }
            }/****
            // Digital sensors -- ARGH, why not digital-sen.1.1.0 instead of digital-sen1-1.0 !
            // "Monitor for Temperature, Humidity, Heat Index (Feels Like), Power, Flood/Water, Smoke/Fire, Room Entry, Air Flow, Network Cameras and more."
            // Great, now how do I see what sensor is connected over SNMP? Right... No OID for that.
            //
            // So we'll go by this table:
            //
            // | Temp sensor | Temp/Humidity sensor | Power Sensor
            // --------+--------------------+--------------------------+-----------------
            // sen1-1: | Temp in Celsius | Temp in Celsius | Amperes
            // sen1-2: | Temp in Fahrenheit | Temp in Fahrenheit | Watts
            // sen1-3: | N/A | Humidity | Volts
            // sen1-4: | N/A | Heat index in Fahrenheit | Reference Volts
            // sen1-5: | N/A | Heat index in Celsius | N/A
            //
            // You can name the sensors in the web interface, but the descriptions are not exported through SNMP :(
            // ROOMALERT32E-MIB::digital-sen1-1.0 = INTEGER: 3606
            // ROOMALERT32E-MIB::digital-sen1-2.0 = INTEGER: 9690
            // ROOMALERT32E-MIB::digital-sen2-1.0 = INTEGER: 2912
            // ROOMALERT32E-MIB::digital-sen2-2.0 = INTEGER: 8441
            ****/
            $oids = snmpwalk_cache_oid($device, "digital", array(), "ROOMALERT32E-MIB");$index = 0;for ($i = 1;$i <= 6;$i++)
            {
              if (isset($oids[$index]["digital-sen$i-1"]))
              {
                // Sensor is present.
                if (!isset($oids[$index]["digital-sen$i-3"]))
                {
                  // Temp sensor
                  $oid_name = "digital-sen$i-1";
                  $oid_num = ".1.3.6.1.4.1.20916.1.8.1.2.$i.1.$index";
                  $type = $mib."-".$oid_name;
                  $descr = "External Digital Sensor ".str_pad($i,2,'0',STR_PAD_LEFT).": Temperature";
                  $sensor_index = $oid_name.".".$index;
                  $value = $oids[$index]["digital-sen$i-1"]; discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $index, $type, $descr, $scale, $value);
                }
                elseif (isset($oids[$index]["digital-sen$i-5"]))
                {
                  // Don't hav any of these sensors, unable to test
                  // Temp/Humidity sensor
                  $oid_name = "digital-sen$i-1";
                  $oid_num = ".1.3.6.1.4.1.20916.1.8.1.2.$i.1.$index";
                  $type = $mib."-".$oid_name;
                  $descr = "External Digital Sensor ".str_pad($i,2,'0',STR_PAD_LEFT).": Temperature";
                  $sensor_index = $oid_name.".".$index;
                  $value = $oids[$index]["digital-sen$i-1"];
                  
                  discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $index, $type, $descr, $scale, $value); $oid_name = "digital-sen$i-3";
                  $oid_num = ".1.3.6.1.4.1.20916.1.8.1.2.$i.3.$index";
                  $type = $mib."-".$oid_name;
                  $descr = "External Digital Sensor ".str_pad($i,2,'0',STR_PAD_LEFT).": Humidity";
                  $sensor_index = $oid_name.".".$index;
                  $value = $oids[$index]["digital-sen$i-3"];
                  
                  discover_sensor_ng($device, 'humidity', $mib, $oid_name, $oid_num, $index, $type, $descr, $scale, $value); $oid_name = "digital-sen$i-5";
                  $oid_num = ".1.3.6.1.4.1.20916.1.8.1.2.$i.5.$index";
                  $type = $mib."-".$oid_name;
                  $descr = "External Digital Sensor ".str_pad($i,2,'0',STR_PAD_LEFT).": Heat Index";
                  $sensor_index = $oid_name.".".$index;
                  $value = $oids[$index]["digital-sen$i-5"];
                  
                  discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $index, $type, $descr, $scale, $value);
                } else {
                  // Don't have any of these sensors, unable to test
                  // Power sensor
                  $oid_name = "digital-sen$i-1";
                  $oid_num = ".1.3.6.1.4.1.20916.1.8.1.2.$i.1.$index";
                  $type = $mib."-".$oid_name;
                  $descr = "External Digital Sensor ".str_pad($i,2,'0',STR_PAD_LEFT).": Current";
                  $sensor_index = $oid_name.".".$index;
                  $value = $oids[$index]["digital-sen$i-1"];
                  
                  discover_sensor_ng($device, 'current', $mib, $oid_name, $oid_num, $index, $type, $descr, $scale, $value); $oid_name = "digital-sen$i-2";
                  $oid_num = ".1.3.6.1.4.1.20916.1.8.1.2.$i.2.$index";
                  $type = $mib."-".$oid_name;
                  $descr = "External Digital Sensor ".str_pad($i,2,'0',STR_PAD_LEFT).": Power";
                  $sensor_index = $oid_name.".".$index;
                  $value = $oids[$index]["digital-sen$i-1"];
                  
                  discover_sensor_ng($device, 'power', $mib, $oid_name, $oid_num, $index, $type, $descr, $scale, $value); $oid_name = "digital-sen$i-3";
                  $oid_num = ".1.3.6.1.4.1.20916.1.8.1.2.$i.3.$index";
                  $type = $mib."-".$oid_name;
                  $descr = "External Digital Sensor ".str_pad($i,2,'0',STR_PAD_LEFT).": Voltage";
                  $sensor_index = $oid_name.".".$index;
                  $value = $oids[$index]["digital-sen$i-3"];
                  
                  discover_sensor_ng($device, 'voltage', $mib, $oid_name, $oid_num, $index, $type, $descr, $scale, $value); $oid_name = "digital-sen$i-4";
                  $oid_num = ".1.3.6.1.4.1.20916.1.8.1.2.$i.4.$index";
                  $type = $mib."-".$oid_name;
                  $descr = "External Digital Sensor ".str_pad($i,2,'0',STR_PAD_LEFT).": Reference Voltage";
                  $sensor_index = $oid_name.".".$index;
                  $value = $oids[$index]["digital-sen$i-4"];
                  
                  discover_sensor_ng($device, 'voltage', $mib, $oid_name, $oid_num, $index, $type, $descr, $scale, $value);
                }
              }
            }//Switch Sensors
            $oids = snmpwalk_cache_oid($device, "switch", array(), "ROOMALERT32E-MIB");
            $l=0;foreach($oids as $index => $entry)
            {
              foreach($entry as $k => $v)
              {
                //switches start counting from 1;
                $l++; $oid_name = $k;
                $oid_num = ".1.3.6.1.4.1.20916.1.8.1.3.$l.$index";
                $type = $mib."-".$oid_name;
                $descr = "External Switch Sensor ".str_pad($l,2,'0',STR_PAD_LEFT);
                $sensor_index = $oid_name.".".$index; discover_status_ng($device, $mib, $oid_name, $oid_num, $index, "switch-sen", $descr, $v);
              }
            }{noformat}
              ]
            landy Mike Stupalov made changes -
            Status Original: In Review [ 10101 ] New: In Progress [ 3 ]
            landy Mike Stupalov made changes -
            Attachment Original: myagent.snmpwalk [ 17844 ]
            landy Mike Stupalov made changes -
            Attachment Original: ROOMALERT32E.MIB [ 17843 ]
            junkatgrumpytowncom junkatgrumpytowncom made changes -
            Attachment New: RA32.PNG [ 17845 ]
            landy Mike Stupalov made changes -
            Status Original: Pending Response [ 10000 ] New: In Review [ 10101 ]
            junkatgrumpytowncom junkatgrumpytowncom made changes -
            Attachment New: myagent.snmpwalk [ 17844 ]
            bot Observium Bot made changes -
            Status Original: Open [ 1 ] New: Pending Response [ 10000 ]

            People

              landy Mike Stupalov
              junkatgrumpytowncom junkatgrumpytowncom
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: