Juniper / open-nti

Open Network Telemetry Collector build with open source tools
Apache License 2.0
232 stars 93 forks source link

New Parser show interface extensive #240

Open albertguasch opened 5 years ago

albertguasch commented 5 years ago

Hi,

I am trying to adapt the show interface media to a new one show interface extensive parser in order to get information about queues in each interface.

It Works fine for traffic-statistics and input/output errors but is not working for queue counters. I guess is because xpath is 2 level Deep.

Here an example

parser: regex-command: show\s+interfaces\s+extensive\s+|\s+display\s+xml matches:

    type: multi-value
    method: xpath
    xpath: //*[local-name() = 'physical-interface']
    loop:
        key: ./*[local-name() = 'name']
        sub-matches:
        -
            xpath: ./*[local-name() = 'traffic-statistics']/*[local-name() = 'input-bps']
            variable-name:  $host.interface.$key.input-bps
        -
            xpath: ./*[local-name() = 'traffic-statistics']/*[local-name() = 'input-pps']
            variable-name:  $host.interface.$key.input-pps
        -
            xpath: ./*[local-name() = 'traffic-statistics']/*[local-name() = 'output-bps']
            variable-name:  $host.interface.$key.output-bps
        -
            xpath: ./*[local-name() = 'traffic-statistics']/*[local-name() = 'output-pps']
            variable-name:  $host.interface.$key.output-pps
        -
            xpath: ./*[local-name() = 'input-error-list']/*[local-name() = 'input-errors']
            variable-name:  $host.interface.$key.input-errors
        -
            xpath: ./*[local-name() = 'input-error-list']/*[local-name() = 'input-drops']
            variable-name:  $host.interface.$key.input-drops
        -
            xpath: ./*[local-name() = 'output-error-list']/*[local-name() = 'output-errors']
            variable-name:  $host.interface.$key.output-errors
        -
            xpath: ./*[local-name() = 'output-error-list']/*[local-name() = 'output-drops']
            variable-name:  $host.interface.$key.output-drops
        -
            xpath: ./*[local-name() = 'output-error-list']/*[local-name() = 'output-drops']
            variable-name:  $host.interface.$key.output-drops
         -
            xpath: ./*[local-name() = 'queue-counters']/*[local-name() = 'queue-counters-queued-packets']
            variable-name:  $host.interface.$key.queue-counters-queued-packets

And the XML sample:

reth0 up up 128 536 131 reth SecGW/CPN Ethernet 1518 disabled 10Gbps none none disabled disabled 1 0 0x4000 00:10:db:ff:10:00 00:10:db:ff:10:00 2018-01-11 00:49:15 CET (35w5d 14:34 ago) 2018-09-17 21:59:58 CEST (18:23:57 ago) 10366164095177 1938269248 1271067057281 238333248 9363622448 215514 5195882312 121456 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Egress queues 8 4 0 best-effort 5195048807 5195048806 0 1 expedited-forwarding 0 0 0 2 assured-forwarding 0 0 0 3 network-control 826937 826937 0 0 best-effort 1 expedited-forwarding 2 assured-forwarding 3 network-control
3fr61n commented 5 years ago

Hi Albert,

It seems you need to modify your xpath, could you please try something like

./[local-name() = 'queue-counters']/[local-name() = 'queue'][queue-number='0']/[local-name() = 'queue-counters-queued-packets']

or a simplified version

./[local-name() = 'queue-counters']/queue[queue-number='0']/queue-counters-queued-packets

Then if it works you should repeat the same for each queue-number (0-3)

Regards

albertguasch commented 5 years ago

Hi,

Now I the parser doesn't fail. No log error in the log file. But not able to record an value. Any problema with the variable?

        -
            xpath: ./*[local-name() = 'queue-counters']/*[local-name() = 'queue'][queue-number='0']/*[local-name() = 'queue-counters-qu

eued-packets'] variable-name: $host.interface.$key.queue.queue-number.0.queue-counters-queued-packets