A prometheus exporter that scrapes remote data or local files and converts them to prometheus metrics. It is similar to json_exporter, but adds the possibility to transform the data before metrics are extracted, and is not limited to only support JSON data.
A docker image is built as part of this repository. Find the published versions here
cargo test
cargo run -- --config examples/config.yaml
Now you can use curl
to get the metrics:
curl http://localhost:9090/metrics
data-exporter is configured via a configuration file in YAML format (see this example), and via command-line flags.
Run the help command to get all available flags
data-exporter --help
In the configuration file all scraped metrics are configured.
metrics: [<metric_config>]
# name of the metric when scraped
name: <string>
# metric help string when scraped
help: <string>
# targets to scrape data from
targets: [<target_config>]
# pipeline stages to transform the data before parsing it
pipeline_stages: [<pipeline_stage_config>]
# parser for parsing metrics from data
parser: <parser_config>
# set a constant value for the metric, it is required to set either this or `value` in `parser_config`
value: <float64>
type: file
# path to local file
path: <string>
type: http
# url to scrape
url: <string>
type: jq
# jq query to execute on data
query: <string>
type: regex
# regex pattern
pattern: <regex>
# replacement string
replace: <string>
type: json
# fields to extract as labels
labels: [<string>]
# field to extract as value, it is required to set either this or `value` in `metric_config`
value: <string>
type: regex
# regex pattern with named captures
pattern: <regex>
# named captures to extract as labels
labels: [<string>]
# named capture to extract as value, it is required to set either this or `value` in `metric_config`
value: <string>