Cacti and Mikrotik - How to graph signal strength without hassle

Signal strength on Mikrotik devices can be monitored by Cacti using SNMP protocol. It is straightforward if you have just couple of those devices but you can be easily overwhelmed by dozens of data templates because wireless card's MAC address is part of the OID.

This problem can be solved by using just one custom data query, data template and graph template.

You can see below that MAC address 00:0B:6B:10:10:10 is translated to 0.11.107.16.16.16:

$ snmpwalk -On -v1 -c "snmp-community" 11.11.11.11 .1.3.6.1.4.1.14988.1.1.1.2.1.1
.1.3.6.1.4.1.14988.1.1.1.2.1.1.0.11.107.16.16.16.2 = Hex-STRING: 00 0B 6B 10 10 10
$ snmpwalk -On -v1 -c "snmp-community" 11.11.11.11 .1.3.6.1.4.1.14988.1.1.1.2.1.3
.1.3.6.1.4.1.14988.1.1.1.2.1.3.0.11.107.16.16.16.2 = INTEGER: -54

Couple of links about data queries

First step

Create new data template with custom name:

Set data input method to Get SNMP Data (Indexed):

Make sure that Use Per-Data Source Value (Ignore this Value) field is checked under data source name:

Internal data source name set to signalStrengthValue, type to gauge, minimum value to -100 and maximum to 0:

Make sure that Use Per-Data Source Value (Ignore this Value) field is checked for custom data index type, index value and output type id:

Second step

Create graph template using (defined in the first step) data source:

Set upper/lower limit:

Third step

Create new file mikrotik_signal_strength.xml in resource/snmp_queries/ directory:

<interface>
        <name>Mikrotik - Get signal strength</name>
        <description>Get signal strength</description>
        <index_order>signalStrengthIndex</index_order>
        <index_order_type>alphabetic</index_order_type>

        <oid_index>.1.3.6.1.4.1.14988.1.1.1.2.1.1</oid_index>
        <oid_index_parse>OID/REGEXP:^.{30}(.*)</oid_index_parse>

        <fields>
                <signalStrengthIndex>
                        <name>Index</name>
                        <source>index</source>
                        <direction>input</direction>
                </signalStrengthIndex>

                <signalStrengthDevice>
                        <name>Device</name>
                        <method>get</method>
                        <source>value</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.14988.1.1.1.2.1.1</oid>
                </signalStrengthDevice>

                <signalStrengthValue>
                        <name>Value</name>
                        <method>get</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.14988.1.1.1.2.1.3</oid>
                </signalStrengthValue>
        </fields>
</interface>

Data query debug information:

+ Running data query [16].
+ Found type = '3' [SNMP Query].
+ Found data query XML file at 'cacti/resource/snmp_queries/mikrotik_signal_strength.xml'
+ XML file parsed ok.
+  missing in XML file, 'Index Count Changed' emulated by counting oid_index entries
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.14988.1.1.1.2.1.1' Index Count: 2
+ Index found at OID: '1.3.6.1.4.1.14988.1.1.1.2.1.1.5.5.5.5.5.5.4' value: '05:05:05:05:05:05'
+ Index found at OID: '1.3.6.1.4.1.14988.1.1.1.2.1.1.8.8.8.8.8.8.3' value: '08:08:08:08:08:08'
+ index_parse at OID: '1.3.6.1.4.1.14988.1.1.1.2.1.1.5.5.5.5.5.5.4' results: '5.5.5.5.5.5.4'
+ index_parse at OID: '1.3.6.1.4.1.14988.1.1.1.2.1.1.8.8.8.8.8.8.3' results: '8.8.8.8.8.8.3'
+ Inserting index data for field 'signalStrengthIndex' [value='5.5.5.5.5.5.4']
+ Inserting index data for field 'signalStrengthIndex' [value='8.8.8.8.8.8.3']
+ Located input field 'signalStrengthDevice' [get]
+ Executing SNMP get for data @ '.1.3.6.1.4.1.14988.1.1.1.2.1.1.5.5.5.5.5.5.4' [value='05:05:05:05:05:05']
+ Executing SNMP get for data @ '.1.3.6.1.4.1.14988.1.1.1.2.1.1.8.8.8.8.8.8.3' [value='08:08:08:08:08:08']

oid_num_indexes can be set using SNMP but it is no necessary to do so.

Fourth step

Create new data query, set correct path to xml file and select Get SNMP Data (Indexed) as input method:

Save and associate (created earlier) graph template:

As data source name and graph name are ignored in templates you can define them here.

Variable |query_signalStrengthDevice| will return wireless card's MAC address.

Fifth step

Associate (created in previous step) data query to desired devices and set re-index method to Index Count Changed:

Now when you want to create new graph for device you can select wireless card (one or more) to monitor:

The example above would look like this:


19.12.2014 - Update

I received an updated version of mikrotik_signal_strength.xml file from Adolfo Montironi that will work with recent Cacti version.

<interface>
        <name>Mikrotik - Get signal strength</name>
        <description>Get signal strength</description>
        <index_order>signalStrengthIndex</index_order>
        <index_order_type>alphabetic</index_order_type>

        <oid_index>.1.3.6.1.4.1.14988.1.1.1.2.1.1</oid_index>
        <oid_index_parse>OID/REGEXP:^.{32}(.*)</oid_index_parse>

        <fields>
                <signalStrengthIndex>
                        <name>Index</name>
                        <source>index</source>
                        <direction>input</direction>
                </signalStrengthIndex>

                <signalStrengthDevice>
                        <name>Device</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.14988.1.1.1.2.1.1</oid>
                </signalStrengthDevice>

                <signalStrengthValue>
                        <name>Value</name>
                        <method>get</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.14988.1.1.1.2.1.3</oid>
                </signalStrengthValue>
        </fields>
</interface>
Milosz Galazka's Picture

About Milosz Galazka

Milosz is a system administrator working for a successful Polish company and a long time supporter of Free Software Foundation and Debian operating system.

Gdansk, Poland https://sleeplessbeastie.eu