This repository contains python scripts for generating mock data for Tendrl - Grafana Dashboards.
Inspired by carbon-random script.
First of all, you need to find the metrics you want to generate data for.
You can list all available metrics:
# ./usmqe_carbon_mock_data_generator.py -s server.example.com list
And you can filter the list of metrics:
# ./usmqe_carbon_mock_data_generator.py -s server.example.com list \ --filter 'used_capacity' # ./usmqe_carbon_mock_data_generator.py -s server.example.com list \ --filter 'utilization !inode !thin_pool'
As a filter you can use list of space separated strings which should be (or with exclamation mark not be) present in the filtered list of metric. All the words are combined with logical and.
Prepare filter which will return only the desired metrics you want to update.
Once you find the correct filter which will return the desired metrics, prepare configuration file (see the section below) and generate the mock data for the desired period of time (from 2018-07-01 till now in the following example):
# ./usmqe_carbon_mock_data_generator.py -s server.example.com generate \ --since 2018-07-01 -c example_config.yml
The configuration file is yaml file with list of dictionaries, each dictionary usually contains configuration for one metric or set of similar metrics.
See the following example and explanation below:
--- - filter: "usable_capacity" generators: - name: constant # 100GB value: 104857600 - filter: "used_capacity !volume_beta" generators: - name: linear # from 0GB value_a: 0 # to 90GB value_b: 94371840 - name: noise percent: 5
The example above will generate data for two different set of metrics, defined
by filter
:
- the first one is for all metrics containing string usable_capacity
- and the second is for metrics containing string used_capacity but not containing string volume_beta.
Parameter generators
contains list of data generators with parameters.
The generated value is combined from all the generators in the list.
The order of the generators is mandatory, because some generators use the
already generated value.
List of available generator functions:
random
: generate random number betweenmin
andmax
constant
: return (generate) constant number defined byvalue
(default: 0)random_constant
: generate random constant number betweenmin
andmax
- (the value will be the same for whole one metric)
linear
: generate linear graph betweenvalue_a
andvalue_b
triangle
: Generate triangle wave betweenvalue_a
andvalue_b
withperiod
(number in seconds).
sawtooth
: Generate sawtooth wave betweenvalue_a
andvalue_b
withperiod
(number in seconds).
sin
: Generate sinus wave betweenvalue_a
andvalue_b
withperiod
(number in seconds).
noise
: Generate random noise in range from-min
tomax
or aspercent
of already generated value.
boundaries
: Ensure, that generated value will be betweenmin
andmax
- boundaries.
abs
: Ensure, that generated value will be positive.
Distributed under the terms of the Apache License 2.0 license.