Giter Club home page Giter Club logo

junos_exporter's Introduction

junos_exporter

Go Report Card

Exporter for metrics from devices running JunOS (via SSH) https://prometheus.io/

Remarks

This project is an alternative approach for collecting metrics from Juniper devices. The set of metrics is minimal to increase performance. We (a few friends from the Freifunk community and myself) used the generic snmp_exporter before. Since snmp_exporter is highly generic it comes with a lot of complexity at the cost of performance. We wanted to have an KIS and vendor specific exporter instead. This approach should allow us to scrape our metrics in a very time efficient way. For this reason this project was started.

Important notice for users of version < 0.10

In version 0.10 the config.ignore-targets flag was removed. The same beahior can be achieved by using an match all host pattern:

devices:
  - host: .*
    host_pattern: true

Important notice for users of version < 0.7

In version 0.7 a typo in the prefix of all BGP related metrics was fixed. Please update your queries accordingly.

Important notice for users of version < 0.5

In version 0.5 SNMP was replaced by SSH. This is was a breaking change (metric names were kept). All SNMP related parameters were removed at this point. Please have a look on the new SSH related parameters and update your service units accordingly.

Features

The following metrics are supported by now:

  • Interfaces (bytes transmitted/received, errors, drops, speed)
  • Interface L1/L2 details (FEC, MAC statistics)
  • L2 security (BPDU-block violations)
  • Routes (per table, by protocol)
  • Alarms (count)
  • BGP (message count, prefix counts per peer, session state)
  • OSPFv2, OSPFv3 (number of neighbors)
  • Interface diagnostics (optical signals)
  • ISIS (number of adjacencies, total number of routers)
  • NAT (all available statistics from services nat)
  • Environment (temperatures, fans and PEM power statistics)
  • Routing engine statistics
  • Storage (total, available and used blocks, used percentage)
  • Firewall filters (counters and policers) - needs explicit rights beyond read-only
  • Security policy (SRX) statistics
  • Interface queue statistics
  • Power (Power usage)
  • License statistics (installed/used/needed)
  • L2circuits (tunnel state, number of tunnels)
  • LDP (number of neighbors, sessions and session states)
  • VRRP (state per interface)
  • Subscribers Information (show subscribers client-type dhcp detail)

Feature specific mappings

Some collected time series behave like enums - Integer values represent a certain state/meaning.

L2circuits

0:EI -- encapsulation invalid
1:MM -- mtu mismatch
2:EM -- encapsulation mismatch
3:CM -- control-word mismatch
4:VM -- vlan id mismatch
5:OL -- no outgoing label
6:NC -- intf encaps not CCC/TCC
7:BK -- Backup Connection
8:CB -- rcvd cell-bundle size bad
9:LD -- local site signaled down
10:RD -- remote site signaled down
11:XX -- unknown
12:NP -- interface h/w not present
13:Dn -- down
14:VC-Dn -- Virtual circuit Down
15:Up -- operational
16:CF -- Call admission control failure
17:IB -- TDM incompatible bitrate
18:TM -- TDM misconfiguration
19:ST -- Standby Connection
20:SP -- Static Pseudowire
21:RS -- remote site standby
22:HS -- Hot-standby Connection

LDP

0: "Nonexistant"
1: "Operational"

RPKI

0 = "Down"
1 = "Up"
2 = "Connect"
3 = "Ex-Start"
4 = "Ex-Incr"
5 = "Ex-Full"

VRRP

States map to human readable names like this:

1: "init"
2: "backup"
3: "master"

License statistics

Expiry is either presented as number of days until expiry date or certain special values.

0 ... n = Days until expiry
     -1 = Expired 
   +Inf = Permanent license
   -Inf = Invalid

Install

go get -u github.com/czerwonk/junos_exporter@master

Usage

In this example we want to scrape 3 hosts:

  • Host 1 (DNS: host1.example.com, Port: 22)
  • Host 2 (DNS: host2.example.com, Port: 2233)
  • Host 3 (IP: 172.16.0.1, Port: 22)

Binary

./junos_exporter -ssh.targets="host1.example.com,host2.example.com:2233,172.16.0.1" -ssh.keyfile=junos_exporter

Docker

docker run -d --restart unless-stopped -p 9326:9326 -e SSH_KEYFILE=/ssh-keyfile -v /opt/junos_exporter_keyfile:/ssh-keyfile:ro -v /opt/junos_exporter_config.yml:/config.yml:ro czerwonk/junos_exporter

Authentication

junos_exporter supports SSH authentication via key or password based authentication. -ssh.keyfile=<file> enables key based authentication. -ssh.password=<password-string> enables password based authenticaton, this can also be enabled via the config file in the form of a password: <password-string> entry. Authentication order is ssh key, if none is found the cli flag is checked, the config file is checked last. If no valid auth method is specified junos_exporter exits with an error. Specify the ssh username with the cli flag -ssh.user, with the username key under the configuration file or use the default username of junos_exporter.

Target Parameter

By default, all configured targets will be scrapped when /metrics is hit. As an alternative, it is possible to scrape a specific target by passing the target's hostname/IP address to the target parameter - e.g. http://localhost:9326/metrics?target=1.2.3.4. The specific target must be present in the configuration file or passed in with the ssh.targets flag, you can also specify the -config.ignore-targets flag if you don't want to specify targets in the config or commandline, if none of this matches the request will be denied. This can be used with the below example Prometheus config:

scrape_configs:
  - job_name: 'junos'
    static_configs:
      - targets:
        - 192.168.1.2  # Target device.
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 127.0.0.1:9326  # The junos_exporter's real hostname:port.

Config file

The exporter can be configured with a YAML based config file:

devices:
  - host: router1
    key_file: /path/to/key
  - host: router2
    username: exporter
    password: secret
    # Optional
    # interface_description_regex: '\[([^=\]]+)(=[^\]]+)?\]'
    features:
      isis: true
  - host: switch\d+
    # Tell the exporter that this hostname should be used as a pattern when loading
    # device-specific configurations. This example would match against a hostname
    # like "switch123".
    host_pattern: true
    features:
      bgp: false

# Optional
# interface_description_regex: '\[([^=\]]+)(=[^\]]+)?\]'
features:
  alarm: true
  environment: true
  bgp: true
  ospf: true
  isis: false
  nat: true
  l2circuit: true
  ldp: true
  routes: true
  routing_engine: true
  firewall: false
  interfaces: true
  interface_diagnostic: true
  interface_queue: true
  storage: true
  accounting: true
  ipsec: true
  security: true
  fpc: true
  rpki: true
  rpm: false
  satellite: true
  system: true
  power: true

Dynamic Interface Labels

Version 0.9.5 introduced dynamic labels retrieved from the interface descriptions. Flags are supported a well. The first part (label name) has to comply to the following rules:

  • must not begin with a figure
  • must only contain this charakters: A-Z,a-z,0-9,_
  • is treated lower case
  • must no conflict with label names used in junos_exporter

Values can contain arbitrary characters.

The complete feature can be disabled by setting -dynamic-interface-labels to false.

Examples

Tags:

Description: XYZ [prod]
Label name: prod
Label value: 1

Label value pairs:

Description: XYZ [peer=202739]
Label name: peer
Label value: 202739

Custom Label RegEx

To override the default behavior a interface_description_regex can be supplied. This parameter can be given at a global level or per device. To use per-device regexes the target devices need to be defined in the exporter config. Per-device regex cannot be used in combination with -config.ignore-targets.

Example

The default regex \[([^=\]]+)(=[^\]]+)?\] would match interface descriptions like "Description [foo] [bar=123]".
If we use [[\s]([^=\[\]]+)(=[^,\]]+)?[,\]] we can now match for "Description [foo, bar=123]" instead.

Grafana Dashboards

There is an example Grafana Dashboard included (grafana_dashboard.json), which has some basic variables to choose your device(s) / interface(s)

screenshot

Third Party Components

This software uses components of the following projects

Contributers

for a full list of contributers have a look at https://github.com/czerwonk/junos_exporter/graphs/contributors

License

(c) Daniel Czerwonk, 2017. Licensed under MIT license.

Prometheus

see https://prometheus.io/

JunOS

see https://www.juniper.net/us/en/products-services/nos/junos/

junos_exporter's People

Contributors

4xoc avatar ak1ra24 avatar akyd avatar bjornryden avatar czerwonk avatar dependabot[bot] avatar eesperi avatar fluepke avatar fstolba avatar gaste8 avatar kakkotetsu avatar l3akage avatar lethalwp avatar michaelpsomiadis avatar mirceaulinic avatar momorientes avatar mpraeger avatar ndom91 avatar nothing4you avatar olanystrom avatar olekgo avatar qybl avatar r4scal avatar skorpy2009 avatar stalloneclone avatar stephrdev avatar teliax-logan avatar tynany avatar valerarar avatar wigust avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

junos_exporter's Issues

several interfaces have no bandwidth speed

The actual "bandwidth_speed" comes from a mapping table.

  • But when you build aggregates (aeXX), the bandwidth can sum up. So all values aren't available.
    example:
    MX> show interfaces statistics detail ae2
    Physical interface: ae2, Enabled, Physical link is Up
    Interface index: 129, SNMP ifIndex: 517, Generation: 132
    Description: XXX
    Link-level type: Ethernet, MTU: 9192, Speed: 20Gbps, BPDU Error: None, MAC-REWRITE Error: None, Loopback: Disabled, Source filtering: Disabled, Flow control: Disabled

  • On newer generation mx cards, they even don't report the speed attribute anymore! so i guess it with the interface name. This doesn't work when an aggregate is built over such an interface
    example:

show interfaces statistics detail ae50
Physical interface: ae50, Enabled, Physical link is Down, Extended Port
Interface index: 551, SNMP ifIndex: 2166, Generation: 577
Description: XXX
Link-level type: Flexible-Ethernet, MTU: 9192, Speed: Unspecified, BPDU Error: None, MAC-REWRITE Error: None, Loopback: Disabled, Source filtering: Disabled, Flow control: Disabled

or on a interface:
E0> show interfaces statistics detail ge-100/0/2
Physical interface: ge-100/0/2, Enabled, Physical link is Up, Extended Port
Interface index: 495, SNMP ifIndex: 66584584, Generation: 518
Description: XXX
Link-level type: Ethernet, MTU: 1514, MRU: 1522, LAN-PHY mode, Speed: Unspecified, Duplex: Unspecified, BPDU Error: None, Loop Detect PDU Error: None, Ethernet-Switching Error: None, MAC-REWRITE Error: None, Loopback: Disabled, Source filtering: Disabled, Flow control: Enabled, Auto-negotiation: Disabled,
Remote fault: Online, IEEE 802.3az Energy Efficient Ethernet: Disabled, Auto-MDIX: Enabled

patch attached to limit the impact to the unknown bandwidth
It also contains the "quote" for l2circuits-int-attribute

diffed.txt

add metrics for policer

It would be very helpful to collect policer statistics. Those -to-be-collected- policers should be configurable.

> show policer __default_arp_policer__
Policers:
Name                                                Bytes              Packets
__default_arp_policer__                                 0                    0

This is especially useful, as policer stats are not being exposed through snmp.

Thank you

Exporter did not recover from connection loss

Both of our Exporter got stuck today and a restart was needed to get them connected again. Any Ideas?

time="2019-06-14T07:43:15Z" level=info msg="Loading config from /config.yml" source="main.go:160"
time="2019-06-14T07:43:15Z" level=info msg="Starting JunOS exporter (Version: 0.9.2)\n" source="main.go:232"
time="2019-06-14T07:43:15Z" level=info msg="Listening for /metrics on :9326\n" source="main.go:247"
time="2019-06-14T07:47:13Z" level=info msg="Closing connections to devices" source="main.go:114"
time="2019-06-14T07:47:14Z" level=error msg="Could not connect to xxx: not connected" source="junos_collector.go:159"
time="2019-06-14T07:47:17Z" level=error msg="Could not connect to xxx: not connected" source="junos_collector.go:159"
time="2019-06-14T07:47:24Z" level=info msg="Loading config from /config.yml" source="main.go:160"
time="2019-06-14T07:47:24Z" level=info msg="Starting JunOS exporter (Version: 0.9.2)\n" source="main.go:232"
time="2019-06-14T07:47:24Z" level=info msg="Listening for /metrics on :9326\n" source="main.go:247"
time="2019-06-14T08:38:30Z" level=info msg="Closing connections to devices" source="main.go:114"
time="2019-06-14T08:38:33Z" level=error msg="Could not connect to xxx: not connected" source="junos_collector.go:159"
time="2019-06-14T08:38:33Z" level=error msg="storage: not conneted" source="junos_collector.go:170"
time="2019-06-14T08:38:33Z" level=error msg="interfaces: not conneted" source="junos_collector.go:170"
time="2019-06-14T08:38:33Z" level=error msg="routes: not conneted" source="junos_collector.go:170"
time="2019-06-14T08:38:33Z" level=error msg="bgp: not conneted" source="junos_collector.go:170"
time="2019-06-14T08:38:33Z" level=error msg="isis: not conneted" source="junos_collector.go:170"
time="2019-06-14T08:38:33Z" level=error msg="alarm: not conneted" source="junos_collector.go:170"
time="2019-06-14T08:38:33Z" level=error msg="l2circuit: not conneted" source="junos_collector.go:170"
time="2019-06-14T08:38:33Z" level=error msg="routing-engine: not conneted" source="junos_collector.go:170"
time="2019-06-14T08:38:33Z" level=error msg="interface-diagnostics: not conneted" source="junos_collector.go:170"
time="2019-06-14T08:38:33Z" level=error msg="routes: not conneted" source="junos_collector.go:170"
time="2019-06-14T08:38:33Z" level=error msg="isis: not conneted" source="junos_collector.go:170"
time="2019-06-14T08:38:33Z" level=error msg="ldp: not conneted" source="junos_collector.go:170"
time="2019-06-14T08:38:33Z" level=error msg="l2circuit: not conneted" source="junos_collector.go:170"
time="2019-06-14T08:38:33Z" level=error msg="routing-engine: not conneted" source="junos_collector.go:170"
time="2019-06-14T08:38:33Z" level=error msg="environment: not conneted" source="junos_collector.go:170"
time="2019-06-14T08:38:33Z" level=error msg="interface-diagnostics: not conneted" source="junos_collector.go:170"
time="2019-06-14T08:38:33Z" level=error msg="storage: not conneted" source="junos_collector.go:170"
time="2019-06-14T08:38:33Z" level=error msg="bgp: not conneted" source="junos_collector.go:170"
time="2019-06-14T08:38:34Z" level=error msg="Could not connect to xxx: not connected" source="junos_collector.go:159"
time="2019-06-14T08:38:41Z" level=info msg="Loading config from /config.yml" source="main.go:160"
time="2019-06-14T08:38:41Z" level=info msg="Starting JunOS exporter (Version: 0.9.2)\n" source="main.go:232"
time="2019-06-14T08:38:41Z" level=info msg="Listening for /metrics on :9326\n" source="main.go:247"
time="2019-06-17T11:25:25Z" level=info msg="Lost connection to xxx:22 (EOF). Trying to reconnect..." source="connection_manager.go:160"
time="2019-06-17T11:25:25Z" level=error msg="interfaces: could not run command: wait: remote command exited without exit status or exit signal" source="junos_collector.go:170"
time="2019-06-17T11:25:25Z" level=error msg="routes: not conneted" source="junos_collector.go:170"
time="2019-06-17T11:25:25Z" level=error msg="bgp: not conneted" source="junos_collector.go:170"
time="2019-06-17T11:25:25Z" level=error msg="isis: not conneted" source="junos_collector.go:170"
time="2019-06-17T11:25:25Z" level=error msg="l2circuit: not conneted" source="junos_collector.go:170"
time="2019-06-17T11:25:25Z" level=error msg="routing-engine: not conneted" source="junos_collector.go:170"
time="2019-06-17T11:25:25Z" level=error msg="interface-diagnostics: not conneted" source="junos_collector.go:170"
time="2019-06-20T11:00:39Z" level=info msg="Loading config from /config.yml" source="main.go:160"
time="2019-06-20T11:00:39Z" level=info msg="Starting JunOS exporter (Version: 0.9.2)\n" source="main.go:232"
time="2019-06-20T11:00:39Z" level=info msg="Listening for /metrics on :9326\n" source="main.go:247"

Any tips for increasing performance?

First - thanks for creating junos-exporter! Scraping a single QFX5100 with default exporter configuration takes ~30 seconds. This is a huge improvement over snmp-exporter, which was 2+ minutes.

Any known configuration options on the switch to further decrease the scrape duration?

enhancement request: wildcard matching on interfaces and possibly others

Hi,

It would be useful to be able to wildcard match the interfaces statistics through configuration.

I don't understand the configuration bits too well, so I will leave this to someone with better Go skills.

But this is the line that we manually change to weed out subscriber management interfaces, for example:

err := client.RunCommandAndParse("show interfaces statistics detail", &x)

Example replacement:
show interfaces statistics detail "*-*"

Thanks again for a great project.

asking for keyfile but I use logins in config

Hi,
I'm trying to use exporter but container failing to start. I'm using config.yml and have username and password in there.

devices:
  - host: jun_1
    username: admin
    password: password

But getting error below. Looking at it, it is reading the config file as it gets host but why is it still looking for secret file? I have login details defined:

time="2019-10-23T19:57:55Z" level=info msg="Loading config from /config.yml" source="main.go:166"
time="2019-10-23T19:57:55Z" level=fatal msg="could not initialize exporter. could not initialize config for device jun_1: could not open ssh key file: open /ssh-keyfile: no such file or directory" source="main.go:84"

support for multi lane optics DOM

Multi lane optics do not show the right rx power:

junos_interface_diagnostics_rx_signal_avg_dbm{devicetype="qfx5100-96s-afi",hostname="qfx5k1",instance="1.2.3.4",job="junos_exporter",name="et-0/0/102",target="1.2.3.4",vendor="juniper"} 0
however the transceiver (in this case a 40GE SR4) shows the power for each lane:

mf@qfx5k1> show interfaces diagnostics optics et-0/0/102 | display xml
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/14.1X53/junos">
    <interface-information xmlns="http://xml.juniper.net/junos/14.1X53/junos-interface" junos:style="normal">
        <physical-interface>
            <name>et-0/0/102</name>
            <optics-diagnostics>
                <module-temperature junos:celsius="18.8">19 degrees C / 66 degrees F
                </module-temperature>
                <module-voltage>3.2720</module-voltage>
                <module-temperature-high-alarm>off</module-temperature-high-alarm>
                <module-temperature-low-alarm>off</module-temperature-low-alarm>
                <module-temperature-high-warn>off</module-temperature-high-warn>
                <module-temperature-low-warn>off</module-temperature-low-warn>
                <module-voltage-high-alarm>off</module-voltage-high-alarm>
                <module-voltage-low-alarm>off</module-voltage-low-alarm>
                <module-voltage-high-warn>off</module-voltage-high-warn>
                <module-voltage-low-warn>off</module-voltage-low-warn>
                <module-temperature-high-alarm-threshold junos:celsius="85.0">85 degrees C / 185 degrees F
                </module-temperature-high-alarm-threshold>
                <module-temperature-low-alarm-threshold junos:celsius="-10.0">-10 degrees C / 14 degrees F</module-temperature-low-alarm-threshold>
                <module-temperature-high-warn-threshold junos:celsius="80.0">80 degrees C / 176 degrees F</module-temperature-high-warn-threshold>
                <module-temperature-low-warn-threshold junos:celsius="-5.0">-5 degrees C / 23 degrees F
                </module-temperature-low-warn-threshold>
                <module-voltage-high-alarm-threshold>3.7000</module-voltage-high-alarm-threshold>
                <module-voltage-low-alarm-threshold>2.9000</module-voltage-low-alarm-threshold>
                <module-voltage-high-warn-threshold>3.5990</module-voltage-high-warn-threshold>
                <module-voltage-low-warn-threshold>3.0000</module-voltage-low-warn-threshold>
                <laser-bias-current-high-alarm-threshold>15.000</laser-bias-current-high-alarm-threshold>
                <laser-bias-current-low-alarm-threshold>1.000</laser-bias-current-low-alarm-threshold>
                <laser-bias-current-high-warn-threshold>14.000</laser-bias-current-high-warn-threshold>
                <laser-bias-current-low-warn-threshold>2.000</laser-bias-current-low-warn-threshold>
                <laser-tx-power-high-alarm-threshold>3.1623</laser-tx-power-high-alarm-threshold>
                <laser-tx-power-high-alarm-threshold-dbm>5.00</laser-tx-power-high-alarm-threshold-dbm>
                <laser-tx-power-low-alarm-threshold>0.1000</laser-tx-power-low-alarm-threshold>
                <laser-tx-power-low-alarm-threshold-dbm>-10.00</laser-tx-power-low-alarm-threshold-dbm>
                <laser-tx-power-high-warn-threshold>2.5119</laser-tx-power-high-warn-threshold>
                <laser-tx-power-high-warn-threshold-dbm>4.00</laser-tx-power-high-warn-threshold-dbm>
                <laser-tx-power-low-warn-threshold>0.1259</laser-tx-power-low-warn-threshold>
                <laser-tx-power-low-warn-threshold-dbm>-9.00</laser-tx-power-low-warn-threshold-dbm>
                <laser-rx-power-high-alarm-threshold>1.0000</laser-rx-power-high-alarm-threshold>
                <laser-rx-power-high-alarm-threshold-dbm>0.00</laser-rx-power-high-alarm-threshold-dbm>
                <laser-rx-power-low-alarm-threshold>0.0251</laser-rx-power-low-alarm-threshold>
                <laser-rx-power-low-alarm-threshold-dbm>-16.00</laser-rx-power-low-alarm-threshold-dbm>
                <laser-rx-power-high-warn-threshold>0.7943</laser-rx-power-high-warn-threshold>
                <laser-rx-power-high-warn-threshold-dbm>-1.00</laser-rx-power-high-warn-threshold-dbm>
                <laser-rx-power-low-warn-threshold>0.0316</laser-rx-power-low-warn-threshold>
                <laser-rx-power-low-warn-threshold-dbm>-15.00</laser-rx-power-low-warn-threshold-dbm>
                <optics-diagnostics-lane-values>
                    <lane-index>0</lane-index>
                    <laser-bias-current>9.130</laser-bias-current>
                    <laser-output-power>0.655</laser-output-power>
                    <laser-output-power-dbm>-1.84</laser-output-power-dbm>
                    <laser-rx-optical-power>0.542</laser-rx-optical-power>
                    <laser-rx-optical-power-dbm>-2.66</laser-rx-optical-power-dbm>
                    <laser-bias-current-high-alarm>off</laser-bias-current-high-alarm>
                    <laser-bias-current-low-alarm>off</laser-bias-current-low-alarm>
                    <laser-bias-current-high-warn>off</laser-bias-current-high-warn>
                    <laser-bias-current-low-warn>off</laser-bias-current-low-warn>
                    <laser-rx-power-high-alarm>off</laser-rx-power-high-alarm>
                    <laser-rx-power-low-alarm>off</laser-rx-power-low-alarm>
                    <laser-rx-power-high-warn>off</laser-rx-power-high-warn>
                    <laser-rx-power-low-warn>off</laser-rx-power-low-warn>
                    <tx-loss-of-signal-functionality-alarm>off</tx-loss-of-signal-functionality-alarm>
                    <rx-loss-of-signal-alarm>off</rx-loss-of-signal-alarm>
                    <tx-laser-disabled-alarm>off</tx-laser-disabled-alarm>
                </optics-diagnostics-lane-values>
                <optics-diagnostics-lane-values>
                    <lane-index>1</lane-index>
                    <laser-bias-current>7.776</laser-bias-current>
                    <laser-output-power>0.693</laser-output-power>
                    <laser-output-power-dbm>-1.59</laser-output-power-dbm>
                    <laser-rx-optical-power>0.571</laser-rx-optical-power>
                    <laser-rx-optical-power-dbm>-2.44</laser-rx-optical-power-dbm>
                    <laser-bias-current-high-alarm>off</laser-bias-current-high-alarm>
                    <laser-bias-current-low-alarm>off</laser-bias-current-low-alarm>
                    <laser-bias-current-high-warn>off</laser-bias-current-high-warn>
                    <laser-bias-current-low-warn>off</laser-bias-current-low-warn>
                    <laser-rx-power-high-alarm>off</laser-rx-power-high-alarm>
                    <laser-rx-power-low-alarm>off</laser-rx-power-low-alarm>
                    <laser-rx-power-high-warn>off</laser-rx-power-high-warn>
                    <laser-rx-power-low-warn>off</laser-rx-power-low-warn>
                    <tx-loss-of-signal-functionality-alarm>off</tx-loss-of-signal-functionality-alarm>
                    <rx-loss-of-signal-alarm>off</rx-loss-of-signal-alarm>
                    <tx-laser-disabled-alarm>off</tx-laser-disabled-alarm>
                </optics-diagnostics-lane-values>
                <optics-diagnostics-lane-values>
                    <lane-index>2</lane-index>
                    <laser-bias-current>8.279</laser-bias-current>
                    <laser-output-power>0.695</laser-output-power>
                    <laser-output-power-dbm>-1.58</laser-output-power-dbm>
                    <laser-rx-optical-power>0.775</laser-rx-optical-power>
                    <laser-rx-optical-power-dbm>-1.11</laser-rx-optical-power-dbm>
                    <laser-bias-current-high-alarm>off</laser-bias-current-high-alarm>
                    <laser-bias-current-low-alarm>off</laser-bias-current-low-alarm>
                    <laser-bias-current-high-warn>off</laser-bias-current-high-warn>
                    <laser-bias-current-low-warn>off</laser-bias-current-low-warn>
                    <laser-rx-power-high-alarm>off</laser-rx-power-high-alarm>
                    <laser-rx-power-low-alarm>off</laser-rx-power-low-alarm>
                    <laser-rx-power-high-warn>off</laser-rx-power-high-warn>
                    <laser-rx-power-low-warn>off</laser-rx-power-low-warn>
                    <tx-loss-of-signal-functionality-alarm>off</tx-loss-of-signal-functionality-alarm>
                    <rx-loss-of-signal-alarm>off</rx-loss-of-signal-alarm>
                    <tx-laser-disabled-alarm>off</tx-laser-disabled-alarm>
                </optics-diagnostics-lane-values>
                <optics-diagnostics-lane-values>
                    <lane-index>3</lane-index>
                    <laser-bias-current>9.381</laser-bias-current>
                    <laser-output-power>0.655</laser-output-power>
                    <laser-output-power-dbm>-1.84</laser-output-power-dbm>
                    <laser-rx-optical-power>0.832</laser-rx-optical-power>
                    <laser-rx-optical-power-dbm>-0.80</laser-rx-optical-power-dbm>
                    <laser-bias-current-high-alarm>off</laser-bias-current-high-alarm>
                    <laser-bias-current-low-alarm>off</laser-bias-current-low-alarm>
                    <laser-bias-current-high-warn>off</laser-bias-current-high-warn>
                    <laser-bias-current-low-warn>off</laser-bias-current-low-warn>
                    <laser-rx-power-high-alarm>off</laser-rx-power-high-alarm>
                    <laser-rx-power-low-alarm>off</laser-rx-power-low-alarm>
                    <laser-rx-power-high-warn>on</laser-rx-power-high-warn>
                    <laser-rx-power-low-warn>off</laser-rx-power-low-warn>
                    <tx-loss-of-signal-functionality-alarm>off</tx-loss-of-signal-functionality-alarm>
                    <rx-loss-of-signal-alarm>off</rx-loss-of-signal-alarm>
                    <tx-laser-disabled-alarm>off</tx-laser-disabled-alarm>
                </optics-diagnostics-lane-values>
            </optics-diagnostics>
        </physical-interface>
    </interface-information>
    <cli>
        <banner>{master:0}</banner>
    </cli>
</rpc-reply>

Process exited with status 1

Hey there, looking for some help getting the junos-exporter running. I believe everything is configured correctly, however clearly that's not the case. Below is the issue.

$ ./junos_exporter -config.file=./config.yml -ssh.keyfile=./private_key -ssh.user=root -debug
INFO[0000] Loading config from ./config.yml              source="main.go:78"
INFO[0000] Starting JunOS exporter (Version: 0.6.6)
     source="main.go:105"
INFO[0000] Listening for /metrics on :9326
              source="main.go:119"
2018/10/17 22:36:35 Running command on REDACTED:22: show interfaces diagnostics optics
ERRO[0024] interface-diagnostics: Process exited with status 1  source="junos_collector.go:136"
2018/10/17 22:36:36 Running command on REDACTED:22: show system alarms
ERRO[0025] alarm: Process exited with status 1           source="junos_collector.go:136"
2018/10/17 22:36:37 Running command on REDACTED:22: show interfaces statistics detail
ERRO[0026] interfaces: Process exited with status 1      source="junos_collector.go:136"
2018/10/17 22:36:39 Running command on REDACTED:22: show route summary
^C

The above errors begin when I attempt to scrape the exporter.

$ curl localhost:9326/metrics

And the configuration file in use.

$ cat config.yml
targets:
  - 'REDACTED'

features:
  bgp: true
  ospf: false
  isis: false
  environment: true
  routes: true
  routing_engine: true
  interface_diagnostic: true

I can manually SSH from the same server to switch and successfully run the commands. Example below.

$ ssh root@REDACTED
root@leaf1:RE:0% cli
{master:0}
[email protected]> show interfaces diagnostics optics
Physical interface: et-0/0/48
    Module temperature                        :  33 degrees C / 91 degrees F
    Module voltage                            :  3.2460 V
    Module temperature high alarm             :  Off
    Module temperature low alarm              :  Off
...

Any suggestions?

Unparseable interface diagnostics metrics are incorrectly exported as zero

When a link receives no light, JunOS reports the corresponding dBm signal level as - Inf, which strconv.ParseFloat does not recognize.

The returned diagnostics data is initialized with a default value of zero:

diagnostics := make([]*InterfaceDiagnostics, 0)

In case of parse error, this value is not overriden:

f, err := strconv.ParseFloat(diag.Diagnostics.LaserOutputPowerDbm, 64)
if err == nil {
d.LaserOutputPowerDbm = f
}

which leads to โ€œNo lightโ€™โ€™ (= 0 mW) incorrectly being reported as โ€œ0 dBmโ€ (= 1 mW) (same for all .*Dbm metrics in this code).

Instead, it would be preferable to parse - Inf to -Inf, which is a valid float value.

Feature request: interface speed

Hello,

This exporter is very nice, but I found that interface speed is missing. It would be great if you could add it.

Regards,

After upgrade to v0.9.1 only errors

After upgrading from v0.7.1 to v0.9.1 I constantly get the following error:

time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
time="2019-05-27T15:13:16Z" level=error msg="error encoding and sending metric family: write tcp 127.0.0.1:9326->127.0.0.1:53138: write: broken pipe\n" source="log.go:172"
2019/05/27 15:13:16 http: superfluous response.WriteHeader call from github.com/prometheus/client_golang/prometheus/promhttp.httpError (http.go:305)

Add support for multiple routing engines to routing engine module

Using a single JunOS device will produce metrics just as intended

> show chassis routing-engine 
Routing Engine status:
    Temperature                 49 degrees C / 120 degrees F
    CPU temperature             49 degrees C / 120 degrees F
    Total memory              2048 MB Max  1024 MB used ( 50 percent)
      Control plane memory    1072 MB Max   461 MB used ( 43 percent)
      Data plane memory        976 MB Max   566 MB used ( 58 percent)
    CPU utilization:
      User                      22 percent
      Background                 0 percent
      Kernel                    22 percent
      Interrupt                  0 percent
      Idle                      56 percent
    Model                          YYYY
    Serial ID                      XXXX
    Start time                     2018-05-02 14:56:28 GMT
    Uptime                         587 days, 7 hours, 26 minutes, 11 seconds
    Last reboot reason             Router rebooted after a normal shutdown.
    Load averages:                 1 minute   5 minute  15 minute
                                       0.79       0.84       0.82

When using an HA setup, the output is a bit different and metrics will not be produced for junos_route_engine_*

> show chassis routing-engine 
node0:
--------------------------------------------------------------------------
Routing Engine status:
    Temperature                 46 degrees C / 114 degrees F
    CPU temperature             44 degrees C / 111 degrees F
    Total memory              2048 MB Max  1024 MB used ( 50 percent)
      Control plane memory    1072 MB Max   461 MB used ( 43 percent)
      Data plane memory        976 MB Max   566 MB used ( 58 percent)
    CPU utilization:
      User                       6 percent
      Background                 0 percent
      Kernel                     5 percent
      Interrupt                  0 percent
      Idle                      88 percent
    Model                          YYYY
    Serial ID                      ZZZZ
    Start time                     2019-04-10 20:13:20 GMT
    Uptime                         244 days, 1 hour, 54 minutes, 2 seconds
    Last reboot reason             Router rebooted after a normal shutdown.
    Load averages:                 1 minute   5 minute  15 minute
                                       0.08       0.10       0.08

node1:
--------------------------------------------------------------------------
Routing Engine status:
    Temperature                 48 degrees C / 118 degrees F
    CPU temperature             47 degrees C / 116 degrees F
    Total memory              2048 MB Max  1065 MB used ( 52 percent)
      Control plane memory    1072 MB Max   493 MB used ( 46 percent)
      Data plane memory        976 MB Max   566 MB used ( 58 percent)
    CPU utilization:
      User                      22 percent
      Background                 0 percent
      Kernel                    21 percent
      Interrupt                  0 percent
      Idle                      57 percent
    Model                          YYYY
    Serial ID                      XXXX
    Start time                     2019-04-10 20:12:19 GMT
    Uptime                         244 days, 1 hour, 55 minutes
    Last reboot reason             Router rebooted after a normal shutdown.
    Load averages:                 1 minute   5 minute  15 minute
                                       0.71       0.78       0.75

A way around this would first be to check for the existance of an HA cluster. If there is an HA cluster, parse only the stats from the primary node. I guess though that this only applies to an active/passive cluster and maybe not an active/active cluster? I'm not too keen on Junipers, but I have a few that I can play with.
https://www.juniper.net/documentation/en_US/junos/topics/reference/command-summary/show-chassis-cluster-status.html

> show chassis cluster status 
error: Chassis cluster is not enabled.

vs

> show chassis cluster status 
Monitor Failure codes:
    CS  Cold Sync monitoring        FL  Fabric Connection monitoring
    GR  GRES monitoring             HW  Hardware monitoring
    IF  Interface monitoring        IP  IP monitoring
    LB  Loopback monitoring         MB  Mbuf monitoring
    NH  Nexthop monitoring          NP  NPC monitoring              
    SP  SPU monitoring              SM  Schedule monitoring
    CF  Config Sync monitoring      RE  Relinquish monitoring
 
Cluster ID: 1
Node   Priority Status         Preempt Manual   Monitor-failures

Redundancy group: 0 , Failover count: 1
node0  100      secondary      no      no       None           
node1  1        primary        no      no       None           

Redundancy group: 1 , Failover count: 1
node0  100      secondary      no      no       None           
node1  1        primary        no      no       None           

{primary:node1}

add more detailed BGP metrics

Currently we can already export the imported prefixes count, very similar to 'show bgp summary'.

I would appreciate to see also the prefixes my router is advertising. Furthermore it might make sense to add the routing table as a label to the metrics.

Sample query would be:

router> show bgp neighbor | match "^Peer:|Table|prefixes:"
Peer: *********
  Table inet.0 Bit: 20080
    Active prefixes:              699
    Received prefixes:            699
    Accepted prefixes:            699
    Advertised prefixes:          172
Peer: *********
  Table inet.0 Bit: 20078
    Active prefixes:              593
    Received prefixes:            594
    Accepted prefixes:            594
    Advertised prefixes:          172
Peer: *********
  Table inet.0 Bit: 20045
    Active prefixes:              37
    Received prefixes:            38
    Accepted prefixes:            37
    Advertised prefixes:          172
Peer: *********
  Table inet.0 Bit: 20068
    Active prefixes:              0
    Received prefixes:            0
    Accepted prefixes:            0
    Advertised prefixes:          749871
Peer: *********
  Table bgp.rtarget.0 Bit: 10002
    Active prefixes:              1
    Received prefixes:            1
    Accepted prefixes:            1
    Advertised prefixes:          1
  Table inet.0 Bit: 20003
    Active prefixes:              2498
    Received prefixes:            478433
    Accepted prefixes:            478433
    Advertised prefixes:          735675
  Table inetflow.0 Bit: 30003
    Active prefixes:              0
    Received prefixes:            40
    Accepted prefixes:            40
    Advertised prefixes:          0
  Table bgp.l3vpn.0
    Active prefixes:              440
    Received prefixes:            455
    Accepted prefixes:            455
  Table bgp.l3vpn-inet6.0
    Active prefixes:              0
    Received prefixes:            0
    Accepted prefixes:            0
  Table bgp.l2vpn.0
    Active prefixes:              0
    Received prefixes:            0
    Accepted prefixes:            0
  Table bgp.invpnflow.0
    Active prefixes:              80
    Received prefixes:            80
    Accepted prefixes:            80
  Table *********
    Active prefixes:              218
    Received prefixes:            455
    Accepted prefixes:            455
    Advertised prefixes:          1
  Table *********
    Active prefixes:              0
    Received prefixes:            0
    Accepted prefixes:            0
    Advertised prefixes:          1
  Table *********
    Active prefixes:              40
    Received prefixes:            80
    Accepted prefixes:            80
    Advertised prefixes:          0

Thank you a alot. Looking forward to see junos_exporter to become the new standard in terms of simple metrics export.

Target scrape timeout

I'd like to set a hard scrape timeout, applied to every target. When one device takes more time it wouldnt break the scrape for other devices. This happens on fast scraping intervals for example if one target dies or a device takes longer due to load.

It also would allows to use very tight scraping intervals down to 15sec.

new feature: parallel scraping on target

This issue is meant as for discussing the idea of introducing parallel scraping of single targets.

As it turns out, especially for smaller devices like SRX series the scraping takes very long as new ssh sessions are spawned for each individual command sent to a device. Looking through the ssh package it's not possible to re-use a session and using the startShell function requires handling I/O in the application which doesn't seem very easy to implement.

Therefore I'd like to throw in the idea to change the scraping of a single target by spawning go routines that scrape for the different collectors and later put all results together. This should dramatically reduce the time it takes to scrape a single target. This feature should be configurable as max ssh sessions is surely a limit on many devices.

Any thoughts or problems one can think of if doing so? Happy to provide a PR for this if it's something feasible and of interest.

add support for logical-system discovery

Would it be possible to add logical-system discovery and adding the logical-system name as a label to the metrics?

The problem we are facing now is that we have Juniper routers with logical-systems and without. We have one prometheus job for them:

junos:
  scrape_interval: 2m
  scrape_timeout: 1m
  metrics_path: /metrics
  params:
    ls:
      - ""
      - "logicalsystem1"
  file_sd_configs:
    - files:
        - "/etc/prometheus/targets_junos.yml"
      refresh_interval: 5m

In this case the request for router1 would be made to like this http://exporter:9326/metrics?ls=&ls=logicalsystem1&target=router1

If router one has logical systems, then it will not show metrics that come from logical-systems like bgp, but you will be able to see the metrics like interface, routing engine and storage metrics. Routers with no logical-systems would show all metrics.

If we change this to:

  params:
    ls:
      - "logicalsystem1"
       - ""

the query would be like this http://exporter:9326/metrics?ls=logicalsystem1&ls=&target=router1

Then routers with logical systems would show all metrics, but routers without will show metrics like interface, routing engine, storage only, no bgp metrics.

junos exporter configuration (junos_exporter.yaml):

logical_systems: true

devices:
  - host: router1
    username: user
    password: pass
  - host: router2
    username: user
    password: pass
  - host: router3
    password: user
    username: pass
...

features:
  alarm: true
  bgp: true
  firewall: false
  ospf: true
  isis: false
  nat: false
  ldp: false
  l2circuit: false
  environment: false
  routes: false
  routing_engine: true
  interfaces: true
  interface_diagnostic: false
  interface_queue: false
  storage: true
  accounting: false
  ipsec: false
  fpc: false
  rpki: false

I am running the daemon with only one flag -config.file /etc/prometheus/junos_exporter.yaml

prometheus 2.18.1
junos_exporter 0.9.6

We tried to split the one job into several jobs, but that totally overloaded the cpu. I mention only 1 logical-system in the example above, but we actually have Junipers with more.

In our case our NOC will add more logical-systems and we will manually need to add them to the params list. If there would be discovery we would never need to worry about adding the params.

l2circuit empty but filled with "----" crashes the l2circuit parsing

Hello,

When on a juniper, we configure a l2circuit that never came up, some values can be filled with "----" when the terminal-size is large enough.

example:

show l2circuit connections brief
Legend for interface status
Up -- operational
Dn -- down
Neighbor: 192.168.175.1
Interface Type St Time last up # Up trans
xe-0/0/2:1.45(vc 100242) rmt Up May 25 18:39:56 2020 1
xe-0/0/2:1.82(vc 110279) rmt HS ----- ----

which gives in the junos_exporter:

2020/05/26 14:23:14 Running command on mxvpn-xxx-1: show l2circuit connections brief
2020/05/26 14:23:15 Output for mxvpn-xxx-1:


192.168.175.1

xe-0/0/2:1.45(vc 100242)
rmt
Up
May 25 18:39:56 2020

1


xe-0/0/2:1.82(vc 110279)
rmt
HS
-----
----


(snip)

time="2020-05-26T14:23:15+02:00" level=error msg="L2 Circuit: strconv.ParseInt: parsing "----": invalid syntax" source="junos_collector.go:129"
2020/05/26 14:23:15 Running command on mxvpn-xxx-1: show ldp session

How often do you pull?

Loading the metrics page in Chrome takes about 20-30s for my single SRX. So the regular interval of 15s won't work I guess.

What interval is normally used? And is there a way to monitor if IPsec connections are up/connected or should I use something else for that (ping/whatever)?

Accounting section hardcoded for fpc0

The accounting section is hardcoded for fpc0:

err := client.RunCommandAndParse("show services accounting flow inline-jflow fpc-slot 0", &x)

err := client.RunCommandAndParse("show services accounting errors inline-jflow fpc-slot 0", &x)

I'm unsure how discovery can be done, but at least for my usage I'm having an MS-MPC in slot 0, causing it to fail with picinfo dying on the actual router.

No storage metrics from EX2300

I don't get any storage metrics from our Juniper EX2300-48P and EX2300-24T

There is nothing obvious in the log, and i get the other metrics just fine.
Im running junos_exporter Version: 0.9.5.

I have the feature enabled i the config:

features:
  environment: true
  bgp: false
  ospf: false
  isis: false
  nat: false
  l2circuit: true
  ldp: true
  routes: true
  routing_engine: true
  interfaces: true
  interface_diagnostic: true
  storage: true
  fpc: true

Add feature ddos-protection protocols statistics

Would it be possible to add a feature to gather the data from "show ddos-protection protocols statistics" this is on a qfx5100 but the info is not available via SNMP and especially when the state goes in to viol state, it would be useful to know The rate and other stats would be very pretty in Prometheus and Grafana

e.g 
arp         aggregate   5909233807      795855119      2563     2436      viol 
exception   aggregate   43012309        14134          16       51        ok   
reject      aggregate   15387564        12096314       0        111       viol 
nobody@device1> show ddos-protection protocols statistics terse 
Packet types: 72, Received traffic: 23, Currently violated: 0

Protocol    Packet      Received        Dropped        Rate     Violation State
group       type        (packets)       (packets)      (pps)    counts
icmp        aggregate   8514937         0              0        0         ok   
igmp        aggregate   1817115         0              0        0         ok   
rip         aggregate   532             0              0        0         ok   
bfd         aggregate   1395185887      0              53       0         ok   
bfd         unclass..   662828216       0              25       0         ok   
bfd         multihop-bfd 732357671      0              28       0         ok   
bgp         aggregate   1379178398      14025          54       10        ok   
vrrp        aggregate   39051164        0              6        0         ok   
telnet      aggregate   814             0              0        0         ok   
ftp         aggregate   53              0              0        0         ok   
ssh         aggregate   1335            0              0        0         ok   
snmp        aggregate   26464915        0              0        0         ok   
igmpv6      mld         3152046         0              0        0         ok   
lldp        aggregate   21996344        0              1        0         ok   
arp         aggregate   6259666787      819274186      285      3121      ok   
exception   aggregate   58291345        658            1        24        ok   
reject      aggregate   10106269        7024184        0        129       ok   
dns         aggregate   56              0              0        0         ok   
ndpv6       aggregate   185012          0              0        0         ok   
uncls       aggregate   61437907        109264         1        30        ok   
resolve     aggregate   108841431       1602           9        9         ok   
ospf-hello  aggregate   236185          0              0        0         ok   
dhcpv4v6    aggregate   46801170        0              3        0         ok   
nobody@device1>> show ddos-protection protocols statistics terse | display xml 
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/17.3R3/junos">
    <ddos-protocols-information xmlns="http://xml.juniper.net/junos/17.3R3/junos-jddosd" junos:style="statistics">
        <total-packet-types>72</total-packet-types>
        <packet-types-rcvd-packets>23</packet-types-rcvd-packets>
        <packet-types-in-violation>0</packet-types-in-violation>
        <ddos-protocol-group>
            <ddos-protocol>
                <ddos-system-statistics junos:style="brief">
                    <group-name>icmp</group-name>
                    <packet-type>aggregate</packet-type>
                    <packet-received>8514943</packet-received>
                    <packet-dropped>0</packet-dropped>
                    <packet-arrival-rate>0</packet-arrival-rate>
                    <policer-violation-count>0</policer-violation-count>
                    <protocol-states>ok</protocol-states>
                </ddos-system-statistics>
            </ddos-protocol>
        </ddos-protocol-group>
        <ddos-protocol-group>
            <ddos-protocol>
                <ddos-system-statistics junos:style="brief">
                    <group-name>igmp</group-name>
                    <packet-type>aggregate</packet-type>
                    <packet-received>1817115</packet-received>
                    <packet-dropped>0</packet-dropped>
                    <packet-arrival-rate>0</packet-arrival-rate>
                    <policer-violation-count>0</policer-violation-count>
                    <protocol-states>ok</protocol-states>
                </ddos-system-statistics>
            </ddos-protocol>
        </ddos-protocol-group>
        <ddos-protocol-group>
            <ddos-protocol>
                <ddos-system-statistics junos:style="brief">
                    <group-name>rip</group-name>
                    <packet-type>aggregate</packet-type>
                    <packet-received>532</packet-received>
                    <packet-dropped>0</packet-dropped>
                    <packet-arrival-rate>0</packet-arrival-rate>
                    <policer-violation-count>0</policer-violation-count>
                    <protocol-states>ok</protocol-states>
                </ddos-system-statistics>
            </ddos-protocol>
        </ddos-protocol-group>          
        <ddos-protocol-group>
            <ddos-protocol>
                <ddos-system-statistics junos:style="brief">
                    <group-name>bfd</group-name>
                    <packet-type>aggregate</packet-type>
                    <packet-received>1395186422</packet-received>
                    <packet-dropped>0</packet-dropped>
                    <packet-arrival-rate>52</packet-arrival-rate>
                    <policer-violation-count>0</policer-violation-count>
                    <protocol-states>ok</protocol-states>
                </ddos-system-statistics>
            </ddos-protocol>
            <ddos-protocol>
                <ddos-system-statistics junos:style="brief">
                    <group-name>bfd</group-name>
                    <packet-type>unclass..</packet-type>
                    <packet-received>662828468</packet-received>
                    <packet-dropped>0</packet-dropped>
                    <packet-arrival-rate>25</packet-arrival-rate>
                    <policer-violation-count>0</policer-violation-count>
                    <protocol-states>ok</protocol-states>
                </ddos-system-statistics>
            </ddos-protocol>
            <ddos-protocol>
                <ddos-system-statistics junos:style="brief">
                    <group-name>bfd</group-name>
                    <packet-type>multihop-bfd</packet-type>
                    <packet-received>732357954</packet-received>
                    <packet-dropped>0</packet-dropped>
                    <packet-arrival-rate>27</packet-arrival-rate>
                    <policer-violation-count>0</policer-violation-count>
                    <protocol-states>ok</protocol-states>
                </ddos-system-statistics>
            </ddos-protocol>
        </ddos-protocol-group>
        <ddos-protocol-group>
            <ddos-protocol>
                <ddos-system-statistics junos:style="brief">
                    <group-name>bgp</group-name>
                    <packet-type>aggregate</packet-type>
                    <packet-received>1379179922</packet-received>
                    <packet-dropped>14025</packet-dropped>
                    <packet-arrival-rate>233</packet-arrival-rate>
                    <policer-violation-count>10</policer-violation-count>
                    <protocol-states>ok</protocol-states>
                </ddos-system-statistics>
            </ddos-protocol>
        </ddos-protocol-group>
        <ddos-protocol-group>
            <ddos-protocol>
                <ddos-system-statistics junos:style="brief">
                    <group-name>vrrp</group-name>
                    <packet-type>aggregate</packet-type>
                    <packet-received>39051224</packet-received>
                    <packet-dropped>0</packet-dropped>
                    <packet-arrival-rate>5</packet-arrival-rate>
                    <policer-violation-count>0</policer-violation-count>
                    <protocol-states>ok</protocol-states>
                </ddos-system-statistics>
            </ddos-protocol>
        </ddos-protocol-group>
        <ddos-protocol-group>
            <ddos-protocol>
                <ddos-system-statistics junos:style="brief">
                    <group-name>telnet</group-name>
                    <packet-type>aggregate</packet-type>
                    <packet-received>814</packet-received>
                    <packet-dropped>0</packet-dropped>
                    <packet-arrival-rate>0</packet-arrival-rate>
                    <policer-violation-count>0</policer-violation-count>
                    <protocol-states>ok</protocol-states>
                </ddos-system-statistics>
            </ddos-protocol>
        </ddos-protocol-group>
        <ddos-protocol-group>
            <ddos-protocol>
                <ddos-system-statistics junos:style="brief">
                    <group-name>ftp</group-name>
                    <packet-type>aggregate</packet-type>
                    <packet-received>53</packet-received>
                    <packet-dropped>0</packet-dropped>
                    <packet-arrival-rate>0</packet-arrival-rate>
                    <policer-violation-count>0</policer-violation-count>
                    <protocol-states>ok</protocol-states>
                </ddos-system-statistics>
            </ddos-protocol>            
        </ddos-protocol-group>
        <ddos-protocol-group>
            <ddos-protocol>
                <ddos-system-statistics junos:style="brief">
                    <group-name>ssh</group-name>
                    <packet-type>aggregate</packet-type>
                    <packet-received>1335</packet-received>
                    <packet-dropped>0</packet-dropped>
                    <packet-arrival-rate>0</packet-arrival-rate>
                    <policer-violation-count>0</policer-violation-count>
                    <protocol-states>ok</protocol-states>
                </ddos-system-statistics>
            </ddos-protocol>
        </ddos-protocol-group>
        <ddos-protocol-group>
            <ddos-protocol>
                <ddos-system-statistics junos:style="brief">
                    <group-name>snmp</group-name>
                    <packet-type>aggregate</packet-type>
                    <packet-received>26464915</packet-received>
                    <packet-dropped>0</packet-dropped>
                    <packet-arrival-rate>0</packet-arrival-rate>
                    <policer-violation-count>0</policer-violation-count>
                    <protocol-states>ok</protocol-states>
                </ddos-system-statistics>
            </ddos-protocol>
        </ddos-protocol-group>
        <ddos-protocol-group>
            <ddos-protocol>
                <ddos-system-statistics junos:style="brief">
                    <group-name>igmpv6</group-name>
                    <packet-type>mld</packet-type>
                    <packet-received>3152046</packet-received>
                    <packet-dropped>0</packet-dropped>
                    <packet-arrival-rate>0</packet-arrival-rate>
                    <policer-violation-count>0</policer-violation-count>
                    <protocol-states>ok</protocol-states>
                </ddos-system-statistics>
            </ddos-protocol>
        </ddos-protocol-group>
        <ddos-protocol-group>
            <ddos-protocol>
                <ddos-system-statistics junos:style="brief">
                    <group-name>lldp</group-name>
                    <packet-type>aggregate</packet-type>
                    <packet-received>21996350</packet-received>
                    <packet-dropped>0</packet-dropped>
                    <packet-arrival-rate>0</packet-arrival-rate>
                    <policer-violation-count>0</policer-violation-count>
                    <protocol-states>ok</protocol-states>
                </ddos-system-statistics>
            </ddos-protocol>
        </ddos-protocol-group>
        <ddos-protocol-group>
            <ddos-protocol>
                <ddos-system-statistics junos:style="brief">
                    <group-name>arp</group-name>
                    <packet-type>aggregate</packet-type>
                    <packet-received>6259669637</packet-received>
                    <packet-dropped>819274186</packet-dropped>
                    <packet-arrival-rate>295</packet-arrival-rate>
                    <policer-violation-count>3121</policer-violation-count>
                    <protocol-states>ok</protocol-states>
                </ddos-system-statistics>
            </ddos-protocol>
        </ddos-protocol-group>
        <ddos-protocol-group>
            <ddos-protocol>
                <ddos-system-statistics junos:style="brief">
                    <group-name>exception</group-name>
                    <packet-type>aggregate</packet-type>
                    <packet-received>58291358</packet-received>
                    <packet-dropped>658</packet-dropped>
                    <packet-arrival-rate>0</packet-arrival-rate>
                    <policer-violation-count>24</policer-violation-count>
                    <protocol-states>ok</protocol-states>
                </ddos-system-statistics>
            </ddos-protocol>
        </ddos-protocol-group>
        <ddos-protocol-group>
            <ddos-protocol>
                <ddos-system-statistics junos:style="brief">
                    <group-name>reject</group-name>
                    <packet-type>aggregate</packet-type>
                    <packet-received>10106269</packet-received>
                    <packet-dropped>7024184</packet-dropped>
                    <packet-arrival-rate>0</packet-arrival-rate>
                    <policer-violation-count>129</policer-violation-count>
                    <protocol-states>ok</protocol-states>
                </ddos-system-statistics>
            </ddos-protocol>
        </ddos-protocol-group>
        <ddos-protocol-group>
            <ddos-protocol>
                <ddos-system-statistics junos:style="brief">
                    <group-name>dns</group-name>
                    <packet-type>aggregate</packet-type>
                    <packet-received>56</packet-received>
                    <packet-dropped>0</packet-dropped>
                    <packet-arrival-rate>0</packet-arrival-rate>
                    <policer-violation-count>0</policer-violation-count>
                    <protocol-states>ok</protocol-states>
                </ddos-system-statistics>
            </ddos-protocol>
        </ddos-protocol-group>
        <ddos-protocol-group>
            <ddos-protocol>
                <ddos-system-statistics junos:style="brief">
                    <group-name>ndpv6</group-name>
                    <packet-type>aggregate</packet-type>
                    <packet-received>185012</packet-received>
                    <packet-dropped>0</packet-dropped>
                    <packet-arrival-rate>0</packet-arrival-rate>
                    <policer-violation-count>0</policer-violation-count>
                    <protocol-states>ok</protocol-states>
                </ddos-system-statistics>
            </ddos-protocol>
        </ddos-protocol-group>
        <ddos-protocol-group>
            <ddos-protocol>
                <ddos-system-statistics junos:style="brief">
                    <group-name>uncls</group-name>
                    <packet-type>aggregate</packet-type>
                    <packet-received>61437921</packet-received>
                    <packet-dropped>109264</packet-dropped>
                    <packet-arrival-rate>2</packet-arrival-rate>
                    <policer-violation-count>30</policer-violation-count>
                    <protocol-states>ok</protocol-states>
                </ddos-system-statistics>
            </ddos-protocol>
        </ddos-protocol-group>
        <ddos-protocol-group>
            <ddos-protocol>
                <ddos-system-statistics junos:style="brief">
                    <group-name>resolve</group-name>
                    <packet-type>aggregate</packet-type>
                    <packet-received>108841525</packet-received>
                    <packet-dropped>1602</packet-dropped>
                    <packet-arrival-rate>9</packet-arrival-rate>
                    <policer-violation-count>9</policer-violation-count>
                    <protocol-states>ok</protocol-states>
                </ddos-system-statistics>
            </ddos-protocol>
        </ddos-protocol-group>
        <ddos-protocol-group>
            <ddos-protocol>
                <ddos-system-statistics junos:style="brief">
                    <group-name>ospf-hello</group-name>
                    <packet-type>aggregate</packet-type>
                    <packet-received>236185</packet-received>
                    <packet-dropped>0</packet-dropped>
                    <packet-arrival-rate>0</packet-arrival-rate>
                    <policer-violation-count>0</policer-violation-count>
                    <protocol-states>ok</protocol-states>
                </ddos-system-statistics>
            </ddos-protocol>
        </ddos-protocol-group>
        <ddos-protocol-group>
            <ddos-protocol>
                <ddos-system-statistics junos:style="brief">
                    <group-name>dhcpv4v6</group-name>
                    <packet-type>aggregate</packet-type>
                    <packet-received>46801190</packet-received>
                    <packet-dropped>0</packet-dropped>
                    <packet-arrival-rate>1</packet-arrival-rate>
                    <policer-violation-count>0</policer-violation-count>
                    <protocol-states>ok</protocol-states>
                </ddos-system-statistics>
            </ddos-protocol>
        </ddos-protocol-group>
    </ddos-protocols-information>
    <cli>                               
        <banner>{master:0}</banner>
    </cli>
</rpc-reply>
{master:0}
nobody@device1> show ddos-protection protocols statistics terse | display json  
{
    "ddos-protocols-information" : [
    {
        "attributes" : {"xmlns" : "http://xml.juniper.net/junos/17.3R3/junos-jddosd", 
                        "junos:style" : "statistics"
                       }, 
        "total-packet-types" : [
        {
            "data" : "72"
        }
        ], 
        "packet-types-rcvd-packets" : [
        {
            "data" : "23"
        }
        ], 
        "packet-types-in-violation" : [
        {
            "data" : "0"
        }
        ], 
        "ddos-protocol-group" : [
        {
            "ddos-protocol" : [
            {
                "ddos-system-statistics" : [
                {
                    "attributes" : {"junos:style" : "brief"}, 
                    "group-name" : [
                    {
                        "data" : "icmp"
                    }
                    ], 
                    "packet-type" : [
                    {
                        "data" : "aggregate"
                    }
                    ], 
                    "packet-received" : [
                    {
                        "data" : "8514946"
                    }
                    ], 
                    "packet-dropped" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "packet-arrival-rate" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "policer-violation-count" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "protocol-states" : [
                    {
                        "data" : "ok"
                    }
                    ]
                }
                ]
            }
            ]
        }, 
        {
            "ddos-protocol" : [
            {
                "ddos-system-statistics" : [
                {
                    "attributes" : {"junos:style" : "brief"}, 
                    "group-name" : [
                    {
                        "data" : "igmp"
                    }
                    ], 
                    "packet-type" : [
                    {
                        "data" : "aggregate"
                    }
                    ], 
                    "packet-received" : [
                    {
                        "data" : "1817115"
                    }
                    ], 
                    "packet-dropped" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "packet-arrival-rate" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "policer-violation-count" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "protocol-states" : [
                    {
                        "data" : "ok"
                    }
                    ]
                }
                ]
            }
            ]
        }, 
        {
            "ddos-protocol" : [
            {
                "ddos-system-statistics" : [
                {
                    "attributes" : {"junos:style" : "brief"}, 
                    "group-name" : [
                    {
                        "data" : "rip"
                    }
                    ], 
                    "packet-type" : [
                    {
                        "data" : "aggregate"
                    }
                    ],                  
                    "packet-received" : [
                    {
                        "data" : "532"
                    }
                    ], 
                    "packet-dropped" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "packet-arrival-rate" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "policer-violation-count" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "protocol-states" : [
                    {
                        "data" : "ok"
                    }
                    ]
                }
                ]
            }
            ]
        }, 
        {
            "ddos-protocol" : [
            {
                "ddos-system-statistics" : [
                {
                    "attributes" : {"junos:style" : "brief"}, 
                    "group-name" : [
                    {
                        "data" : "bfd"
                    }
                    ], 
                    "packet-type" : [
                    {                   
                        "data" : "aggregate"
                    }
                    ], 
                    "packet-received" : [
                    {
                        "data" : "1395186686"
                    }
                    ], 
                    "packet-dropped" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "packet-arrival-rate" : [
                    {
                        "data" : "53"
                    }
                    ], 
                    "policer-violation-count" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "protocol-states" : [
                    {
                        "data" : "ok"
                    }
                    ]
                }
                ]
            }, 
            {
                "ddos-system-statistics" : [
                {
                    "attributes" : {"junos:style" : "brief"}, 
                    "group-name" : [
                    {
                        "data" : "bfd"
                    }
                    ], 
                    "packet-type" : [
                    {
                        "data" : "unclass.."
                    }
                    ], 
                    "packet-received" : [
                    {
                        "data" : "662828592"
                    }
                    ], 
                    "packet-dropped" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "packet-arrival-rate" : [
                    {
                        "data" : "25"
                    }
                    ], 
                    "policer-violation-count" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "protocol-states" : [
                    {
                        "data" : "ok"
                    }
                    ]
                }
                ]
            }, 
            {
                "ddos-system-statistics" : [
                {
                    "attributes" : {"junos:style" : "brief"}, 
                    "group-name" : [
                    {
                        "data" : "bfd"
                    }
                    ], 
                    "packet-type" : [
                    {
                        "data" : "multihop-bfd"
                    }                   
                    ], 
                    "packet-received" : [
                    {
                        "data" : "732358094"
                    }
                    ], 
                    "packet-dropped" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "packet-arrival-rate" : [
                    {
                        "data" : "28"
                    }
                    ], 
                    "policer-violation-count" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "protocol-states" : [
                    {
                        "data" : "ok"
                    }
                    ]
                }
                ]
            }
            ]
        }, 
        {
            "ddos-protocol" : [
            {
                "ddos-system-statistics" : [
                {
                    "attributes" : {"junos:style" : "brief"}, 
                    "group-name" : [
                    {
                        "data" : "bgp"
                    }
                    ], 
                    "packet-type" : [   
                    {
                        "data" : "aggregate"
                    }
                    ], 
                    "packet-received" : [
                    {
                        "data" : "1379179951"
                    }
                    ], 
                    "packet-dropped" : [
                    {
                        "data" : "14025"
                    }
                    ], 
                    "packet-arrival-rate" : [
                    {
                        "data" : "5"
                    }
                    ], 
                    "policer-violation-count" : [
                    {
                        "data" : "10"
                    }
                    ], 
                    "protocol-states" : [
                    {
                        "data" : "ok"
                    }
                    ]
                }
                ]
            }
            ]
        }, 
        {
            "ddos-protocol" : [
            {
                "ddos-system-statistics" : [
                {
                    "attributes" : {"junos:style" : "brief"}, 
                    "group-name" : [
                    {
                        "data" : "vrrp" 
                    }
                    ], 
                    "packet-type" : [
                    {
                        "data" : "aggregate"
                    }
                    ], 
                    "packet-received" : [
                    {
                        "data" : "39051254"
                    }
                    ], 
                    "packet-dropped" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "packet-arrival-rate" : [
                    {
                        "data" : "6"
                    }
                    ], 
                    "policer-violation-count" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "protocol-states" : [
                    {
                        "data" : "ok"
                    }
                    ]
                }
                ]
            }
            ]
        }, 
        {
            "ddos-protocol" : [
            {
                "ddos-system-statistics" : [
                {
                    "attributes" : {"junos:style" : "brief"}, 
                    "group-name" : [
                    {
                        "data" : "telnet"
                    }
                    ], 
                    "packet-type" : [
                    {
                        "data" : "aggregate"
                    }
                    ], 
                    "packet-received" : [
                    {
                        "data" : "814"
                    }
                    ], 
                    "packet-dropped" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "packet-arrival-rate" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "policer-violation-count" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "protocol-states" : [
                    {
                        "data" : "ok"
                    }
                    ]
                }
                ]
            }
            ]
        }, 
        {
            "ddos-protocol" : [
            {                           
                "ddos-system-statistics" : [
                {
                    "attributes" : {"junos:style" : "brief"}, 
                    "group-name" : [
                    {
                        "data" : "ftp"
                    }
                    ], 
                    "packet-type" : [
                    {
                        "data" : "aggregate"
                    }
                    ], 
                    "packet-received" : [
                    {
                        "data" : "53"
                    }
                    ], 
                    "packet-dropped" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "packet-arrival-rate" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "policer-violation-count" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "protocol-states" : [
                    {
                        "data" : "ok"
                    }
                    ]
                }
                ]
            }
            ]
        },                              
        {
            "ddos-protocol" : [
            {
                "ddos-system-statistics" : [
                {
                    "attributes" : {"junos:style" : "brief"}, 
                    "group-name" : [
                    {
                        "data" : "ssh"
                    }
                    ], 
                    "packet-type" : [
                    {
                        "data" : "aggregate"
                    }
                    ], 
                    "packet-received" : [
                    {
                        "data" : "1335"
                    }
                    ], 
                    "packet-dropped" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "packet-arrival-rate" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "policer-violation-count" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "protocol-states" : [
                    {
                        "data" : "ok"
                    }
                    ]
                }
                ]                       
            }
            ]
        }, 
        {
            "ddos-protocol" : [
            {
                "ddos-system-statistics" : [
                {
                    "attributes" : {"junos:style" : "brief"}, 
                    "group-name" : [
                    {
                        "data" : "snmp"
                    }
                    ], 
                    "packet-type" : [
                    {
                        "data" : "aggregate"
                    }
                    ], 
                    "packet-received" : [
                    {
                        "data" : "26464918"
                    }
                    ], 
                    "packet-dropped" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "packet-arrival-rate" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "policer-violation-count" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "protocol-states" : [
                    {
                        "data" : "ok"
                    }                   
                    ]
                }
                ]
            }
            ]
        }, 
        {
            "ddos-protocol" : [
            {
                "ddos-system-statistics" : [
                {
                    "attributes" : {"junos:style" : "brief"}, 
                    "group-name" : [
                    {
                        "data" : "igmpv6"
                    }
                    ], 
                    "packet-type" : [
                    {
                        "data" : "mld"
                    }
                    ], 
                    "packet-received" : [
                    {
                        "data" : "3152046"
                    }
                    ], 
                    "packet-dropped" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "packet-arrival-rate" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "policer-violation-count" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "protocol-states" : [
                    {
                        "data" : "ok"
                    }
                    ]
                }
                ]
            }
            ]
        }, 
        {
            "ddos-protocol" : [
            {
                "ddos-system-statistics" : [
                {
                    "attributes" : {"junos:style" : "brief"}, 
                    "group-name" : [
                    {
                        "data" : "lldp"
                    }
                    ], 
                    "packet-type" : [
                    {
                        "data" : "aggregate"
                    }
                    ], 
                    "packet-received" : [
                    {
                        "data" : "21996353"
                    }
                    ], 
                    "packet-dropped" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "packet-arrival-rate" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "policer-violation-count" : [
                    {
                        "data" : "0"    
                    }
                    ], 
                    "protocol-states" : [
                    {
                        "data" : "ok"
                    }
                    ]
                }
                ]
            }
            ]
        }, 
        {
            "ddos-protocol" : [
            {
                "ddos-system-statistics" : [
                {
                    "attributes" : {"junos:style" : "brief"}, 
                    "group-name" : [
                    {
                        "data" : "arp"
                    }
                    ], 
                    "packet-type" : [
                    {
                        "data" : "aggregate"
                    }
                    ], 
                    "packet-received" : [
                    {
                        "data" : "6259671063"
                    }
                    ], 
                    "packet-dropped" : [
                    {
                        "data" : "819274186"
                    }
                    ], 
                    "packet-arrival-rate" : [
                    {
                        "data" : "293"
                    }
                    ],                  
                    "policer-violation-count" : [
                    {
                        "data" : "3121"
                    }
                    ], 
                    "protocol-states" : [
                    {
                        "data" : "ok"
                    }
                    ]
                }
                ]
            }
            ]
        }, 
        {
            "ddos-protocol" : [
            {
                "ddos-system-statistics" : [
                {
                    "attributes" : {"junos:style" : "brief"}, 
                    "group-name" : [
                    {
                        "data" : "exception"
                    }
                    ], 
                    "packet-type" : [
                    {
                        "data" : "aggregate"
                    }
                    ], 
                    "packet-received" : [
                    {
                        "data" : "58291360"
                    }
                    ], 
                    "packet-dropped" : [
                    {
                        "data" : "658"
                    }
                    ], 
                    "packet-arrival-rate" : [
                    {                   
                        "data" : "0"
                    }
                    ], 
                    "policer-violation-count" : [
                    {
                        "data" : "24"
                    }
                    ], 
                    "protocol-states" : [
                    {
                        "data" : "ok"
                    }
                    ]
                }
                ]
            }
            ]
        }, 
        {
            "ddos-protocol" : [
            {
                "ddos-system-statistics" : [
                {
                    "attributes" : {"junos:style" : "brief"}, 
                    "group-name" : [
                    {
                        "data" : "reject"
                    }
                    ], 
                    "packet-type" : [
                    {
                        "data" : "aggregate"
                    }
                    ], 
                    "packet-received" : [
                    {
                        "data" : "10106269"
                    }
                    ], 
                    "packet-dropped" : [
                    {
                        "data" : "7024184"
                    }                   
                    ], 
                    "packet-arrival-rate" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "policer-violation-count" : [
                    {
                        "data" : "129"
                    }
                    ], 
                    "protocol-states" : [
                    {
                        "data" : "ok"
                    }
                    ]
                }
                ]
            }
            ]
        }, 
        {
            "ddos-protocol" : [
            {
                "ddos-system-statistics" : [
                {
                    "attributes" : {"junos:style" : "brief"}, 
                    "group-name" : [
                    {
                        "data" : "dns"
                    }
                    ], 
                    "packet-type" : [
                    {
                        "data" : "aggregate"
                    }
                    ], 
                    "packet-received" : [
                    {
                        "data" : "56"
                    }
                    ], 
                    "packet-dropped" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "packet-arrival-rate" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "policer-violation-count" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "protocol-states" : [
                    {
                        "data" : "ok"
                    }
                    ]
                }
                ]
            }
            ]
        }, 
        {
            "ddos-protocol" : [
            {
                "ddos-system-statistics" : [
                {
                    "attributes" : {"junos:style" : "brief"}, 
                    "group-name" : [
                    {
                        "data" : "ndpv6"
                    }
                    ], 
                    "packet-type" : [
                    {
                        "data" : "aggregate"
                    }
                    ], 
                    "packet-received" : [
                    {
                        "data" : "185012"
                    }
                    ], 
                    "packet-dropped" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "packet-arrival-rate" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "policer-violation-count" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "protocol-states" : [
                    {
                        "data" : "ok"
                    }
                    ]
                }
                ]
            }
            ]
        }, 
        {
            "ddos-protocol" : [
            {
                "ddos-system-statistics" : [
                {
                    "attributes" : {"junos:style" : "brief"}, 
                    "group-name" : [
                    {
                        "data" : "uncls"
                    }
                    ], 
                    "packet-type" : [
                    {
                        "data" : "aggregate"
                    }
                    ],                  
                    "packet-received" : [
                    {
                        "data" : "61437930"
                    }
                    ], 
                    "packet-dropped" : [
                    {
                        "data" : "109264"
                    }
                    ], 
                    "packet-arrival-rate" : [
                    {
                        "data" : "1"
                    }
                    ], 
                    "policer-violation-count" : [
                    {
                        "data" : "30"
                    }
                    ], 
                    "protocol-states" : [
                    {
                        "data" : "ok"
                    }
                    ]
                }
                ]
            }
            ]
        }, 
        {
            "ddos-protocol" : [
            {
                "ddos-system-statistics" : [
                {
                    "attributes" : {"junos:style" : "brief"}, 
                    "group-name" : [
                    {
                        "data" : "resolve"
                    }
                    ], 
                    "packet-type" : [
                    {                   
                        "data" : "aggregate"
                    }
                    ], 
                    "packet-received" : [
                    {
                        "data" : "108841572"
                    }
                    ], 
                    "packet-dropped" : [
                    {
                        "data" : "1602"
                    }
                    ], 
                    "packet-arrival-rate" : [
                    {
                        "data" : "9"
                    }
                    ], 
                    "policer-violation-count" : [
                    {
                        "data" : "9"
                    }
                    ], 
                    "protocol-states" : [
                    {
                        "data" : "ok"
                    }
                    ]
                }
                ]
            }
            ]
        }, 
        {
            "ddos-protocol" : [
            {
                "ddos-system-statistics" : [
                {
                    "attributes" : {"junos:style" : "brief"}, 
                    "group-name" : [
                    {
                        "data" : "ospf-hello"
                    }                   
                    ], 
                    "packet-type" : [
                    {
                        "data" : "aggregate"
                    }
                    ], 
                    "packet-received" : [
                    {
                        "data" : "236185"
                    }
                    ], 
                    "packet-dropped" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "packet-arrival-rate" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "policer-violation-count" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "protocol-states" : [
                    {
                        "data" : "ok"
                    }
                    ]
                }
                ]
            }
            ]
        }, 
        {
            "ddos-protocol" : [
            {
                "ddos-system-statistics" : [
                {
                    "attributes" : {"junos:style" : "brief"}, 
                    "group-name" : [    
                    {
                        "data" : "dhcpv4v6"
                    }
                    ], 
                    "packet-type" : [
                    {
                        "data" : "aggregate"
                    }
                    ], 
                    "packet-received" : [
                    {
                        "data" : "46801192"
                    }
                    ], 
                    "packet-dropped" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "packet-arrival-rate" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "policer-violation-count" : [
                    {
                        "data" : "0"
                    }
                    ], 
                    "protocol-states" : [
                    {
                        "data" : "ok"
                    }
                    ]
                }
                ]
            }
            ]
        }
        ]
    }
    ]
}                                       

{master:0}

Features list?

Hi all,

I know there's the plain English example list of "features:" in the README, but can someone point me to how I translate that to the actual values I need to configure in the junos_exporter config yml file?

Thanks!

How to specify jump-host

How we can use this exporter when we can only access our infrastructure through a jump-host. ?
We can specify that into ~/.ssh/config but how to say that to the exporter ?

Interface bytes counter >integer

Hello,

I experience an issue with interface statistics where the number can't be parsed into an integer.

Log entries:

time="2019-01-19T00:22:51Z" level=error msg="interfaces: strconv.ParseInt: parsing \"18446744071853176047\": value out of range" source="junos_collector.go:145"

This high in- and output byes counter seems to be a bug in JunOS (em interfaces flap and have this high number of bytes)

The script currently seem to stop collecting data for all other interfaces when it runs into this error.

Is it possible to catch this error and skip this particular interface?

Thanks
-Chris

clustered srx "firewall" flag not showing metrics

Hi,
I just added a clustered srx and I see metrics like interfaces,alarm,bgp,ldp, routes but I don't find any firewall metrics.
I do see the collector enabled as shown below in metrics.

junos_collect_duration_seconds{collector="Firewall",target="xyx-fw-1"} 0.311696644

The logs don't show any errors.

Feb 18 05:07:54 pd-prometheus01 junos_exporter[29569]: 2020/02/17 21:07:54 Output for xyx-fw-1: <rpc-reply xmlns:junos="http://xml.juniper.net/junos/15.1X49/junos">
Feb 18 05:07:54 pd-prometheus01 junos_exporter[29569]:     <firewall-information xmlns="http://xml.juniper.net/junos/15.1X49/junos-filter">
Feb 18 05:07:54 pd-prometheus01 junos_exporter[29569]:         <filter-information>
Feb 18 05:07:54 pd-prometheus01 junos_exporter[29569]:             <filter-name>__default_bpdu_filter__</filter-name>
Feb 18 05:07:54 pd-prometheus01 junos_exporter[29569]:         </filter-information>
Feb 18 05:07:54 pd-prometheus01 junos_exporter[29569]:     </firewall-information>
Feb 18 05:07:54 pd-prometheus01 junos_exporter[29569]:     <cli>
Feb 18 05:07:54 pd-prometheus01 junos_exporter[29569]:         <banner>{primary:node0}</banner>
Feb 18 05:07:54 pd-prometheus01 junos_exporter[29569]:     </cli>

Here is my config.yml

devices:
  - host: xyx-fw-1
    username: test
    password: *****
features:
  bgp: true
  ospf: false
  isis: false
  nat: false
  environment: true
  routes: true
  routing_engine: true
  interface_diagnostic: true
  interface_queue: false
  interfaces: false
  l2circuit: false
  storage: false
  fpc: true
  firewall: true

Kubernetes prometheus-operator templates

I have written a kubernetes deployment with Secrets, ConfigMaps, Service and ServiceMonitor for junos-exporter.
Should I add them as a PR here?
Or do you want it as a helm chart?

Multi Routing Engine Support

I have come across a bug affecting the collection of certain metrics against targets that have multiple routing engines.

Metrics Affected:

  • Storage
    • Completely incompatible with multiple routing engines. No output. (from what I have seen- may require some more testing)
  • Routing Engine Statistics
    • This works on 15.1, however, on a target running 12.3X4 these results return as 0 for all metrics.

It's worth noting my testing is limited due to the number of devices configured differently I have to hand to work on.

I believe both of these issues to be caused by the difference in XML output - as you'll see some output's depending on the setup/version of the device are nested (and do not follow the expected schema set out in the code).

Routing Engine Statistics Metrics

show chassis routing-engine output on a SRX running 12.3X48:

<rpc-reply xmlns:junos="http://xml.juniper.net/junos/12.3X48/junos">
    <multi-routing-engine-results>
        
        <multi-routing-engine-item>
            
            <re-name>node0</re-name>
            
            <route-engine-information xmlns="http://xml.juniper.net/junos/12.3X48/junos-chassis">

show chassis routing-engine output on a EX4200-24F running 15.1R5:

<rpc-reply xmlns:junos="http://xml.juniper.net/junos/15.1R5/junos">
    <route-engine-information xmlns="http://xml.juniper.net/junos/15.1R5/junos-chassis">

Example Output by Junos Exporter

# TYPE junos_route_engine_memory_utilization gauge
junos_route_engine_memory_utilization{target="device2"} 70
junos_route_engine_memory_utilization{target="device1"} 0

Storage Metrics

show system storage output on a SRX running 12.3X48:

    <multi-routing-engine-results>
        
        <multi-routing-engine-item>
            
            <re-name>node0</re-name>
            
            <system-storage-information junos:style="brief">

show system storage output on a EX4200-24F running 15.1R5:

    <multi-routing-engine-results>
        
        <multi-routing-engine-item>
            
            <re-name>fpc0</re-name>
            
            <system-storage-information junos:style="brief">

Unfortunately, I do not have any Junos devices that are not in a virtual chassis.

If you'd like complete output let me know.

Interface speed missing docker

So i run junos_exporter in docker, but i do not get the interface speed from my Juniper EX2300 switches.

Am i missing something ?

My config.yml

targets:
 -

features:
  environment: true
  bgp: false
  ospf: false
  isis: false
  nat: false
  l2circuit: true
  ldp: true
  routes: true
  routing_engine: true
  interfaces: true
  interface_diagnostic: true
  storage: true

Feature request: disable ipv6

Would it be possible to make ipv6 data as an option?
It is not widely used and there is a lot of it which is just wasted space.
thanks

Duplicate Alarms in Red and Yellow counts

It looks like the alarm count may be counting some alarms twice.
When I do a show chassis alarm and a show system alarm I get the following:
Screen Shot 2020-02-25 at 3 13 04 PM

However, it shows there are 5 alarms when I pull the prometheus data.
I think it should only be showing 3 alarms.
Can the list of alarms be de-duped when you count them up?

SSH user ?

What user does it use for logging into the JunOS ?
I see no option defining this, so i must assume current user ? Or root ?

My login to the JunOS device fails, manual login works with the authorized key.

A option to define the user would be great.

vcp from other chassis

I'm trying to graph vcp bandwidth between chassis..
I only get access to the first one..

Is there way to specify members ?
Maybe add to the code a discovery loop and fetching every members ?
> request session member <n>

Maybe it would be a better idea to add a specific collector for vcp stats ?

config file

would be nice to have a config file to define the scrape targets...

ssh user in config file

Is it possible to add the ssh user in the config file?

i tried

ssh:
  user: bla
user: bla
ssh.user: bla

All are ignored.

add linecard metrics (state, uptime, cpu/mem utilization)

It would be very nice to have metrics about individual FPCs. For instance there have been some PRs where memory leaks fill the fpcs memory, causing unexpected actions like sudden reboot, or crashes.

Metrics could be collected through:

  • State, CPU Utilization, Memory Utilization
show chassis fpc
                     Temp  CPU Utilization (%)   CPU Utilization (%)  Memory    Utilization (%)
Slot State            (C)  Total  Interrupt      1min   5min   15min  DRAM (MB) Heap     Buffer
  0  Online            37     23          5       27     25     25    2048       32         33
  1  Online            37     18          5       18     19     19    3584       19         35
  2  Online            36     15          0       16     15     15    2048       32         21
  • Uptime
show chassis fpc detail
Slot 0 information:
  State                               Online
  Temperature                      37 degrees C / 98 degrees F
  Total CPU DRAM                 2048 MB
  Total RLDRAM                   1036 MB
  Total DDR DRAM                 6656 MB
  Start time                          2019-02-19 23:01:59 UTC
  Uptime                              104 days, 11 hours, 8 minutes, 4 seconds
  Max power consumption            485 Watts
Slot 1 information:
  State                               Online
  Temperature                      37 degrees C / 98 degrees F
  Total CPU DRAM                 3584 MB
  Total RLDRAM                    259 MB
  Total DDR DRAM                 20352 MB
  Start time                          2019-02-19 23:02:10 UTC
  Uptime                              104 days, 11 hours, 7 minutes, 53 seconds
  Max MPC base power consumption   376 Watts
  Max MIC0 power consumption        30 Watts
  Max MIC1 power consumption        40 Watts
  Max MPC total power consumption  446 Watts
Slot 2 information:
  State                               Online
  Temperature                      36 degrees C / 96 degrees F
  Total CPU DRAM                 2048 MB
  Total RLDRAM                   1036 MB
  Total DDR DRAM                 6656 MB
  Start time                          2019-02-19 23:02:11 UTC
  Uptime                              104 days, 11 hours, 7 minutes, 52 seconds
  Max power consumption            485 Watts

add metrics for pem (power entry module)

It would be very helpful to collect pem statistics such as power consumtion, fan speed,

show chassis environment pem

localre:

FPC 0 PEM 0 status:
State Online
Airflow Back to Front
Temp Sensor 0 OK 28 degrees C / 82 degrees F
Temp Sensor 1 OK 33 degrees C / 91 degrees F
Temp Sensor 2 OK 33 degrees C / 91 degrees F
Fan 0 23680 RPM
DC Output Voltage(V) Current(A) Power(W) Load(%)
12 13 156 24
FPC 0 PEM 1 status:
State Online
Airflow Back to Front
Temp Sensor 0 OK 28 degrees C / 82 degrees F
Temp Sensor 1 OK 33 degrees C / 91 degrees F
Temp Sensor 2 OK 32 degrees C / 89 degrees F
Fan 0 23776 RPM
DC Output Voltage(V) Current(A) Power(W) Load(%)
12 14 168 25

[v.7] Re-enable SSH?

Hi,

I have a tiny EX2200 that struggles with the SSH polling method. Takes about 25 seconds for a full polling cycle. Is there any way I could try the SNMP method just for testing?

Thanks!

Using the same junos_exporter for more targets

Hi, have an environment with about 80 Juniper devices. I'm able to run the exporter if I set up it to retrieve metrics from 1 target but I'm facing issue in running the exporter with 2 or more targets. The problem is the password that is different for every device, so my question is: is there a way to configure the config.yml file in order to have the list of targets and the pw related of each target?
Something like this:

targets:
  - 10.10.10.1
     password: "1Password1"
  - 10.10.10.2
     password: "2Password2"
  - 10.10.10.3
     password: "3Password3"

features:
  bgp: true
  ospf: true
  isis: true
  nat: true
  environment: false
  routes: true
  routing_engine: true
  interface_diagnostic: false
  interfaces: true
  l2circuit: true
  storage: true
  fpc: true

Please let me know if you have a solution or an alternative to solve my problem.
Thanks in advance!

Specifying targets in prometheus and credentials in config file

Hi,
I'd like to specify targets in prometheus(which is there) along with credentials in config file.
Seems like if configure the exporter with -config.ignore-targets, it does not use the credentials from the file any more and gives below error. I don't want to specify credentials using while running the binary and but keep it in a file and lock it down.

Error

Error while trying to reach another device specified in targets in prometheus
could not initialize config for device junos-test-1: no valid authentication method available.

Let me know if this is not available or if there is something i'm doing wrong. At some point, i'd like to use file discovery and add remove junos devices since we have about 40 of them.
Thanks.

Version: 0.9.5 of the exporter

this is how its running. im using a the binary.
/path/junos_exporter -config.file=/path/junos_exporter_config.yml -config.ignore-targets

Config File - junos_exporter_config.yml

global:
  username: junos
  password: junos

features:
  bgp: true
  ospf: false
  isis: false
  nat: false
  ldp: false
  l2circuit: false
  environment: true
  routes: true
  routing_engine: true
  interface_diagnostic: true
  fpc: true

Prometheus config

  - job_name: junos_exporter
    scrape_interval: 60s
    scrape_timeout: 30s
    static_configs:
      - targets:
        - junos-test-1
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 127.0.0.1:9326

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.