This is a Prometheus Exporter for extracting metrics from a Arista Switch using the Arista's eAPI and the Python Client for eAPI pyeapi.
This code is based on a forked version of arista-eapi-exporter from SAP CCloud.
The hostname of the switch has to be passed as target parameter in the http call.
if you are logged in to the POD running the exporter you can call
curl http://localhost:9200/arista?target=myswitch.local&modules=tcam,port
The optional parameter modules
can have these values at the moment:
memory
memory statisticstcam
information about tcam usageport
information about ports - input/output packets, bytes, errors, multicasts, etcsfp
information about SFP modules - transmit/receive power, alerts over thresholds, etcbgp
information about BGP peers, how many routes they advertise, their statuspower
information about PSU (power supply units) - status, model, capacity, fans, power, temperatureall
all of the above. This is the default.
The exporter was written for Python 3.6 or newer. To install all modules needed you have to run the following command:
pip3 install -r requirements.txt
-
The listen_port is providing the port on which the exporter is waiting to receive calls.
-
The listen_addr - address on which to listen. Defaults to 0.0.0.0
-
The credentials for login to the switches can either be added to the config.yaml file or passed via environment variables
ARISTA_USERNAME
andARISTA_PASSWORD
. The environment overwrites the settings in the config file -
The loglevel can be specified in the config file. If omitted the default level is
INFO
-
The timeout parameter specifies the amount of time to wait for an answer from the switch.
-
The disable_certificate_validation: true needs to be currently set. See the Caveats section for more details.
listen_port: 9200
username: <your username>
password: <your password>
loglevel: <INFO|DEBUG>
timeout: 20
disable_certificate_validation: true
- job_name: 'arista'
static_configs:
- targets:
- switch1.example.com
- switch2.example.com
metrics_path: /arista
params:
modules: [tcam,port]
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: arista-exporter.example.com:9200
This configuration uses relabeling to get targets
as parameters for exporter running at arista-exporter.example.com:9200. Thanks to this, you can use any service discovery mechanism you want - just exchange static_configs with your desired SD system and adjust relabeling accordingly.
Look in the examples/ folder.
Currently, certificate verification for HTTPS connections doesn't work. We filed an issue with the upstream client library here: arista-eosplus/pyeapi#174
Should it be resolved, we will fix the exporter so it works with certificate validation enabled. For now, you have to explicitly disable certificate validation, because we want the default behavior to be the safe option - validate. After all, you are transferring login credentials to your network infrastructure, and you want to do that over an encrypted and verified channel.
The arista_sfp_alarms
metric is not conforming to prometheus standards. The reason for that is that there are multiple alarms (high/low) that you need to compare to the current values in different ways (below/over). The exporter does this all for you, so you only get these metrics if there is an alarm firing.
You can therefore alert directly on arista_sfp_alarms
and you get the current sensor value in the alert as well as all the labels.