Skip to content

vinted/sonic-exporter

Repository files navigation

sonic-exporter

Prometheus exporter for SONiC NOS.

Currently supported collectors:

Usage

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

Configuration

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

License

Stars

Watchers

Forks