-
Notifications
You must be signed in to change notification settings - Fork 9
/
scratchpad.txt
116 lines (79 loc) · 2.01 KB
/
scratchpad.txt
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
# InfluxDB Roadshow Training #
######### Setup ##########
## Step 1
docker compose up -d
######### Edge ##########
Admin Token: edge
## Step 2
influx config create \
--config-name trainingedge \
--host-url http://localhost:8086 \
--org influxroadshow \
--token edge \
--active
## Step 3
influx bucket list
## Step 4
influx auth create --write-bucket <INSERT_BUCKET_ID>
## Step 4*
influx auth list
## Step 5
Write Token:
## Step 6
topics = ["emergency_generator/#"]
[[inputs.mqtt_consumer.json_v2]]
measurement_name = "genData"
[[inputs.mqtt_consumer.json_v2.object]]
path = "@this"
disable_prepend_keys = true
tags = ["generatorID"]
## Step 7
token = “<WRITE_TOKEN>”
## Step 8
docker container restart influxdb-roadshow-training-telegraf-1
## Step 9
influx query 'from(bucket:"generators")|>range(start:-1h)'
## Step 10
influx bucket create --name downsampled -r 2d
## Step 11
influx bucket list
## Step 12
influx task create -f flux/downsample.flux
## Step 13
Name: northbound
Delete data: 30 days
## Step 14
northbound Bucket ID:
northbound Bucket Token:
## Step 15
downsampled bucket ID:
## Step 16
influx remote create --name cloud --remote-url https://us-east-1-1.aws.cloud2.influxdata.com --remote-org-id <> --remote-api-token <>
remote-ID:
## Step 17
influx replication create --local-bucket-id <> --remote-bucket-id <> --remote-id <> --name edge_to_cloud
## Step 18
influx replication list
######### CLOUD ##########
## Step 19
SELECT time, fuel, "generatorID"
FROM "genData"
WHERE time >= $__timeFrom AND time <= $__timeTo
## Step 20
SELECT
selector_last(fuel, time)['time'] AS time,
selector_last(fuel, time)['value'] AS fuel,
"generatorID",
selector_last(lat, time)['value'] AS lat,
selector_last(lon, time)['value'] AS lon
FROM "genData"
WHERE time >= $__timeFrom AND time <= $__timeTo
group by 3
## Step 21
SELECT
"generatorID",
time,
fuel
FROM "genData"
WHERE time >= $__timeFrom AND time <= $__timeTo
ORDER BY time