Junos Automation (Scripting)
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
Visitor
Posts: 2
Registered: ‎08-29-2017
0 Kudos

Open-NTI How to get tx rx in Mbps for multiple interfaces

Not quite the correct area, so mods move if you need to.

 

Im using Open-NTI and my main aim is to get RX and TX on Ge0/0/2 and ge0/0/6 in mbps from an SRX. Ideally i would have it end up with a stacked graph to give the total bandwidth for the site, while seeing it split 4x ways with TX and RX for each segment.

 

I followed the lldp stats tutorial so once I have the Junos command I should be able to get it into the parser then DB fine. Any tips on the grafana query would be appreciated though.

Visitor
Posts: 2
Registered: ‎08-29-2017
0 Kudos

Re: Open-NTI How to get tx rx in Mbps for multiple interfaces

[ Edited ]

Ok, so I can see the bps rate in 

show interfaces statistics ge-0/0/0 | display xml

And the response in part is:

<rpc-reply xmlns:junos="http://xml.juniper.net/junos/12.1X46/junos">
    <interface-information xmlns="http://xml.juniper.net/junos/12.1X46/junos-interface" junos:style="normal">
        <physical-interface>
            <name>ge-0/0/0</name>
            <admin-status junos:format="Enabled">up</admin-status>
            <oper-status>up</oper-status>
            <local-index>134</local-index>
            <snmp-index>508</snmp-index>
            <link-level-type>Ethernet</link-level-type>
            <mtu>1514</mtu>
            <source-filtering>disabled</source-filtering>
            <link-mode>Full-duplex</link-mode>
            <speed>100mbps</speed>
            <bpdu-error>none</bpdu-error>
            <l2pt-error>none</l2pt-error>
            <loopback>disabled</loopback>
            <if-flow-control>enabled</if-flow-control>
            <if-auto-negotiation>disabled</if-auto-negotiation>
            <if-remote-fault>online</if-remote-fault>
            <if-device-flags>
                <ifdf-present/>
                <ifdf-running/>
            </if-device-flags>
            <if-config-flags>
                <iff-snmp-traps/>
                <internal-flags>0x0</internal-flags>
            </if-config-flags>
            <if-media-flags>
                <ifmf-none/>
            </if-media-flags>
            <physical-interface-cos-information>
                <physical-interface-cos-hw-max-queues>8</physical-interface-cos-hw-max-queues>
                <physical-interface-cos-use-max-queues>8</physical-interface-cos-use-max-queues>
            </physical-interface-cos-information>
            <current-physical-address>10:0e:7e:d1:72:8c</current-physical-address>
            <hardware-physical-address>10:0e:7e:d1:72:8c</hardware-physical-address>
            <interface-flapped junos:seconds="13448072">2017-04-09 10:18:19 UTC (22w1d 15:34 ago)</interface-flapped>
            <statistics-cleared>Never</statistics-cleared>
            <traffic-statistics junos:style="brief">
                <input-bps>1292072</input-bps>
                <input-pps>235</input-pps>
                <output-bps>231816</output-bps>
                <output-pps>164</output-pps>
            </traffic-statistics>
...

I can see the input-bps and output-bps so now I just need to construct the Parser. This is what I have so far:

parser:
    regex-command: show\s+lldp\s+statistics\s+ge-0/0/0\s+\|\s+display\s+xml
    matches:
    -
        type: multi-value
        method: xpath
        xpath: //physical-interface/
        loop:
            key: ./name
            sub-matches:
            -
                xpath: ./traffic-statistics junos:style="brief"/input-bps
                variable-name:  $host.bandwidth.$key.input-bps
                            -
                xpath: ./traffic-statistics junos:style="brief"/output-bps
                variable-name:  $host.bandwidth.$key.output-bps
            

So any ideas if this will work or where I will see errors if it doesnt?