Hi,
i’m currently trying to import weather data from a FROST-Server into my prometheus instance. I’m trying to use the JSON-Exporter for that purpose. The FROST-Server has a REST-API, that returns JSON data objects.
I have the following config.yml
for my json-exporter:
---
modules:
default:
metrics:
- name: frost_observations
type: object
valuetype:
path: '{.value[*]}'
epochTimestamp: '{.value[@.resultTime]}'
help: frost server observations
honor_labels: false
labels:
datastream: '{ .Datastream.name }'
values:
result: '{.result}'
http_client_config:
basic_auth:
username: ****
password_file: /config/frost-password.txt
this is my prometheus.yml
global:
scrape_interval: 1m # By default, scrape targets every 15 seconds.
scrape_configs:
- job_name: 'frost'
scrape_interval: 15s
static_configs:
- targets:
- "https://url-to-my-server/FROST-Server/v1.1/Observations?$expand=Datastream"
metrics_path: /probe
scheme: http
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
## Location of the json exporter's real <hostname>:<port>
replacement: json-exporter:7979 # equivalent to "localhost:7979"
When running the json-exporter i’m getting a lot of errors like this
* collected metric "frost_observations_result" { label:<name:"datastream" value:"" > untyped:<value:11 > } was collected before with the same name and label values
I can solve this issue, by adding the label id: { .id }
. But this will create a timeseries for every record of the FROST-Server, which IMHO makes no sense. I want to have a time series for each Datastream.name
.
I don’t understand, why i’m getting this error message, and how a possible fix could be.
The returned data (from this url https://url-to-my-server/FROST-Server/v1.1/Observations?$expand=Datastream) represents multiple timeseries (Observations) from different sensors. The parameter $expand=Datastream
returns the linked Datastream. The name of the Datastream is somethink like this:
Sensor-1 temperature
Sensor-1 humidity
Sensor-2 temperature
Sensor-2 humidity
which is why i want to use it as a label, to create a timeseries for each sensor-property combination.
It seems, that i still lack some basic understanding of what a metric is. Does a metric represent a timeseries, or a single value?
Can anyone help me?