Custom OID with MOXA E1210

Hi LibreNMS Team,

I’d like to add 16 digital interface status from Moxa 1210. In the MIB file I have (placed in mibs/moxa), I have these information (only a part of the entire MIB) :

– I/O
– 1.3.6.1.4.1.8691.10.1210.10
e1210monitor OBJECT IDENTIFIER ::= { e1210 10 }

– DI channel
diTable OBJECT-TYPE
SYNTAX SEQUENCE OF DIEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
“The DI channel monitor table”
::= { e1210monitor 1 }

diEntry OBJECT-TYPE
SYNTAX DIEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
“The DI channel monitor item”
INDEX { diIndex }
::= { diTable 1 }

DIEntry ::= SEQUENCE {
diIndex Integer32,
diMode Integer32,
diStatus Integer32,
diFilter Integer32,
diTrigger Integer32,
diCntStart Integer32,
diCounterReset Integer32,
diCounterOverflowFlag Integer32,
diCounterOverflowFlagClear Integer32
}

diIndex OBJECT-TYPE
SYNTAX Integer32 (0…15)
MAX-ACCESS read-only
STATUS current
DESCRIPTION
“DI - index”
::= { diEntry 1 }

diMode OBJECT-TYPE
SYNTAX Integer32 (0…1)
MAX-ACCESS read-write
STATUS current
DESCRIPTION “DI - mode (0: DI, 1: Counter mode)”
::= { diEntry 3 }

diStatus OBJECT-TYPE
SYNTAX Integer32 (0…2147483647)
MAX-ACCESS read-only
STATUS current
DESCRIPTION “DI - DI mode status (0: OFF, 1: ON) or Counter mode value”
::= { diEntry 4 }

I tried to create a simple YAML file based on https://docs.librenms.org/#Developing/Support-New-OS/ :

os: E1210
text: E1210
type: environment
icon: moxa
discovery:
- sysObjectID:
- .1.3.6.1.4.1.8691.10.1210
mib_dir:
- moxa

tried to re discover, re poll, remove cache
but it didn’t work…

also tried to create another “type” of YAML file based on https://docs.librenms.org/#Developing/Sensor-State-Support/

mib: MOXA_IO_E1210-MIB
modules:
sensors:
state:
data:
-
oid: diTable
num_oid: .1.3.6.1.4.1.8691.10.1210.10.1.1.4.
descr: diStatus
index: ‘diStatus.{{ $index }}’
state_name: diStatus

but it also didn’t work…
I cannot see my digital interface status

also tried to execute new-os.php with the command : ./new-os.php -h 10.68.107.101 -o E1210
but the only answer I have is :

Info:
You can use to build the yaml files for a new OS.
Usage:
-h Is the device ID or hostname of the device in LibreNMS detected as generic
-o This is the OS name, i.e ios, nxos, eos
-t This is the OS type, i.e network, power, etc
-v The vendor name in lower case, i.e cisco, arista

Example:
./scripts/new-os.php -h 44 -o new-eos

Ow, I also post the beginning of the MIB file if it can help one of you :slight_smile:

– *****************************************************************
– Moxa Active Ethernet I/O Server MIB

– 01-03-2013

– Copyright © 2013 by Moxa Automation Co., Ltd.
– All rights reserved.
– *****************************************************************

MOXA-IO-E1210-MIB DEFINITIONS ::= BEGIN
IMPORTS
enterprises, Unsigned32, Integer32, MODULE-IDENTITY, OBJECT-TYPE, NOTIFICATION-TYPE FROM SNMPv2-SMI;
– 1.3.6.1.4.1.8691.10.1210
e1210 MODULE-IDENTITY

Thanks all for you help !

forgot to add extract from SNMP :

this is the part i’m interested by :

.1.3.6.1.4.1.8691.10.1210.10.1.1.4.1 = INTEGER: 0
.1.3.6.1.4.1.8691.10.1210.10.1.1.4.2 = INTEGER: 0
.1.3.6.1.4.1.8691.10.1210.10.1.1.4.3 = INTEGER: 1
.1.3.6.1.4.1.8691.10.1210.10.1.1.4.4 = INTEGER: 0
.1.3.6.1.4.1.8691.10.1210.10.1.1.4.5 = INTEGER: 0
.1.3.6.1.4.1.8691.10.1210.10.1.1.4.6 = INTEGER: 0
.1.3.6.1.4.1.8691.10.1210.10.1.1.4.7 = INTEGER: 0
.1.3.6.1.4.1.8691.10.1210.10.1.1.4.8 = INTEGER: 0
.1.3.6.1.4.1.8691.10.1210.10.1.1.4.9 = INTEGER: 0
.1.3.6.1.4.1.8691.10.1210.10.1.1.4.10 = INTEGER: 0
.1.3.6.1.4.1.8691.10.1210.10.1.1.4.11 = INTEGER: 0
.1.3.6.1.4.1.8691.10.1210.10.1.1.4.12 = INTEGER: 0
.1.3.6.1.4.1.8691.10.1210.10.1.1.4.13 = INTEGER: 0
.1.3.6.1.4.1.8691.10.1210.10.1.1.4.14 = INTEGER: 0
.1.3.6.1.4.1.8691.10.1210.10.1.1.4.15 = INTEGER: 0
.1.3.6.1.4.1.8691.10.1210.10.1.1.4.16 = INTEGER: 0

.1.3.6.1.4.1.8691.10.1210 is system description right ?
10.1.1 I don’t know it’s related to…
4. is for diStatus (based on MIB)
last digit in for the index of the interface

found my answer. If it can help :

just put the new OS file in includes/definitions/E1210.yaml :

os: E1210
text: ‘Moxa IO E1210’
type: environment
discovery:
- sysObjectID:
- .1.3.6.1.4.1.8691.10.1210

AND a custom sensor discover file in includes/discovery/sensor/state/E1210.inc.php :

<?php if ($device['os'] == 'E1210') { for ($i = 1; $i < 17; $i++) { $system_status_oid = '.1.3.6.1.4.1.8691.10.1210.10.1.1.4.'.$i; $system_status = snmp_get($device, $system_status_oid, "-Oqv"); discover_sensor($valid['sensor'], 'state', $device, $system_status_oid, 'digitalInput'.$i, 'snmp', 'digital input '.$i, '1', '1', NULL, NULL, NULL, NULL, $system_status); } }
1 Like

You should submit your changes to https://github.com/librenms/librenms/pulls it could help out other users. :slight_smile: