-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.yaml.example
247 lines (227 loc) · 6.09 KB
/
config.yaml.example
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
###########
# Sources #
###########
# The awair source reads data from an Awair Element monitor. You need
# to sign up at https://developer.getawair.com/console/access-token to
# get an access token.
#
# Once you have the access token, you can get the ID(s) and type(s) of
# your device(s) using curl:
#
# curl --location --request GET \
# 'https://developer-apis.awair.is/v1/users/self/devices' \
# --header 'Authorization: Bearer XXX'
#
awair:
plugin: source.awair
flow: -> *
schedule: 0/5 * * * *
access_token: XXX
device_id: 12345
device_type: awair-element
prefix: hub.awair
# The crypto source fetches the price of cryptocurrencies from the
# cryptocompare.com website periodically.
crypto:
plugin: source.crypto
flow: -> *
schedule: 1/30 * * * *
coins:
- BTC
- ETH
currency: USD
prefix: hub.crypto
# The MQTT source subcribes to a topic (or topic wildcard ) and
# emits events every time a message is received.
#
# Since it's event based, it should have no schedule.
mqtt_source:
plugin: source.mqtt
flow: -> *
topics:
- foo/+
- bar/#
- baz
host: localhost
port: 1883
username: username
password: password
prefix: hub.mqtt
# Generate random numbers between 0 and 1. This is used most for
# testing.
#
# You can specify how many events are generated every time the
# plugin runs.
rand:
plugin: source.random
flow: -> *
schedule: 2/5 * * * *
events: 10
prefix: hub.random
# Measure internet speed.
#
# This source will measure internet speed (download, upload,
# latency and more) by using the speedtest.net website.
speedtest:
plugin: source.speedtest
flow: -> *
schedule: 3/15 * * * *
prefix: hub.speedtest
# Read data from database.
#
# The SQLAlchemy source periodically reads data from a database. It
# uses a query that MUST return at least two columns: `name` and `value`.
# Optionally, it an also return a column called `timestamp`, which will
# be used as the timestamp of the generated event. Otherwise, the current
# timestamp will be used.
sqla:
plugin: source.sqla
flow: -> *
schedule: 4/20 * * * *
# See https://docs.sqlalchemy.org/en/14/core/engines.html
uri: postgres://user:password@host:port/db
# Set this to true if using a sync engine
sync: false
# The query MUST return the columns `name` and `value`, and optionally
# `timestamp`.
sql: >
SELECT
dim1 AS name,
COUNT(*) AS value
FROM TABLE
WHERE cond
GROUP BY 1
prefix: hub.sqla
# Fetch stock price form Yahoo! Finance.
#
# This source will periodically retrieve the price of
# stocks from Yahoo! Finance.
stocks:
plugin: source.stock
flow: -> *
schedule: 5/10 * * * *
symbols:
- FB
- LYFT
prefix: hub.stock
# The weather source fetches weather forecast data for a given location
# (name of ZIP code). You need to sign up at https://www.weatherapi.com/my/
# to get an access token.
weather:
plugin: source.weatherapi
flow: -> *
schedule: 0 12 * * *
access_token: XXX
location: London
prefix: hub.weatherapi
# Whistle is a pet tracker. You need to get a username and password from
# https://app.whistle.com/.
#
# The source will emit events with information about the device (battery
# level, last check-in, tracking status, battery status), as well as its
# location. The location is emitted as a latitude, longitude pair, as well
# as a geohash.
whistle:
plugin: source.whistle
flow: -> *
schedule: 6/15 * * * *
username: [email protected]
password: XXX
prefix: hub.whistle
# Send a "sunrise" or "sunset" event
sun:
plugin: source.sun
flow: -> *
latitude: 38.3
longitude: -123.0
###########
# Filters #
###########
# The format filter replaces the name or value of an incoming event
# by applying string formatting to it.
format:
plugin: filter.format
flow: "* -> *"
# Wraps the original name in a warning message
name: "Warning ({name})"
# Reduce precision of value to 2 decimalas
value: "{value:.2f}"
# Evaluate values, eg, casting from string to float
eval_value: true
# The JSON Path filter will drop events that don't match a JSON Path
# expression. It's useful for routing events that match a particular
# criteria to a specific sink, eg, for notifications.
jpath:
plugin: filter.jsonpath
flow: random -> alert
# Pass only events from random with value > 0.5
filter: '$.events[?(@.name=="hub.random" and @.value>0.5)]'
# The Jinja2 filter is probably the best way to filter and format
# events
jinja:
plugin: filter.jinja
flow: "* -> *"
# Drop any events where the value <= 10. If value > 10, return a
# new event with "Greater than 10" as the new value.
template: >
{% if event['value'] > 10 %}
Greater than 10
{% endif %}
#########
# Sinks #
#########
# The log sink will log incoming events, with a configurable
# level.
log:
plugin: sink.log
flow: "* ->"
level = info
# The MQTT sink is used to send events to an MQTT topic.
mqtt_sink:
plugin: sink.mqtt
flow: "* ->"
topic: test/1
host: localhost
port: 1883
username: username
password: password
# Quality of Service (QoS) level:
# 0: At most once
# 1: At least once
# 2: Exactly once
qos: 1
# The Pushover sink uses the pushover.net mobile application
# to send notifications to a smartphone.
#
# You need to sign up for their API (https://pushover.net/api).
pushover:
plugin: sink.pushover
flow: "* ->"
# Throttle will ensure that notifications are sent at most once
# in a given time window. It can be used with any sink.
throttle: 30 minutes
app_token: XXX
user_token: YYY
# The Postgres sink can be used to write events into a database.
postgres:
plugin: sink.db.postgresql
flow: "* ->"
# Batch will store all events in a queue until for a given time,
# and then process all of them at once. Queued events are
# processed if the application is termined gracefully. This
# option can be used with any sink.
batch: 5 minutes
user: username
password: password
host: localhost
port: 5432
dbname: dbname
table: events
# Send notifications via Twilio
sms:
plugin: sink.sms
flow: "* ->"
account_sid: XXX
auth_token: YYY
from: "+15558675309"
to: "+18002738255"