Skip to content

Instantly share code, notes, and snippets.

@marshallmassengill
Last active September 24, 2025 19:29
Show Gist options
  • Select an option

  • Save marshallmassengill/64006cc7ce75959508bd5c677b151b0e to your computer and use it in GitHub Desktop.

Select an option

Save marshallmassengill/64006cc7ce75959508bd5c677b151b0e to your computer and use it in GitHub Desktop.
8311 Metrics OpenNMS Config - See the README.md first.
<xml-groups>
<xml-group name="8311-env-metrics" resource-type="node" resource-xpath="/">
<xml-object name="cpu1_tempC" type="GAUGE" xpath="cpu1_tempC"/>
<xml-object name="cpu2_tempC" type="GAUGE" xpath="cpu2_tempC"/>
<xml-object name="optic_tempC" type="GAUGE" xpath="optic_tempC"/>
<xml-object name="module_voltage" type="GAUGE" xpath="module_voltage"/>
</xml-group>
<xml-group name="8311-optics-metrics" resource-type="node" resource-xpath="/">
<xml-object name="rx_power_dBm" type="GAUGE" xpath="rx_power_dBm"/>
<xml-object name="tx_power_dBm" type="GAUGE" xpath="tx_power_dBm"/>
<xml-object name="tx_bias_mA" type="GAUGE" xpath="tx_bias_mA"/>
</xml-group>
<xml-group name="8311-ploam-metrics" resource-type="node" resource-xpath="/">
<xml-object name="ploam_state" type="GAUGE" xpath="ploam_state"/>
</xml-group>
</xml-groups>
reports=8311.metrics.environment.tempC, \
8311.metrics.environment.module_voltage, \
8311.metrics.environment.signal_power, \
8311.metrics.environment.transmit_bias, \
8311.metrics.environment.ploam_state
report.8311.metrics.environment.tempC.name=Temperature (Celcius)
report.8311.metrics.environment.tempC.columns=cpu1_tempC,cpu2_tempC,optic_tempC
report.8311.metrics.environment.tempC.type=nodeSnmp
report.8311.metrics.environment.tempC.command=--title="Temperature (Celcius)" \
--units-exponent=0 \
--vertical-label="Temp (Celcius)" \
DEF:val1={rrd1}:cpu1_tempC:AVERAGE \
DEF:val2={rrd2}:cpu2_tempC:AVERAGE \
DEF:val3={rrd3}:optic_tempC:AVERAGE \
LINE2:val1#8ecae6:"CPU1 Temp" \
GPRINT:val1:AVERAGE:"Avg \\: %10.2lf" \
GPRINT:val1:MIN:"Min \\: %10.2lf" \
GPRINT:val1:MAX:"Max \\: %10.2lf \\n" \
LINE2:val2#023047:"CPU2 Temp" \
GPRINT:val2:AVERAGE:"Avg \\: %10.2lf" \
GPRINT:val2:MIN:"Min \\: %10.2lf" \
GPRINT:val2:MAX:"Max \\: %10.2lf \\n" \
LINE2:val3#fb8500:"Optic Temp" \
GPRINT:val3:AVERAGE:"Avg \\: %10.2lf" \
GPRINT:val3:MIN:"Min \\: %10.2lf" \
GPRINT:val3:MAX:"Max \\: %10.2lf"
report.8311.metrics.environment.module_voltage.name=Module Voltage
report.8311.metrics.environment.module_voltage.columns=module_voltage
report.8311.metrics.environment.module_voltage.type=nodeSnmp
report.8311.metrics.environment.module_voltage.command=--title="Module Voltage" \
--units-exponent=0 \
--vertical-label="Volts" \
DEF:val1={rrd1}:module_voltage:AVERAGE \
LINE2:val1#1cbb12:"Module Voltage" \
GPRINT:val1:AVERAGE:"Avg \\: %10.2lf" \
GPRINT:val1:MIN:"Min \\: %10.2lf" \
GPRINT:val1:MAX:"Max \\: %10.2lf"
report.8311.metrics.environment.signal_power.name=Signal Power
report.8311.metrics.environment.signal_power.columns=rx_power_dBm,tx_power_dBm
report.8311.metrics.environment.signal_power.type=nodeSnmp
report.8311.metrics.environment.signal_power.command=--title="Signal Power (dBm)" \
--units-exponent=0 \
--vertical-label="Signal Power (dBm)" \
DEF:val1={rrd1}:rx_power_dBm:AVERAGE \
DEF:val2={rrd2}:tx_power_dBm:AVERAGE \
LINE2:val1#e32f0b:"Receive Power" \
GPRINT:val1:AVERAGE:"Avg \\: %10.2lf" \
GPRINT:val1:MIN:"Min \\: %10.2lf" \
GPRINT:val1:MAX:"Max \\: %10.2lf \\n" \
LINE2:val2#286470:"Transmit Power" \
GPRINT:val2:AVERAGE:"Avg \\: %10.2lf" \
GPRINT:val2:MIN:"Min \\: %10.2lf" \
GPRINT:val2:MAX:"Max \\: %10.2lf"
report.8311.metrics.environment.transmit_bias.name=Transmit Bias (milliAmps)
report.8311.metrics.environment.transmit_bias.columns=tx_bias_mA
report.8311.metrics.environment.transmit_bias.type=nodeSnmp
report.8311.metrics.environment.transmit_bias.command=--title="Transmit Bias (milliAmps)" \
--units-exponent=0 \
--vertical-label="milliAmps" \
DEF:val1={rrd1}:tx_bias_mA:AVERAGE \
LINE2:val1#e32f0b:"Transmit Bias" \
GPRINT:val1:AVERAGE:"Avg \\: %10.2lf" \
GPRINT:val1:MIN:"Min \\: %10.2lf" \
GPRINT:val1:MAX:"Max \\: %10.2lf"
report.8311.metrics.environment.ploam_state.name=PLOAM State
report.8311.metrics.environment.ploam_state.columns=ploam_state
report.8311.metrics.environment.ploam_state.type=nodeSnmp
report.8311.metrics.environment.ploam_state.command=--title="Physical Layer OAM State" \
--units-exponent=0 \
--vertical-label="State" \
DEF:val1={rrd1}:ploam_state:AVERAGE \
LINE2:val1#5a189a:"PLOAM State" \
GPRINT:val1:MIN:"Min \\: %10.2lf" \
GPRINT:val1:MAX:"Max \\: %10.2lf \\n" \
COMMENT:"States\\: \\n" \
COMMENT:" 1X (Initial)\\: ONT is powered on and waiting for a downstream signal. \\n" \
COMMENT:" 2X (Standby)\\: ONT received signal and waiting for network parameters. \\n" \
COMMENT:" 3X (Serial Number)\\: ONT responded with its serial number. \\n" \
COMMENT:" 4X (Ranging)\\: OLT measured the distance to the ONT. \\n" \
COMMENT:" 5X (Operation)\\: ONT is active and exchanging data and PLOAM messages."

This leverages the new metrics endpoint for the 8311 firmware (https://192.168.11.1/cgi-bin/luci/8311/metrics) that were added with firmware 2.8.2.

These configs should let you pull that data into OpenNMS.

Add the following to your collectd-configuration.xml (I'm collecting every 30s but you may want to tweak that value for your use case.):

<service name="8311-Metrics" interval="30000" user-defined="false" status="on">
         <parameter key="collection" value="8311-metrics" />
         <parameter key="handler-class" value="org.opennms.protocols.json.collector.DefaultJsonCollectionHandler" />
</service>

<collector service="8311-Metrics" class-name="org.opennms.protocols.xml.collector.XmlCollector" />

Add the following to your xml-datacollection-config.xml file:

   <xml-collection name="8311-metrics">
        <rrd step="300">
            <rra>RRA:AVERAGE:0.5:1:2016</rra>
            <rra>RRA:AVERAGE:0.5:12:1488</rra>
            <rra>RRA:AVERAGE:0.5:288:366</rra>
            <rra>RRA:MAX:0.5:288:366</rra>
            <rra>RRA:MIN:0.5:288:366</rra>
        </rrd>
        <xml-source url="https://{ipaddr}/cgi-bin/luci/8311/metrics">
            <import-groups>xml-datacollection/8311-metrics.xml</import-groups>
            <request>
                    <parameter name="disable-ssl-verification" value="true"/>
            </request>
        </xml-source>
    </xml-collection>

Pull in the 8311-metrics.xml file into your xml-datacollection directory.

Pull in the 8311metrics-graph.properties file into your snmp-graph.properties.d directory if you want the graphs.

Don't forget to add the 8311-metrics service to your node in the requisition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment