Skip to content

About

sonic-exporter is prometheus exporter for network switches running sonic NOS.

Topics

Resources

Stars

10 stars

Watchers

9 watching

Forks

Repository files navigation

sonic-exporter

Prometheus exporter for SONiC NOS.

Currently supported collectors, all enabled by default:

Collector Flag Description
Interface --collector.interface Metrics about interface operation and performance.
HW --collector.hw Metrics about PSU and Fan operation.
CRM --collector.crm Critical Resource Monitoring metrics.
Queue --collector.queue Metrics about queues.

Usage

  1. Run binary
$ ./sonic-exporter
  1. You can verify that exporter is running by cURLing the /metrics endpoint.
$ curl localhost:9101/metrics

Configuration

Collectors

Every collector is enabled by default. To disable one, pass its flag with the --no- prefix:

$ ./sonic-exporter --no-collector.queue --no-collector.crm

Run ./sonic-exporter --help for the full list of flags.

Environment variables

  • REDIS_ADDRESS - redis connection string, if using unix socket set REDIS_NETWORK to unix. Default: localhost:6379.
  • REDIS_PASSWORD - password used when connecting to redis.
  • REDIS_NETWORK - redis network type, either tcp or unix. Default: tcp.

Development

  1. Development environment is based on docker-compose. To start it run:
$ docker-compose up --build -d
  1. To verify that development environment is ready try cURLing the /metrics endpoint, you should see exported metrics.:
$ curl localhost:9101/metrics
  1. After making code changes rebuild docker container:
$ docker-compose down
$ docker-compose up --build -d

In case you need to add additional keys to redis database don't forget to run SAVE in redis after doing so:

$ redis-cli
$ 127.0.0.1:6379> SAVE

Test

Currently, tests are using mockredis database which is populated from fixture files. To run tests manually simply execute:

$ go test -v ./... 

About

sonic-exporter is prometheus exporter for network switches running sonic NOS.

Topics

Resources

Stars

10 stars

Watchers

9 watching

Forks

Releases

Used by

Contributors

Languages