A configurable prometheus metrics server simulator. It can be configured to generate different number of metrics with different labels. An example is file example/config.yaml
. In example/openshift.yaml
it demos how to generate configmap for it..
-
It can be used as metrics endpoint/gateway of workload by setting metric values via http API
-
It can be used to stress Prometheus by generating any number of metrics
-
It can be helpful for applications Grafana dashboard develop by creating mock metrics
- Install Openshift and IBM Bedrock Monitoring Service
- Optionally you can edit the configmap defined in
example/openshift.yaml
file to change generated metrics. oc create -f example/openshift.yaml
- Open
<CP console>/prometheus
to check the existence of metrics
counters:
- prefix: mock_metric_counter
number: 3
labels:
- name: app
valueset:
- "prometheus-mock-metrics-server"
- name: client_addr
valueset:
- "client1"
- "client2"
- "client3"
- prefix: mock_metric_request_total
labels:
- name: app
valueset:
- "prometheus-mock-metrics-server"
valuemode: http
gauges:
- prefix: mock_metric_gauges
number: 4
range:
upper: 1000
lower: 2
labels:
- name: app
valueset:
- "prometheus-mock-metrics-server"
- name: client_addr
valueset:
- "client1"
- "client2"
- "client3"
In the default configuration yaml above, you can see,
- You can configure Counter metrics and Gauge metrics
prefix
is metric name prefix. Whennumber
is 1 it is exactly metric name. Whennumber
is greater than 1 metric names will be<prefix>-index
.index
is [0,number
)- label.name is the label name. label.valueset is the label value set. It will select randomly from them as label value.
number
is exact metric series number. But series are not fixed as label values are selected randomly.- Guage metrics' value will change randomly in between upper value and lower value when valuemode is auto.
valuemode
can behttp
orauto
. Default value isauto
.http
Metric value will be changed bycurl -XPUT http://localhost:8080/metrics/value -d "$data" -H "Content-Type: application/json"
. An example of payload is inexample/setvalue.json
file. Its value is real value for guage metric and increment for Counter value.auto
Metric value will change randomly and automatically.