Hi,
I’m trying to add some sensors/state to Netapp storage and I’m having trouble doing that using a YAML file. For example I’ll use OID that represents configured HA state NETAPP-MIB::haSettings
.
Walking the table I get:
NETAPP-MIB::haSettings.'AFF-TKC-1A' = INTEGER: enabled(2)
NETAPP-MIB::haSettings.'AFF-TKC-1B' = INTEGER: enabled(2)
NETAPP-MIB::haSettings.'NAS-TKC-1A' = INTEGER: enabled(2)
NETAPP-MIB::haSettings.'NAS-TKC-1B' = INTEGER: enabled(2)
With 'AFF-TKC-1A'
, 'AFF-TKC-1B'
, etc. being indexes. In database sensor_oid
value is inserted as ".1.3.6.1.4.1.789.1.21.2.1.3.'AFF-TKC-1B'"
.
My YAML file at the moment looks like:
mib: NETAPP-MIB
modules:
sensors:
state:
data:
-
oid: haSettings
value: haSettings
num_oid: '.1.3.6.1.4.1.789.1.21.2.1.3.{{ $index }}'
index: 'haSettings.{{ $index }}'
descr: '{{ $index }}'
state_name: haSettings
states:
- { value: 1, descr: notConfigured, graph: 0, generic: 3 }
- { value: 2, descr: enabled, graph: 1, generic: 0 }
- { value: 3, descr: disabled, graph: 0, generic: 0 }
- { value: 4, descr: takeoverByPartnerDisabled, graph: 0, generic: 1 }
- { value: 5, descr: thisNodeDead, graph: -1, generic: 3 }
This works fine when i run discovery for the first time, but i have issues with later polling because of the index being a string and not in a dot-decimal notation.
In poll_sensor
function value of $snmp_data
retrieved with bulk_sensor_snmpget
looks like:
array(4) {
[".1.3.6.1.4.1.789.1.21.2.1.3.65.70.70.45.84.75.67.45.49.65"]=>
string(1) "2"
[".1.3.6.1.4.1.789.1.21.2.1.3.65.70.70.45.84.75.67.45.49.66"]=>
string(1) "2"
[".1.3.6.1.4.1.789.1.21.2.1.3.78.65.83.45.84.75.67.45.49.65"]=>
string(1) "2"
[".1.3.6.1.4.1.789.1.21.2.1.3.78.65.83.45.84.75.67.45.49.66"]=>
string(1) "2"
}
and $sensor['sensor_oid']
(as inserted into database) is .1.3.6.1.4.1.789.1.21.2.1.3.'AFF-TKC-1B'
. Although these are in fact the same OIDs they’re not the same keys so I get undefined value as a result.
Obviously, this is the issue only with suffixes that are not numeric, so I’m wondering if there’s a way to resolve this issue with YAML files only (force it to use numeric OID while generating the indexes) or do I need to do it with PHP? Also if this can’t be done with YAML, I would appriciate if someone can point me to existing file that does this so I can use it as an example.
Thanks,
Pavle.