forked from Svedrin/mqtt-pushgateway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.example.toml
69 lines (57 loc) · 1.93 KB
/
config.example.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Copy this file to config.toml to use it.
[exporter]
listen = "0.0.0.0"
port = 9466
# Configure your MQTT broker's address and credentials here.
[mqtt]
client_id = "mqtt_pushgw-%(hostname)s"
broker = "192.168.1.234"
port = 1883
username = "user"
password = "pass"
# List some keys we should subscribe to. Use '#' to subscribe to *everything*.
# We will ignore any messages that can't be directly parsed as floats.
subscribe = [
'sensor/#',
"otherTopic"
]
# Expire metrics after 5 Minutes. Can be overridden in the [[topic]] sections.
# Comment to disable.
expire = 300
[[topic]]
# You can configure a regular expression to match the topic name against.
# The first [[topic]] stanza that matches, decides what happens, so put
# stanzas with more specialized regexen first. I'm doing this wrong here,
# but I want to explain the most basic [[topic]] stanzas first.
#
# Match groups will be converted to Prometheus keywords.
#
# The special group '__metric__', if present, will denote the metric name and
# NOT be added as a keyword.
#
# If match is not given, or the regex does not return a __metric__ group,
# the topic name will be split at / and the last part will be used for
# the metric name.
#
match = 'sensor/(?P<sensor_name>\w+)/(?P<__metric__>\w+)'
#
# This regex will convert a topic such as this:
#
# sensor/garage/temperature
#
# into a Prometheus metric such as this one:
#
# temperature{mqtt_topic="sensor/garage/temperature",sensor_name="garage"}
#
# so then you can use the sensor_name as a filter in your PromQL queries.
[[topic]]
match = 'sensor/slow_sensor/super_slow_metric'
# You may override expire for topics that are updated more/less frequently
expire = 900
# You can specify a hardcoded metric name to avoid all surprises
metric = "just_a_metric"
[[topic]]
match = 'sensor/sucky_sensor/.*'
# If you want to ignore certain topics that are unfortunately included
# in your subscriptions, you can use:
ignore = true