mock-exporter
Prometheus exporter for mocking metrics

Mock Exporter

This project can provide multiple listening ports by specifying a sample input file to provide services similar to /metrics

Usage

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$ ./mock_exporter -h
usage: mock-exporter --mock=MOCK [<flags>]


Flags:
-h, --[no-]help Show context-sensitive help (also try --help-long and
--help-man).
-p, --path="/metrics" Path under which to expose metrics.
-m, --mock=MOCK Sample prom file (.prom) that requires mocking
--web.port=10000 The starting value of the port
--web.length=50 The length of the port range (starting from the
starting value. If any port is occupied, it will be
skipped.)
--log.level=info Only log messages with the given severity or above.
One of: [debug, info, warn, error]
--log.format=logfmt Output format of log messages. One of: [logfmt, json]
--[no-]version Show application version.

Example

1
$ ./mock_exporter -m ./node-exporter.prom

Build

1
$ go build -o mock_exporter

Next

  • Support for multiple files
  • Support for multiple paths
  • Support for multiple mock types