Intial Commit

This commit is contained in:
valki
2020-10-17 18:42:50 +02:00
commit 664c6d8ca3
5892 changed files with 759183 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
# Test Flows README
To test this node, we use influxdb running in a docker container. Currently testing with influxdb 1.6.3
Set up influxdb using docker. See documentation at https://hub.docker.com/_/influxdb/
## Generating influxdb configuration
We have a configuration file already set up for use with a self signed cert. To generate a new, fresh config file locally:
docker run --rm influxdb:1.8 influxd config > influxdb.conf
## Set up self signed certificate
From the [influxdb admim documentation](https://docs.influxdata.com/influxdb/v1.6/administration/https_setup/) you can set up
self signed SSL cert as follows:
sudo openssl req -x509 -nodes -newkey rsa:2048 -keyout ./keys/influxdb-selfsigned.key -out ./keys/influxdb-selfsigned.crt
Answer the questions as you like.
## Running influxdb for tests
To run influxdb using the config file in the current directory:
docker run --name=influxdb -p 8086:8086 \
-v $PWD/influxdb.conf:/etc/influxdb/influxdb.conf:ro \
-v $PWD/ssl:/etc/ssl \
influxdb:1.8 -config /etc/influxdb/influxdb.conf
To run the influxdb CLI against this container using a self-signed cert:
docker run --rm --link=influxdb -it influxdb influx -ssl -unsafeSsl -host influxdb
You can then execute CLI commands to create databases, make queries, etc..
First, create a `test database to use by the test flows.
create database test
Then import the test flows into Node-RED and ensure they work.

View File

@@ -0,0 +1,152 @@
reporting-disabled = false
bind-address = "127.0.0.1:8088"
[meta]
dir = "/var/lib/influxdb/meta"
retention-autocreate = true
logging-enabled = true
[data]
dir = "/var/lib/influxdb/data"
index-version = "inmem"
wal-dir = "/var/lib/influxdb/wal"
wal-fsync-delay = "0s"
query-log-enabled = true
cache-max-memory-size = 1073741824
cache-snapshot-memory-size = 26214400
cache-snapshot-write-cold-duration = "10m0s"
compact-full-write-cold-duration = "4h0m0s"
max-series-per-database = 1000000
max-values-per-tag = 100000
max-concurrent-compactions = 0
max-index-log-file-size = 1048576
trace-logging-enabled = false
tsm-use-madv-willneed = false
[coordinator]
write-timeout = "10s"
max-concurrent-queries = 0
query-timeout = "0s"
log-queries-after = "0s"
max-select-point = 0
max-select-series = 0
max-select-buckets = 0
[retention]
enabled = true
check-interval = "30m0s"
[shard-precreation]
enabled = true
check-interval = "10m0s"
advance-period = "30m0s"
[monitor]
store-enabled = true
store-database = "_internal"
store-interval = "10s"
[subscriber]
enabled = true
http-timeout = "30s"
insecure-skip-verify = false
ca-certs = ""
write-concurrency = 40
write-buffer-size = 1000
[http]
enabled = true
bind-address = ":8086"
auth-enabled = false
log-enabled = true
suppress-write-log = false
write-tracing = false
pprof-enabled = true
debug-pprof-enabled = false
https-enabled = true
https-certificate = "/etc/ssl/influxdb-selfsigned.crt"
https-private-key = "/etc/ssl/influxdb-selfsigned.key"
max-row-limit = 0
max-connection-limit = 0
shared-secret = ""
realm = "InfluxDB"
unix-socket-enabled = false
unix-socket-permissions = "0777"
bind-socket = "/var/run/influxdb.sock"
max-body-size = 25000000
access-log-path = ""
max-concurrent-write-limit = 0
max-enqueued-write-limit = 0
enqueued-write-timeout = 30000000000
[logging]
format = "auto"
level = "info"
suppress-logo = false
[ifql]
enabled = false
log-enabled = true
bind-address = ":8082"
[[graphite]]
enabled = false
bind-address = ":2003"
database = "graphite"
retention-policy = ""
protocol = "tcp"
batch-size = 5000
batch-pending = 10
batch-timeout = "1s"
consistency-level = "one"
separator = "."
udp-read-buffer = 0
[[collectd]]
enabled = false
bind-address = ":25826"
database = "collectd"
retention-policy = ""
batch-size = 5000
batch-pending = 10
batch-timeout = "10s"
read-buffer = 0
typesdb = "/usr/share/collectd/types.db"
security-level = "none"
auth-file = "/etc/collectd/auth_file"
parse-multivalue-plugin = "split"
[[opentsdb]]
enabled = false
bind-address = ":4242"
database = "opentsdb"
retention-policy = ""
consistency-level = "one"
tls-enabled = false
certificate = "/etc/ssl/influxdb.pem"
batch-size = 1000
batch-pending = 5
batch-timeout = "1s"
log-point-errors = true
[[udp]]
enabled = false
bind-address = ":8089"
database = "udp"
retention-policy = ""
batch-size = 5000
batch-pending = 10
read-buffer = 0
batch-timeout = "1s"
precision = ""
[continuous_queries]
log-enabled = true
enabled = true
query-stats-enabled = false
run-interval = "1s"
[tls]
min-version = ""
max-version = ""

View File

@@ -0,0 +1,19 @@
-----BEGIN CERTIFICATE-----
MIIDBDCCAewCCQCDcrNep3/xPDANBgkqhkiG9w0BAQsFADBEMQswCQYDVQQGEwJD
QTELMAkGA1UECAwCQkMxEjAQBgNVBAcMCVZhbmNvdXZlcjEUMBIGA1UECgwLU2Vu
c2VUZWNuaWMwHhcNMTgwOTI5MjMyMDIwWhcNMTgxMDI5MjMyMDIwWjBEMQswCQYD
VQQGEwJDQTELMAkGA1UECAwCQkMxEjAQBgNVBAcMCVZhbmNvdXZlcjEUMBIGA1UE
CgwLU2Vuc2VUZWNuaWMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC2
45td3PIAhNuzoPFKIhvxoWAAmLV4U1S9d2bby51J1/XfcHPLAQB7H8jRQyBV5z1b
APhTWZKxrM9tseRbBrABzN9VlS+FfzQRW/RyOKUCa5clepgHoeP0I8RIX4cMAA4c
63RxobqIdw6WgSoUSY8Z/t+DNhqJkWyK2UaMyTmS9k9L/kxVXTSi+5QeaEW7wAW+
aUHvsBiNqb1RzPKDNYfwvlrbYvUyC2ymI684yN0l7tq7XOgMDbyLbVE1+9k/L+9a
QgsqM3462q13GyOZpURvsNYZhIT+BeArB17kDlYQvn0+/nFKGy6jGcLUawfg8RW5
sr2z4IuVKxUGBUs71oKLAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAD58NMK5VDoN
w6P4XDx/L6BDl9j6lPV9Qg3F8BqAfFeW080oy/DTaXaE0zZZPijREGoaxk6eI85d
BtU4YWBkBC5jxAVITx/jE99GkklQOzU+Ppzjp51wX/zlsw3WCjusEhh4v2AKBH/8
y3z7Sdwo58/QNqGSOjH5YxbjndPbehJsUbHkVsi1y0jfaAGFP7rkkFKFs0xtuSiw
v8/J2THuG7idWozddeWyDufrrLAsAHve+y9n/J7IoayDshmAhR6Noa2TyZS4rvpB
zMs2Wq5tzY/EXhJIOaPMYb+b+ca7njfN7zH0DgCjklqHhWQyHe2MQdHMVWVl9u1e
e80MdJjhlko=
-----END CERTIFICATE-----

View File

@@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQC245td3PIAhNuz
oPFKIhvxoWAAmLV4U1S9d2bby51J1/XfcHPLAQB7H8jRQyBV5z1bAPhTWZKxrM9t
seRbBrABzN9VlS+FfzQRW/RyOKUCa5clepgHoeP0I8RIX4cMAA4c63RxobqIdw6W
gSoUSY8Z/t+DNhqJkWyK2UaMyTmS9k9L/kxVXTSi+5QeaEW7wAW+aUHvsBiNqb1R
zPKDNYfwvlrbYvUyC2ymI684yN0l7tq7XOgMDbyLbVE1+9k/L+9aQgsqM3462q13
GyOZpURvsNYZhIT+BeArB17kDlYQvn0+/nFKGy6jGcLUawfg8RW5sr2z4IuVKxUG
BUs71oKLAgMBAAECggEABoQfgf2gRbJ2HXVLg4eplTdZs0u9k3bsmv+JE6WyifH+
2aIpDf+QI9LjFcmdelIN1pM3Rcj4OApfLZpb935KgRXqkyMImWoJ0eCD2hn4jxiE
PxqaFhOHiqhHkwiMSDosRo2BDZdkjP4o7+XUOPrR9WwmTId99I7Q3jWVlOiKe5jp
mO/6WpQNfUzQDeCw+dajb5V+CK7BdRg71oN0VYkh4TDRJu20mgdoful747HX46Tl
dc+exFLIhohJrQUaRVDmb992hu3GJXQuDdQVFA5AIs5royLR4ZyVie+s/jF42cxM
YBowtvcGxZ2X/q8/XQwfRRE3jlB1xpjVHj8jfOtioQKBgQDanchewW/QStHcprog
7mQtEwV3BoGDljUtULxWi1IztpuYSdOE5p054LFIFsEhxoEVBaBOut3RG3B5w+rn
kFggClUp8eg907BtdixZ2mBWhCEo6saMAm9tcQ7wmzXIIQs6IhAW94tGXwaIaPFe
80oGzoogXC0QdBSP6o6A71CcuwKBgQDWKdEkAYTKtKmffbz17faDPRqZAd+E3dWZ
BaM1kcQJh5JxBv79bN5MZBelYvbIseYIEl7L+aMp5TWAJD+6DTiJK4mBdvkEMBeO
ZHefvc7UlohIQaiziS+z5x3vHwYMbTeS4lLMp+MmW++HkrLGY1kulSaSpk7vVk3q
1z4HI/i8cQKBgBamXkoi9Hi6J8AarhIXYN2iqOBKFkUR3PSS9tBoot2kv74pd/a/
Be8nLnbvlJbxQBJzgMZnae/uTdrvx3iyZc78AxLTc2JkelT8919f1rdf/SeGG4gK
AI1wN0IKcqoHcmhVeyFGCHIECmM7rDZQMo09/OWZZznbLP40KQuGv+1dAoGAYKwJ
ovYoihPZCYyJkn2zK/SWIAEvc1trgqJ/1LuSwTZ4TRr6WU0eX19DKT2t5lQfYP9h
2TM7irrTVp+GQKadIZYMgOtCZriKuZTyRqI4TdARfoRc8YX4iX3HDlxzr4JRdrVA
6O7T40nWqtz2ZAUOia979PCravALRfmZH0IGkpECgYA0xvtg2jhDLQGPUEl/ft3W
jenP1RkYAuOEpBK3traqed6Rb5IT75h8JKlqo9N6wX2xUuUZtdUrct1mvRgmanv1
29WS9a+dGx7NBycKrkMMDbaHVEshiP0kA8bpnOD0ssCoKrMOyOJRJw+ZVaXhFnt+
ulVCZQW6fWqtCHtRGZ4BMQ==
-----END PRIVATE KEY-----

View File

@@ -0,0 +1,271 @@
[
{
"id": "99bf88cf.4254c8",
"type": "influxdb in",
"z": "e7ce51cb.4244",
"influxdb": "730dac77.69ca34",
"name": "",
"query": "select * from test",
"rawOutput": false,
"precision": "",
"retentionPolicy": "",
"x": 450,
"y": 400,
"wires": [
[
"fa349e8c.f740a"
]
]
},
{
"id": "d1adae5b.bca4",
"type": "inject",
"z": "e7ce51cb.4244",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 200,
"y": 400,
"wires": [
[
"99bf88cf.4254c8"
]
]
},
{
"id": "fa349e8c.f740a",
"type": "debug",
"z": "e7ce51cb.4244",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 710,
"y": 400,
"wires": []
},
{
"id": "eac189ce.f28be8",
"type": "inject",
"z": "e7ce51cb.4244",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"x": 360,
"y": 100,
"wires": [
[
"b397e971.522bd8"
]
]
},
{
"id": "b397e971.522bd8",
"type": "function",
"z": "e7ce51cb.4244",
"name": "Fields",
"func": "msg.payload = {\n numValue: 123.0,\n strValue: \"message\",\n randomValue: Math.random()*10\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 508,
"y": 100,
"wires": [
[
"51fc70d6.dc65b"
]
]
},
{
"id": "51fc70d6.dc65b",
"type": "influxdb out",
"z": "e7ce51cb.4244",
"influxdb": "730dac77.69ca34",
"name": "",
"measurement": "test",
"precision": "",
"retentionPolicy": "",
"x": 698,
"y": 100,
"wires": []
},
{
"id": "a9d0f3cc.bbceb",
"type": "inject",
"z": "e7ce51cb.4244",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"x": 340,
"y": 160,
"wires": [
[
"a284e9c0.969b08"
]
]
},
{
"id": "a284e9c0.969b08",
"type": "function",
"z": "e7ce51cb.4244",
"name": "Fields and Tags",
"func": "msg.payload = [{\n numValue: 12,\n randomValue: Math.random()*10,\n strValue: \"message2\"\n},\n{\n tag1:\"sensor1\",\n tag2:\"device2\"\n}];\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 511,
"y": 160,
"wires": [
[
"2056b637.2cdf8a"
]
]
},
{
"id": "2056b637.2cdf8a",
"type": "influxdb out",
"z": "e7ce51cb.4244",
"influxdb": "730dac77.69ca34",
"name": "",
"measurement": "test",
"precision": "",
"retentionPolicy": "",
"x": 719,
"y": 160,
"wires": []
},
{
"id": "b70228ff.b5c1c8",
"type": "function",
"z": "e7ce51cb.4244",
"name": "multiple readings",
"func": "msg.payload = [\n [{\n numValue: 10,\n randomValue: Math.random()*10,\n strValue: \"message1\",\n time: new Date(\"2015-12-28T19:41:13Z\").getTime()\n },\n {\n tag1:\"sensor1\",\n tag2:\"device2\"\n }],\n [{\n numValue: 20,\n randomValue: Math.random()*10,\n strValue: \"message2\",\n time: new Date(\"2015-12-28T19:41:14Z\").getTime()\n },\n {\n tag1:\"sensor1\",\n tag2:\"device2\"\n }]\n];\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 490,
"y": 240,
"wires": [
[
"f77ae03a.c8af"
]
]
},
{
"id": "cc5a4f6c.7ca5",
"type": "inject",
"z": "e7ce51cb.4244",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"x": 316,
"y": 240,
"wires": [
[
"b70228ff.b5c1c8"
]
]
},
{
"id": "f77ae03a.c8af",
"type": "influxdb out",
"z": "e7ce51cb.4244",
"influxdb": "730dac77.69ca34",
"name": "",
"measurement": "test",
"precision": "",
"retentionPolicy": "",
"x": 711,
"y": 239,
"wires": []
},
{
"id": "b005e63a.2cde38",
"type": "function",
"z": "e7ce51cb.4244",
"name": "multiple measurement points",
"func": "msg.payload = [\n {\n measurement: \"weather_sensor\",\n fields: {\n temp: 5.5,\n light: 678,\n humidity: 51\n },\n tags:{\n location:\"garden\"\n },\n timestamp: new Date()\n },\n {\n measurement: \"alarm_sensor\",\n fields: {\n proximity: 999,\n temp: 19.5\n },\n tags:{\n location:\"home\"\n },\n timestamp: new Date()\n }\n];\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 440,
"y": 320,
"wires": [
[
"ea1abed6.da87d"
]
]
},
{
"id": "fb899d8a.42d35",
"type": "inject",
"z": "e7ce51cb.4244",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"x": 220,
"y": 320,
"wires": [
[
"b005e63a.2cde38"
]
]
},
{
"id": "ea1abed6.da87d",
"type": "influxdb batch",
"z": "e7ce51cb.4244",
"influxdb": "730dac77.69ca34",
"precision": "",
"retentionPolicy": "",
"name": "",
"x": 690,
"y": 320,
"wires": []
},
{
"id": "730dac77.69ca34",
"type": "influxdb",
"z": "",
"hostname": "127.0.0.1",
"port": "8086",
"protocol": "http",
"database": "test",
"name": "",
"usetls": true,
"tls": "8086d718.bcda28"
},
{
"id": "8086d718.bcda28",
"type": "tls-config",
"z": "",
"name": "",
"cert": "",
"key": "",
"ca": "",
"certname": "",
"keyname": "",
"caname": "",
"servername": "",
"verifyservercert": false
}
]