From fd9328af55fb7277d944e1031656f6f27342e2a1 Mon Sep 17 00:00:00 2001 From: Krasimir Danev Date: Wed, 14 Jul 2021 23:30:19 +0300 Subject: [PATCH] Added support to new device Controlbox TH-332B (#12940) * Addet support to new device Controlbox TH-332B * Rename CONTROLBOX-TH-332-MIB to CONTROLBOX-TH332-MIB * Create controlbox_controlbox.snmprec * Update controlbox_controlbox.snmprec * Merge branch 'master' into community-16076 * Update controlbox.yaml --- includes/definitions/controlbox.yaml | 13 ++ .../definitions/discovery/controlbox.yaml | 40 +++++ mibs/controlbox/CONTROLBOX-TH332-MIB | 109 ++++++++++++++ tests/data/controlbox_controlbox.json | 142 ++++++++++++++++++ tests/snmpsim/controlbox_controlbox.snmprec | 10 ++ 5 files changed, 314 insertions(+) create mode 100644 includes/definitions/controlbox.yaml create mode 100644 includes/definitions/discovery/controlbox.yaml create mode 100644 mibs/controlbox/CONTROLBOX-TH332-MIB create mode 100644 tests/data/controlbox_controlbox.json create mode 100644 tests/snmpsim/controlbox_controlbox.snmprec diff --git a/includes/definitions/controlbox.yaml b/includes/definitions/controlbox.yaml new file mode 100644 index 0000000000..d9b301ab6b --- /dev/null +++ b/includes/definitions/controlbox.yaml @@ -0,0 +1,13 @@ +os: controlbox +text: 'Controlbox TH-332B' +icon: hwg +type: environment +mib_dir: controlbox +over: + - { graph: device_temperature, text: 'Current measured temperature' } + - { graph: device_humidity, text: 'Current measured humidity' } + - { graph: device_pressure, text: 'Calculated dew point' } +discovery: + - + sysObjectID: + - .1.3.6.1.4.1.17095.2 diff --git a/includes/definitions/discovery/controlbox.yaml b/includes/definitions/discovery/controlbox.yaml new file mode 100644 index 0000000000..b2d967c6f6 --- /dev/null +++ b/includes/definitions/discovery/controlbox.yaml @@ -0,0 +1,40 @@ +mib: CONTROLBOX-TH332-MIB +modules: + sensors: + temperature: + data: + - + oid: temperature + #value: sensValue + num_oid: '.1.3.6.1.4.1.17095.2.1.3.{{ $index }}' + descr: Temperature + index: '{{ $index }}' + #divisor: + humidity: + data: + - + oid: humidity + #value: sensValue + num_oid: '.1.3.6.1.4.1.17095.2.1.4.{{ $index }}' + descr: Humidity + index: '{{ $index }}' + #divisor: 10 + pressure: + data: + - + oid: dewpoint + num_oid: '.1.3.6.1.4.1.17095.2.1.5.{{ $index }}' + descr: DewPoint + index: '{{ $index }}' + state: + data: + - + oid: temperatureState + #value: inpAlarmState + num_oid: '.1.3.6.1.4.1.17095.2.1.6.{{ $index }}' + descr: Alarm TemperatureState + index: '{{ $index }}' + state_name: controlbox + states: + - { descr: normal, graph: 0, value: 0, generic: 0 } + - { descr: alarm, graph: 0, value: 1, generic: 2 } diff --git a/mibs/controlbox/CONTROLBOX-TH332-MIB b/mibs/controlbox/CONTROLBOX-TH332-MIB new file mode 100644 index 0000000000..8ff2cec52e --- /dev/null +++ b/mibs/controlbox/CONTROLBOX-TH332-MIB @@ -0,0 +1,109 @@ +-- CONTROLBOX SNMP STACK SMIV2 SPECIFICATION MIB +-- + +CONTROLBOX-TH332-MIB DEFINITIONS ::= BEGIN + +IMPORTS + MODULE-IDENTITY, OBJECT-TYPE, + Integer32, enterprises FROM SNMPv2-SMI + DisplayString FROM SNMPv2-TC + NOTIFICATION-TYPE FROM SNMPv2-SMI; + +th332 MODULE-IDENTITY + LAST-UPDATED "201503230000Z" + ORGANIZATION "Controlbox" + CONTACT-INFO "www.controlbox-bg.com" + DESCRIPTION "The MIB for TH-332 SNMP server." + REVISION "201503230000Z" + DESCRIPTION "The MIB module for SMIv2." + ::= { controlbox 2 } + +controlbox OBJECT IDENTIFIER ::= { enterprises 17095 } +trapNotifications OBJECT IDENTIFIER ::= { th332 0 } +control OBJECT IDENTIFIER ::= { th332 1 } + +temperatureTrap NOTIFICATION-TYPE + OBJECTS { deviceName, temperature, temperatureState } + STATUS current + DESCRIPTION + "SMIV2 Trap notification information for the SNMP Manager. + The objects used in the demo trap notification are + deviceName, temperature and temperatureState." + ::= { trapNotifications 1 } + +humidityTrap NOTIFICATION-TYPE + OBJECTS { deviceName, humidity, humidityState } + STATUS current + DESCRIPTION + "SMIV2 Trap notification information for the SNMP Manager. + The objects used in the demo trap notification are + deviceName, humidity and humidityState." + ::= { trapNotifications 2 } + +dewpointTrap NOTIFICATION-TYPE + OBJECTS { deviceName, dewpoint, dewpointState } + STATUS current + DESCRIPTION + "SMIV2 Trap notification information for the SNMP Manager. + The objects used in the demo trap notification are + deviceName, dewpoint and dewpointState." + ::= { trapNotifications 3 } + +deviceID OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION "Device ID" + ::= { control 1 } + +deviceName OBJECT-TYPE + SYNTAX DisplayString + MAX-ACCESS read-only + STATUS current + DESCRIPTION "Device name" + ::= { control 2 } + +temperature OBJECT-TYPE + SYNTAX DisplayString + MAX-ACCESS read-only + STATUS current + DESCRIPTION "Current measured temperature" + ::= { control 3 } + +humidity OBJECT-TYPE + SYNTAX DisplayString + MAX-ACCESS read-only + STATUS current + DESCRIPTION "Current measured humidity" + ::= { control 4 } + +dewpoint OBJECT-TYPE + SYNTAX DisplayString + MAX-ACCESS read-only + STATUS current + DESCRIPTION "Calculated dew point" + ::= { control 5 } + +temperatureState OBJECT-TYPE + SYNTAX INTEGER { normal(0),alert(1),warning(2),critical(3) } + MAX-ACCESS read-only + STATUS current + DESCRIPTION "Current temperature state" + ::= { control 6 } + +humidityState OBJECT-TYPE + SYNTAX INTEGER { normal(0),alert(1),warning(2),critical(3) } + MAX-ACCESS read-only + STATUS current + DESCRIPTION "Current himidity state" + ::= { control 7 } + +dewpointState OBJECT-TYPE + SYNTAX INTEGER { normal(0),alert(1) } + MAX-ACCESS read-only + STATUS current + DESCRIPTION "Current dew point state" + ::= { control 8 } + +END + diff --git a/tests/data/controlbox_controlbox.json b/tests/data/controlbox_controlbox.json new file mode 100644 index 0000000000..8f7066a780 --- /dev/null +++ b/tests/data/controlbox_controlbox.json @@ -0,0 +1,142 @@ +{ + "os": { + "discovery": { + "devices": [ + { + "sysName": "", + "sysObjectID": ".1.3.6.1.4.1.17095.2", + "sysDescr": "TH-332B", + "sysContact": "", + "version": null, + "hardware": null, + "features": null, + "os": "controlbox", + "type": "environment", + "serial": null, + "icon": "hwg.svg", + "location": "" + } + ] + }, + "poller": "matches discovery" + }, + "sensors": { + "discovery": { + "sensors": [ + { + "sensor_deleted": 0, + "sensor_class": "humidity", + "poller_type": "snmp", + "sensor_oid": ".1.3.6.1.4.1.17095.2.1.4.0", + "sensor_index": "0", + "sensor_type": "controlbox", + "sensor_descr": "Humidity", + "group": null, + "sensor_divisor": 1, + "sensor_multiplier": 1, + "sensor_current": 56.8, + "sensor_limit": 70, + "sensor_limit_warn": null, + "sensor_limit_low": 30, + "sensor_limit_low_warn": null, + "sensor_alert": 1, + "sensor_custom": "No", + "entPhysicalIndex": null, + "entPhysicalIndex_measured": null, + "sensor_prev": null, + "user_func": null, + "state_name": null + }, + { + "sensor_deleted": 0, + "sensor_class": "pressure", + "poller_type": "snmp", + "sensor_oid": ".1.3.6.1.4.1.17095.2.1.5.0", + "sensor_index": "0", + "sensor_type": "controlbox", + "sensor_descr": "DewPoint", + "group": null, + "sensor_divisor": 1, + "sensor_multiplier": 1, + "sensor_current": 14.3, + "sensor_limit": 15.015, + "sensor_limit_warn": null, + "sensor_limit_low": 13.585, + "sensor_limit_low_warn": null, + "sensor_alert": 1, + "sensor_custom": "No", + "entPhysicalIndex": null, + "entPhysicalIndex_measured": null, + "sensor_prev": null, + "user_func": null, + "state_name": null + }, + { + "sensor_deleted": 0, + "sensor_class": "state", + "poller_type": "snmp", + "sensor_oid": ".1.3.6.1.4.1.17095.2.1.6.0", + "sensor_index": "0", + "sensor_type": "controlbox", + "sensor_descr": "Alarm TemperatureState", + "group": null, + "sensor_divisor": 1, + "sensor_multiplier": 1, + "sensor_current": 0, + "sensor_limit": null, + "sensor_limit_warn": null, + "sensor_limit_low": null, + "sensor_limit_low_warn": null, + "sensor_alert": 1, + "sensor_custom": "No", + "entPhysicalIndex": null, + "entPhysicalIndex_measured": null, + "sensor_prev": null, + "user_func": null, + "state_name": "controlbox" + }, + { + "sensor_deleted": 0, + "sensor_class": "temperature", + "poller_type": "snmp", + "sensor_oid": ".1.3.6.1.4.1.17095.2.1.3.0", + "sensor_index": "0", + "sensor_type": "controlbox", + "sensor_descr": "Temperature", + "group": null, + "sensor_divisor": 1, + "sensor_multiplier": 1, + "sensor_current": 22.9, + "sensor_limit": 42.9, + "sensor_limit_warn": null, + "sensor_limit_low": 12.9, + "sensor_limit_low_warn": null, + "sensor_alert": 1, + "sensor_custom": "No", + "entPhysicalIndex": null, + "entPhysicalIndex_measured": null, + "sensor_prev": null, + "user_func": null, + "state_name": null + } + ], + "state_indexes": [ + { + "state_name": "controlbox", + "state_descr": "normal", + "state_draw_graph": 0, + "state_value": 0, + "state_generic_value": 0 + }, + { + "state_name": "controlbox", + "state_descr": "alarm", + "state_draw_graph": 0, + "state_value": 1, + "state_generic_value": 2 + } + ] + }, + "poller": "matches discovery" + } +} diff --git a/tests/snmpsim/controlbox_controlbox.snmprec b/tests/snmpsim/controlbox_controlbox.snmprec new file mode 100644 index 0000000000..0d023b4949 --- /dev/null +++ b/tests/snmpsim/controlbox_controlbox.snmprec @@ -0,0 +1,10 @@ +1.3.6.1.2.1.1.1.0|4|TH-332B +1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.17095.2 +1.3.6.1.2.1.1.3.0|67|1782198 +1.3.6.1.2.1.1.4.0|4| +1.3.6.1.2.1.1.5.0|4| +1.3.6.1.2.1.1.6.0|4| +1.3.6.1.4.1.17095.2.1.3.0|4|22.9 +1.3.6.1.4.1.17095.2.1.4.0|4|56.8 +1.3.6.1.4.1.17095.2.1.5.0|4|14.3 +1.3.6.1.4.1.17095.2.1.6.0|2|0