-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample_settings.yml.j2
104 lines (98 loc) · 2.29 KB
/
sample_settings.yml.j2
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
{{ ansible_managed }}
# Default settings
---
General:
Interval: 60
InfluxDB:
# avoid using 'localhost' when this is deployed to be used by get_metrics.py
# running in docker container
Host: {{ influx_db_host }}
Port: 8086
Bucket: sensor
API_TOKEN: '{{ influxdb_token }}'
Org: neofob
# A node can have more than one sensors
# Example:
# http://192.168.1.2:8000/NODE_KEY&Stats/json
# {
# "API": {
# "Version": "200"
# },
# "Stats": {
# "Temp": "82.09F",
# "Humi": "38.41%",
# "Press (inHg)": "29.74"
# }
#}
# Measurement: Air
# Tags: location
# Fields: temperature, humidity, pressure
# field to to be used in influxdb ingestion
# we know that we only need to chomp 1 char for now
# (r.json()["Stats"]["Temp"][:-1]
#<begin>------cut-here-------->
Nodes:
Soil:
Host: 192.168.42.2
Port: 8080
Key: badbeef
Endpoint: "&Stats/json"
Metric: Stats
Measurement: Air
Tag:
location: Garden
Fields:
Temp1:
field: temperature
chomp: true
tags:
lot: East
Temp2:
field: temperature
chomp: true
tags:
lot: West
Temp3:
field: temperature
chomp: true
tags:
lot: South
#</end>------cut-here-------->
# TODO: Use some sort of dictionary squash keys into key1_key2: value
# Then generate the output based on that
# indent=0; preformatted text
{% filter indent(width=0) %}
Nodes:
{% for node_name, item in Nodes.item() -%}
{{ node_name }}:
Host: {{ item.Host }}
Port: {{ item.Port }}
Key: {{ item.Key }}
Endpoint: {{ item.Endpoint }}
Metric: {{ item.Metric }}
Measurement: {{ item.Measurement }}
# You can get creative here with tags
# Tags applied to all Fields; "Temp", "Humi", "Press (inHg)" for example.
Tags:
# key: value
location: {{ item.Tags.location }}
#
Fields:
# field name of sensor metrics
Temp1:
Tags:
lot: {{ item.Fields.Temp1.tags.lot }}
field: temperature
chomp: true
Temp2:
Tags:
lot: {{ item.Fields.Temp2.tags.lot }}
field: temperature
chomp: true
Temp3:
Tags:
lot: {{ item.Fields.Temp3.tags.lot }}
field: temperature
chomp: true
{% endfor %}
{% endfilter %}