diff --git a/monitoring/node-red/data/.config.nodes.json b/monitoring/node-red/data/.config.nodes.json new file mode 100644 index 0000000..e27870c --- /dev/null +++ b/monitoring/node-red/data/.config.nodes.json @@ -0,0 +1,430 @@ +{ + "node-red": { + "name": "node-red", + "version": "4.1.8", + "local": false, + "user": false, + "nodes": { + "junction": { + "name": "junction", + "types": [ + "junction" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/common/05-junction.js" + }, + "inject": { + "name": "inject", + "types": [ + "inject" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/common/20-inject.js" + }, + "debug": { + "name": "debug", + "types": [ + "debug" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/common/21-debug.js" + }, + "complete": { + "name": "complete", + "types": [ + "complete" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/common/24-complete.js" + }, + "catch": { + "name": "catch", + "types": [ + "catch" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/common/25-catch.js" + }, + "status": { + "name": "status", + "types": [ + "status" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/common/25-status.js" + }, + "link": { + "name": "link", + "types": [ + "link in", + "link out", + "link call" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/common/60-link.js" + }, + "comment": { + "name": "comment", + "types": [ + "comment" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/common/90-comment.js" + }, + "global-config": { + "name": "global-config", + "types": [ + "global-config" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/common/91-global-config.js" + }, + "unknown": { + "name": "unknown", + "types": [ + "unknown" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/common/98-unknown.js" + }, + "function": { + "name": "function", + "types": [ + "function" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/function/10-function.js" + }, + "switch": { + "name": "switch", + "types": [ + "switch" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/function/10-switch.js" + }, + "change": { + "name": "change", + "types": [ + "change" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/function/15-change.js" + }, + "range": { + "name": "range", + "types": [ + "range" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/function/16-range.js" + }, + "template": { + "name": "template", + "types": [ + "template" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/function/80-template.js" + }, + "delay": { + "name": "delay", + "types": [ + "delay" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/function/89-delay.js" + }, + "trigger": { + "name": "trigger", + "types": [ + "trigger" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/function/89-trigger.js" + }, + "exec": { + "name": "exec", + "types": [ + "exec" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/function/90-exec.js" + }, + "rbe": { + "name": "rbe", + "types": [ + "rbe" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/function/rbe.js" + }, + "tls": { + "name": "tls", + "types": [ + "tls-config" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/network/05-tls.js" + }, + "httpproxy": { + "name": "httpproxy", + "types": [ + "http proxy" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/network/06-httpproxy.js" + }, + "mqtt": { + "name": "mqtt", + "types": [ + "mqtt in", + "mqtt out", + "mqtt-broker" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/network/10-mqtt.js" + }, + "httpin": { + "name": "httpin", + "types": [ + "http in", + "http response" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/network/21-httpin.js" + }, + "httprequest": { + "name": "httprequest", + "types": [ + "http request" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/network/21-httprequest.js" + }, + "websocket": { + "name": "websocket", + "types": [ + "websocket in", + "websocket out", + "websocket-listener", + "websocket-client" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/network/22-websocket.js" + }, + "tcpin": { + "name": "tcpin", + "types": [ + "tcp in", + "tcp out", + "tcp request" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/network/31-tcpin.js" + }, + "udp": { + "name": "udp", + "types": [ + "udp in", + "udp out" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/network/32-udp.js" + }, + "CSV": { + "name": "CSV", + "types": [ + "csv" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/parsers/70-CSV.js" + }, + "HTML": { + "name": "HTML", + "types": [ + "html" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/parsers/70-HTML.js" + }, + "JSON": { + "name": "JSON", + "types": [ + "json" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/parsers/70-JSON.js" + }, + "XML": { + "name": "XML", + "types": [ + "xml" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/parsers/70-XML.js" + }, + "YAML": { + "name": "YAML", + "types": [ + "yaml" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/parsers/70-YAML.js" + }, + "split": { + "name": "split", + "types": [ + "split", + "join" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/sequence/17-split.js" + }, + "sort": { + "name": "sort", + "types": [ + "sort" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/sequence/18-sort.js" + }, + "batch": { + "name": "batch", + "types": [ + "batch" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/sequence/19-batch.js" + }, + "file": { + "name": "file", + "types": [ + "file", + "file in" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/storage/10-file.js" + }, + "watch": { + "name": "watch", + "types": [ + "watch" + ], + "enabled": true, + "local": false, + "user": false, + "module": "node-red", + "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/storage/23-watch.js" + } + } + } +} \ No newline at end of file diff --git a/monitoring/node-red/data/.config.runtime.json b/monitoring/node-red/data/.config.runtime.json new file mode 100644 index 0000000..e82525d --- /dev/null +++ b/monitoring/node-red/data/.config.runtime.json @@ -0,0 +1,5 @@ +{ + "instanceId": "22480a0b20f99f0c", + "_credentialSecret": "c128ee08a3b994abec9602b578cc23c8a395fd1259896c0c21609b46861a093e", + "telemetryEnabled": true +} \ No newline at end of file diff --git a/monitoring/node-red/data/.config.runtime.json.backup b/monitoring/node-red/data/.config.runtime.json.backup new file mode 100644 index 0000000..f4eb194 --- /dev/null +++ b/monitoring/node-red/data/.config.runtime.json.backup @@ -0,0 +1,4 @@ +{ + "instanceId": "22480a0b20f99f0c", + "_credentialSecret": "c128ee08a3b994abec9602b578cc23c8a395fd1259896c0c21609b46861a093e" +} \ No newline at end of file diff --git a/monitoring/node-red/data/.config.users.json b/monitoring/node-red/data/.config.users.json new file mode 100644 index 0000000..50b2a14 --- /dev/null +++ b/monitoring/node-red/data/.config.users.json @@ -0,0 +1,29 @@ +{ + "_": { + "editor": { + "view": { + "view-store-zoom": false, + "view-store-position": false, + "view-show-grid": true, + "view-snap-grid": true, + "view-grid-size": 20, + "view-node-status": true, + "view-node-info-icon": true, + "view-node-show-label": true, + "view-show-tips": true, + "view-show-welcome-tours": true + }, + "tours": { + "welcome": "4.1.8" + }, + "dialog": { + "export": { + "pretty": true, + "json-view": true + } + } + }, + "menu-menu-item-sidebar": true, + "menu-menu-item-palette": true + } +} \ No newline at end of file diff --git a/monitoring/node-red/data/.config.users.json.backup b/monitoring/node-red/data/.config.users.json.backup new file mode 100644 index 0000000..5237b67 --- /dev/null +++ b/monitoring/node-red/data/.config.users.json.backup @@ -0,0 +1,29 @@ +{ + "_": { + "editor": { + "view": { + "view-store-zoom": false, + "view-store-position": false, + "view-show-grid": true, + "view-snap-grid": true, + "view-grid-size": 20, + "view-node-status": true, + "view-node-info-icon": true, + "view-node-show-label": true, + "view-show-tips": true, + "view-show-welcome-tours": true + }, + "tours": { + "welcome": "4.1.8" + }, + "dialog": { + "export": { + "pretty": true, + "json-view": true + } + } + }, + "menu-menu-item-sidebar": false, + "menu-menu-item-palette": true + } +} \ No newline at end of file diff --git a/monitoring/node-red/data/.flows.json.backup b/monitoring/node-red/data/.flows.json.backup new file mode 100644 index 0000000..b187c98 --- /dev/null +++ b/monitoring/node-red/data/.flows.json.backup @@ -0,0 +1,1122 @@ +[ + { + "id": "00b02bbd01c91485", + "type": "tab", + "label": "Grafana Docker Safe Update", + "disabled": false, + "info": "" + }, + { + "id": "f16653fb4cb05bbe", + "type": "tab", + "label": "Health Check", + "disabled": false, + "info": "", + "env": [] + }, + { + "id": "d0f45d2b6f117365", + "type": "tab", + "label": "uptime-kuma alerts", + "disabled": false, + "info": "", + "env": [] + }, + { + "id": "c5240b64a962ea54", + "type": "tab", + "label": "Gotify Messages", + "disabled": false, + "info": "", + "env": [] + }, + { + "id": "22f648a14d2e8fae", + "type": "inject", + "z": "00b02bbd01c91485", + "name": "Test Alert", + "props": [ + { + "p": "payload" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": "", + "topic": "", + "payload": "{\"receiver\":\"node-red\",\"status\":\"firing\",\"alerts\":[{\"status\":\"firing\",\"labels\":{\"Active\":\"telegraf: 0 updates\",\"Restored\":\"telegraf: 0 updates\",\"alertname\":\"Updates\",\"com_docker_compose_project\":\"core\",\"compose_image\":\"telegraf:latest\",\"container\":\"telegraf\",\"grafana_folder\":\"Infrastructure\",\"job\":\"container-updates\",\"running_image\":\"telegraf:latest\"},\"annotations\":{},\"startsAt\":\"2026-03-31T01:16:10Z\",\"endsAt\":\"0001-01-01T00:00:00Z\",\"generatorURL\":\"https://grafana.lan.ddnsgeek.com/alerting/grafana/bfgysfo3iregwf/view?orgId=1\",\"fingerprint\":\"49b1e1dbf1255191\",\"silenceURL\":\"https://grafana.lan.ddnsgeek.com/alerting/silence/new?alertmanager=grafana&matcher=__alert_rule_uid__%3Dbfgysfo3iregwf&matcher=Active%3Dtelegraf%3A+0+updates&matcher=Restored%3Dtelegraf%3A+0+updates&matcher=com_docker_compose_project%3Dcore&matcher=compose_image%3Dtelegraf%3Alatest&matcher=container%3Dtelegraf&matcher=job%3Dcontainer-updates&matcher=running_image%3Dtelegraf%3Alatest&orgId=1\",\"dashboardURL\":\"https://grafana.lan.ddnsgeek.com/d/ad895wr?from=1774916170000&orgId=1&to=1774926701171\",\"panelURL\":\"https://grafana.lan.ddnsgeek.com/d/ad895wr?from=1774916170000&orgId=1&to=1774926701171&viewPanel=6\",\"ruleUID\":\"bfgysfo3iregwf\",\"values\":{\"A\":1,\"D\":1},\"valueString\":\"[ var='A' labels={com_docker_compose_project=core, compose_image=telegraf:latest, container=telegraf, job=container-updates, running_image=telegraf:latest} type='query' value=1 ], [ var='D' labels={com_docker_compose_project=core, compose_image=telegraf:latest, container=telegraf, job=container-updates, running_image=telegraf:latest} type='threshold' value=1 ]\",\"orgId\":1},{\"status\":\"firing\",\"labels\":{\"Active\":\"update-test: 0 updates\",\"Restored\":\"update-test: 0 updates\",\"alertname\":\"Updates\",\"com_docker_compose_project\":\"core\",\"compose_image\":\"nginx:1.27.1\",\"container\":\"update-test\",\"grafana_folder\":\"Infrastructure\",\"job\":\"container-updates\",\"running_image\":\"nginx:1.27.0\"},\"annotations\":{},\"startsAt\":\"2026-03-31T01:15:10Z\",\"endsAt\":\"0001-01-01T00:00:00Z\",\"generatorURL\":\"https://grafana.lan.ddnsgeek.com/alerting/grafana/bfgysfo3iregwf/view?orgId=1\",\"fingerprint\":\"c56bd9f28943cfac\",\"silenceURL\":\"https://grafana.lan.ddnsgeek.com/alerting/silence/new?alertmanager=grafana&matcher=__alert_rule_uid__%3Dbfgysfo3iregwf&matcher=Active%3Dupdate-test%3A+0+updates&matcher=Restored%3Dupdate-test%3A+0+updates&matcher=com_docker_compose_project%3Dcore&matcher=compose_image%3Dnginx%3A1.27.1&matcher=container%3Dupdate-test&matcher=job%3Dcontainer-updates&matcher=running_image%3Dnginx%3A1.27.0&orgId=1\",\"dashboardURL\":\"https://grafana.lan.ddnsgeek.com/d/ad895wr?from=1774916110000&orgId=1&to=1774926701171\",\"panelURL\":\"https://grafana.lan.ddnsgeek.com/d/ad895wr?from=1774916110000&orgId=1&to=1774926701171&viewPanel=6\",\"ruleUID\":\"bfgysfo3iregwf\",\"values\":{\"A\":1,\"D\":1},\"valueString\":\"[ var='A' labels={com_docker_compose_project=core, compose_image=nginx:1.27.1, container=update-test, job=container-updates, running_image=nginx:1.27.0} type='query' value=1 ], [ var='D' labels={com_docker_compose_project=core, compose_image=nginx:1.27.1, container=update-test, job=container-updates, running_image=nginx:1.27.0} type='threshold' value=1 ]\",\"orgId\":1}],\"groupLabels\":{\"alertname\":\"Updates\",\"grafana_folder\":\"Infrastructure\"},\"commonLabels\":{\"alertname\":\"Updates\",\"com_docker_compose_project\":\"core\",\"grafana_folder\":\"Infrastructure\",\"job\":\"container-updates\"},\"commonAnnotations\":{},\"externalURL\":\"https://grafana.lan.ddnsgeek.com/\",\"appVersion\":\"12.4.2\",\"version\":\"1\",\"groupKey\":\"{}/{__grafana_autogenerated__=\\\"true\\\"}/{__grafana_receiver__=\\\"node-red\\\"}/{__grafana_route_settings_hash__=\\\"f177b219cbbdd2e2\\\"}:{alertname=\\\"Updates\\\", grafana_folder=\\\"Infrastructure\\\"}\",\"truncatedAlerts\":0,\"orgId\":1,\"title\":\"[FIRING:2] Updates Infrastructure (core container-updates)\",\"state\":\"alerting\",\"message\":\"**Firing**\\n\\nValue: A=1, D=1\\nLabels:\\n - alertname = Updates\\n - Active = telegraf: 0 updates\\n - Restored = telegraf: 0 updates\\n - com_docker_compose_project = core\\n - compose_image = telegraf:latest\\n - container = telegraf\\n - grafana_folder = Infrastructure\\n - job = container-updates\\n - running_image = telegraf:latest\\nAnnotations:\\nSource: https://grafana.lan.ddnsgeek.com/alerting/grafana/bfgysfo3iregwf/view?orgId=1\\nSilence: https://grafana.lan.ddnsgeek.com/alerting/silence/new?alertmanager=grafana&matcher=__alert_rule_uid__%3Dbfgysfo3iregwf&matcher=Active%3Dtelegraf%3A+0+updates&matcher=Restored%3Dtelegraf%3A+0+updates&matcher=com_docker_compose_project%3Dcore&matcher=compose_image%3Dtelegraf%3Alatest&matcher=container%3Dtelegraf&matcher=job%3Dcontainer-updates&matcher=running_image%3Dtelegraf%3Alatest&orgId=1\\nDashboard: https://grafana.lan.ddnsgeek.com/d/ad895wr?from=1774916170000&orgId=1&to=1774926701171\\nPanel: https://grafana.lan.ddnsgeek.com/d/ad895wr?from=1774916170000&orgId=1&to=1774926701171&viewPanel=6\\n\\nValue: A=1, D=1\\nLabels:\\n - alertname = Updates\\n - Active = update-test: 0 updates\\n - Restored = update-test: 0 updates\\n - com_docker_compose_project = core\\n - compose_image = nginx:1.27.1\\n - container = update-test\\n - grafana_folder = Infrastructure\\n - job = container-updates\\n - running_image = nginx:1.27.0\\nAnnotations:\\nSource: https://grafana.lan.ddnsgeek.com/alerting/grafana/bfgysfo3iregwf/view?orgId=1\\nSilence: https://grafana.lan.ddnsgeek.com/alerting/silence/new?alertmanager=grafana&matcher=__alert_rule_uid__%3Dbfgysfo3iregwf&matcher=Active%3Dupdate-test%3A+0+updates&matcher=Restored%3Dupdate-test%3A+0+updates&matcher=com_docker_compose_project%3Dcore&matcher=compose_image%3Dnginx%3A1.27.1&matcher=container%3Dupdate-test&matcher=job%3Dcontainer-updates&matcher=running_image%3Dnginx%3A1.27.0&orgId=1\\nDashboard: https://grafana.lan.ddnsgeek.com/d/ad895wr?from=1774916110000&orgId=1&to=1774926701171\\nPanel: https://grafana.lan.ddnsgeek.com/d/ad895wr?from=1774916110000&orgId=1&to=1774926701171&viewPanel=6\\n\"}", + "payloadType": "json", + "x": 140, + "y": 100, + "wires": [ + [ + "671243b648c669fe" + ] + ] + }, + { + "id": "17eef927bdc12e54", + "type": "function", + "z": "00b02bbd01c91485", + "name": "Create Pull Command", + "func": "const labels = msg.payload.alerts.labels || {};\nconst container = labels.container;\nconst image = labels.compose_image || labels.running_image || labels.image;\nconst project = labels.com_docker_compose_project\n\nif (project == \"core\") {\n var host = \"docker\"\n}\nelse {\n host = \"raspi\"\n}\n\nif (!container) {\n node.warn(\"No container found in alert labels\");\n return null; // skip this alert\n}\n\nmsg.payload = `/compose/${host}/services-up.sh --profile all pull -q ${container}`;\nmsg.container = container;\nmsg.image = image;\nmsg.host = host;\nnode.log(`New docker update available\n Container: ${container}\n Image: ${image}\n Host: ${host}`)\nreturn msg;", + "outputs": 1, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 1300, + "y": 80, + "wires": [ + [ + "e92429c3061966f7" + ] + ] + }, + { + "id": "e92429c3061966f7", + "type": "exec", + "z": "00b02bbd01c91485", + "command": "", + "addpay": "payload", + "append": "", + "useSpawn": "false", + "timer": "", + "winHide": false, + "oldrc": false, + "name": "Pull Image", + "x": 1510, + "y": 80, + "wires": [ + [ + "5c36c5b0e44d7cb0" + ], + [ + "5c36c5b0e44d7cb0" + ], + [ + "3af6aa9cbaad6ff9" + ] + ] + }, + { + "id": "b8a933687445fb13", + "type": "exec", + "z": "00b02bbd01c91485", + "command": "", + "addpay": "payload", + "append": "", + "useSpawn": "false", + "timer": "70", + "winHide": false, + "oldrc": true, + "name": "Test New Image", + "x": 2160, + "y": 80, + "wires": [ + [ + "40e040d2b58bbaa1", + "4c182d7a643805cd" + ], + [ + "4c182d7a643805cd" + ], + [] + ] + }, + { + "id": "40e040d2b58bbaa1", + "type": "switch", + "z": "00b02bbd01c91485", + "name": "Check Test Result", + "property": "payload", + "propertyType": "msg", + "rules": [ + { + "t": "cont", + "v": "0", + "vt": "str" + }, + { + "t": "else" + } + ], + "checkall": "true", + "repair": false, + "outputs": 2, + "x": 2370, + "y": 80, + "wires": [ + [ + "da5d95a30589805c" + ], + [ + "47ac22574893de41" + ] + ] + }, + { + "id": "ab2063f9180cd1aa", + "type": "exec", + "z": "00b02bbd01c91485", + "command": "", + "addpay": "payload", + "append": "", + "useSpawn": "false", + "timer": "", + "winHide": false, + "oldrc": true, + "name": "Deploy Production Container", + "x": 2960, + "y": 80, + "wires": [ + [ + "32e3684b63a6f13e" + ], + [ + "e8e4151333935b78", + "32e3684b63a6f13e" + ], + [] + ] + }, + { + "id": "a4c73e8e3e87fab7", + "type": "http in", + "z": "00b02bbd01c91485", + "name": "Grafana Webhook", + "url": "/grafana-update", + "method": "post", + "upload": false, + "skipBodyParsing": false, + "swaggerDoc": "", + "x": 110, + "y": 60, + "wires": [ + [ + "671243b648c669fe" + ] + ] + }, + { + "id": "3af6aa9cbaad6ff9", + "type": "switch", + "z": "00b02bbd01c91485", + "name": "image pulled OK?", + "property": "payload.code", + "propertyType": "msg", + "rules": [ + { + "t": "eq", + "v": "0", + "vt": "num" + }, + { + "t": "else" + } + ], + "checkall": "true", + "repair": false, + "outputs": 2, + "x": 1710, + "y": 80, + "wires": [ + [ + "96c81501330c20e3" + ], + [ + "1de1d1befec88aa4" + ] + ] + }, + { + "id": "96c81501330c20e3", + "type": "function", + "z": "00b02bbd01c91485", + "name": "Build Test Command", + "func": "const container = msg.container;\nconst image = msg.image;\nconst host = msg.host;\nmsg.payload = `/data/test-container.sh ${container} ${host}`;\nmsg.image = image;\nmsg.container = container;\nmsg.host = host\nnode.log(`Pull Successful\n Container: ${container}\n Image: ${msg.image}\n Host: ${host}`\n )\nreturn msg;", + "outputs": 1, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 1940, + "y": 80, + "wires": [ + [ + "b8a933687445fb13" + ] + ] + }, + { + "id": "95e72a493b5b736c", + "type": "split", + "z": "00b02bbd01c91485", + "name": "", + "splt": "\\n", + "spltType": "str", + "arraySplt": 1, + "arraySpltType": "len", + "stream": true, + "addname": "", + "property": "payload.alerts", + "x": 610, + "y": 80, + "wires": [ + [ + "298528baa0f776b4" + ] + ] + }, + { + "id": "da5d95a30589805c", + "type": "function", + "z": "00b02bbd01c91485", + "name": "Build Deploy Command", + "func": "const container = msg.container;\nconst image = msg.image;\nconst host = msg.host;\nmsg.payload = `/compose/${host}/services-up.sh --profile all up -d ${container}`;\nmsg.image = image;\nmsg.container = container;\nmsg.host = host;\nnode.log(`Test Successful\n Container: ${container}\n Image: ${msg.image}\n Host: ${host}`\n )\nreturn msg;", + "outputs": 1, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 2670, + "y": 80, + "wires": [ + [ + "ab2063f9180cd1aa" + ] + ] + }, + { + "id": "27ac6d1d2b208f99", + "type": "link out", + "z": "00b02bbd01c91485", + "name": "Docker image pull fail", + "mode": "link", + "links": [ + "ba2c4e239d3b1e1d" + ], + "x": 2095, + "y": 140, + "wires": [] + }, + { + "id": "49c52031d95c0638", + "type": "link out", + "z": "00b02bbd01c91485", + "name": "Docker image test fail", + "mode": "link", + "links": [ + "10718f4768834442" + ], + "x": 2795, + "y": 140, + "wires": [] + }, + { + "id": "b083fcf71669254e", + "type": "link out", + "z": "00b02bbd01c91485", + "name": "Docker update success", + "mode": "link", + "links": [ + "f5771c9cc8e81779" + ], + "x": 3415, + "y": 80, + "wires": [] + }, + { + "id": "671243b648c669fe", + "type": "function", + "z": "00b02bbd01c91485", + "name": "WEBHOOK /grafana-update IN", + "func": "node.log(\n \"Payload:\\n\" +\n JSON.stringify(msg.payload, null, 2)\n);\nreturn msg;", + "outputs": 1, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 390, + "y": 80, + "wires": [ + [ + "95e72a493b5b736c" + ] + ] + }, + { + "id": "e8e4151333935b78", + "type": "function", + "z": "00b02bbd01c91485", + "name": "Deployment Success", + "func": "const attempts = flow.get(\"dockerUpdateAttempts\") || {};\n\nif (msg.updateKey && attempts[msg.updateKey]) {\n delete attempts[msg.updateKey];\n flow.set(\"dockerUpdateAttempts\", attempts);\n}\nnode.log(`Deployment Successful\n Container: ${msg.container}\n Image: ${msg.image}\n Host: ${msg.host}\n`);\n\nreturn msg;", + "outputs": 1, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 3240, + "y": 80, + "wires": [ + [ + "b083fcf71669254e" + ] + ] + }, + { + "id": "1de1d1befec88aa4", + "type": "function", + "z": "00b02bbd01c91485", + "name": "Pull Image Failed", + "func": "const labels = msg.payload.alerts.labels || {};\nconst container = labels.container;\nconst host = msg.host\nconst image = labels.compose_image || labels.running_image || labels.image;\n\nlet attempts = flow.get(\"dockerUpdateAttempts\") || {};\n\nif (msg.updateKey && attempts[msg.updateKey]) {\n const firstFailure = !attempts[msg.updateKey].notified;\n\n attempts[msg.updateKey].status = \"test_failed\";\n attempts[msg.updateKey].failedAt = Date.now();\n\n if (firstFailure) {\n attempts[msg.updateKey].notified = true;\n\n msg.notification = {\n title: `Docker update locked out: ${msg.container}`,\n message:\n `Automatic update for ${msg.container} failed.\\n\n Image: ${msg.image}\n Host: ${msg.host}\n Result: ${attempts[msg.updateKey].status}\\n\n Further Grafana alerts for this update will be ignored until manual intervention.`\n };\n\n flow.set(\"dockerUpdateAttempts\", attempts);\n\n // send to 2 outputs:\n // output 1 = existing failure handling\n // output 2 = notification flow\n return [msg, msg];\n }\n\n flow.set(\"dockerUpdateAttempts\", attempts);\n}\n\nnode.log(`Pull image failed\n Command: ${msg.payload}\n Container: ${container}\n Image: ${image}\n Host: ${host}`)\nreturn [msg, null];", + "outputs": 2, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 1930, + "y": 140, + "wires": [ + [ + "27ac6d1d2b208f99" + ], + [ + "0e6520dfb81a951b" + ] + ] + }, + { + "id": "47ac22574893de41", + "type": "function", + "z": "00b02bbd01c91485", + "name": "Test Image Failed", + "func": "//const labels = msg.payload.alerts.labels || {};\n//const container = labels.container;\nconst host = msg.host;\n//const image = labels.compose_image || labels.running_image || labels.image;\n\nlet attempts = flow.get(\"dockerUpdateAttempts\") || {};\n\nif (msg.updateKey && attempts[msg.updateKey]) {\n const firstFailure = !attempts[msg.updateKey].notified;\n\n attempts[msg.updateKey].status = \"test_failed\";\n attempts[msg.updateKey].failedAt = Date.now();\n\n if (firstFailure) {\n attempts[msg.updateKey].notified = true;\n\n msg.notification = {\n title: `Docker update locked out: ${msg.container}`,\n message:\n `Automatic update for ${msg.container} failed.\\n\n Image: ${msg.image}\n Host: ${msg.host}\n Result: ${attempts[msg.updateKey].status}\\n\n Further Grafana alerts for this update will be ignored until manual intervention.`\n };\n\n flow.set(\"dockerUpdateAttempts\", attempts);\n\n // send to 2 outputs:\n // output 1 = existing failure handling\n // output 2 = notification flow\n return [msg, msg];\n }\n\n flow.set(\"dockerUpdateAttempts\", attempts);\n}\n\nnode.log(`Test image failed\\n\n Command: ${msg.payload}\\n\n Container: ${msg.container}\\n\n Image: ${msg.image}\\n\n Host: ${host}`)\nreturn [msg, null];", + "outputs": 2, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 2650, + "y": 140, + "wires": [ + [ + "49c52031d95c0638" + ], + [ + "77675958f77d2d5f" + ] + ] + }, + { + "id": "298528baa0f776b4", + "type": "switch", + "z": "00b02bbd01c91485", + "name": "docker project name", + "property": "payload.alerts.labels.com_docker_compose_project", + "propertyType": "msg", + "rules": [ + { + "t": "eq", + "v": "core", + "vt": "str" + }, + { + "t": "eq", + "v": "raspi", + "vt": "str" + }, + { + "t": "else" + } + ], + "checkall": "true", + "repair": false, + "outputs": 3, + "x": 800, + "y": 80, + "wires": [ + [ + "bad4d106425b7dd2" + ], + [ + "bad4d106425b7dd2" + ], + [ + "1ab4069c08a68fa3" + ] + ] + }, + { + "id": "1ab4069c08a68fa3", + "type": "function", + "z": "00b02bbd01c91485", + "name": "Unknown Project", + "func": "const labels = msg.payload.alerts.labels || {};\nconst container = labels.container;\nconst image = labels.compose_image || labels.running_image || labels.image;\nconst project = labels.com_docker_compose_project\n\nnode.warn(`Unable to map project name ${project} to host.\\n\n Updates for ${container} failed`)\nreturn msg;", + "outputs": 1, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 1290, + "y": 200, + "wires": [ + [ + "852d039f540dd0d3" + ] + ] + }, + { + "id": "852d039f540dd0d3", + "type": "link out", + "z": "00b02bbd01c91485", + "name": "Docker updates fail unknown", + "mode": "link", + "links": [ + "7c62509d505c281b" + ], + "x": 1455, + "y": 200, + "wires": [] + }, + { + "id": "f4b91e278109e661", + "type": "function", + "z": "00b02bbd01c91485", + "name": "Repeat update Suppresed", + "func": "node.warn(\n `${msg.payload.alerts.labels.container} ` +\n `(${msg.payload.alerts.labels.compose_image})`\n);\nreturn msg;", + "outputs": 1, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 1310, + "y": 140, + "wires": [ + [] + ] + }, + { + "id": "5c36c5b0e44d7cb0", + "type": "function", + "z": "00b02bbd01c91485", + "name": "Logging", + "func": "//const labels = msg.payload.alerts.labels || {};\n//const container = labels.container;\n//const image = labels.compose_image || labels.running_image || labels.image;\n\nif (msg.payload != \"\") {\n node.log(msg.payload)\n}\nreturn msg;", + "outputs": 1, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 1680, + "y": 40, + "wires": [ + [] + ] + }, + { + "id": "4c182d7a643805cd", + "type": "function", + "z": "00b02bbd01c91485", + "name": "Logging", + "func": "//const labels = msg.payload.alerts.labels || {};\n//const container = labels.container;\n//const image = labels.compose_image || labels.running_image || labels.image;\nif (msg.payload != \"\") {\n node.log(msg.payload)\n}\nreturn msg;", + "outputs": 1, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 2340, + "y": 40, + "wires": [ + [] + ] + }, + { + "id": "32e3684b63a6f13e", + "type": "function", + "z": "00b02bbd01c91485", + "name": "Logging", + "func": "//const labels = msg.payload.alerts.labels || {};\n//const container = labels.container;\n//const image = labels.compose_image || labels.running_image || labels.image;\nif (msg.payload != \"\") {\n node.log(msg.payload)\n}\nreturn msg;", + "outputs": 1, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 3200, + "y": 40, + "wires": [ + [] + ] + }, + { + "id": "bad4d106425b7dd2", + "type": "function", + "z": "00b02bbd01c91485", + "name": "Check Already Attempted", + "func": "const labels = msg.payload.alerts.labels || {};\n\nconst container = labels.container;\nconst image = labels.compose_image || labels.running_image || labels.image;\nconst project = labels.com_docker_compose_project\n\n// Load persistent attempt registry\nlet attempts = flow.get(\"dockerUpdateAttempts\") || {};\n\nif (project == \"core\") {\n var host = \"docker\"\n}\nelse {\n host = \"raspi\"\n}\n\n// Unique key for this exact update attempt\nconst key = `${container}|${image}|${host}`;\n\n// If we've already tried this image for this container, suppress it\nif (attempts[key]) {\n node.warn(\n `Ignoring repeated update alert for ${container} -> ${image}. ` +\n `Already attempted at ${new Date(attempts[key].time).toISOString()}`\n );\n\n msg.suppressed = true;\n msg.updateKey = key;\n msg.attemptInfo = attempts[key];\n\n // output 1 = continue flow\n // output 2 = suppressed repeat\n return [null, msg];\n}\n\n// First time we've seen this update, record it immediately\nattempts[key] = {\n time: Date.now(),\n status: \"started\"\n};\n\nflow.set(\"dockerUpdateAttempts\", attempts);\n\nmsg.updateKey = key;\n\nnode.log(`First attempt for ${container} -> ${image}`);\n\n// continue normal flow\nreturn [msg, null];", + "outputs": 2, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 1050, + "y": 80, + "wires": [ + [ + "17eef927bdc12e54" + ], + [ + "f4b91e278109e661" + ] + ] + }, + { + "id": "0e6520dfb81a951b", + "type": "link out", + "z": "00b02bbd01c91485", + "name": "Docker image update locked", + "mode": "link", + "links": [ + "b72f58c8b6d6d265" + ], + "x": 2095, + "y": 200, + "wires": [] + }, + { + "id": "77675958f77d2d5f", + "type": "link out", + "z": "00b02bbd01c91485", + "name": "Docker image update locked", + "mode": "link", + "links": [ + "b72f58c8b6d6d265" + ], + "x": 2795, + "y": 200, + "wires": [] + }, + { + "id": "8c74f9646c655f07", + "type": "http in", + "z": "00b02bbd01c91485", + "name": "/docker-update-lockouts in", + "url": "/docker-update-lockouts", + "method": "get", + "upload": false, + "skipBodyParsing": false, + "swaggerDoc": "", + "x": 250, + "y": 340, + "wires": [ + [ + "bf13590833ea0288" + ] + ] + }, + { + "id": "bf13590833ea0288", + "type": "function", + "z": "00b02bbd01c91485", + "name": "get docker update lockouts", + "func": "const attempts = flow.get(\"dockerUpdateAttempts\") || {};\n\nconst output = Object.entries(attempts).map(([key, value]) => ({\n key,\n status: value.status,\n firstAttempt: new Date(value.time).toISOString(),\n failedAt: value.failedAt\n ? new Date(value.failedAt).toISOString()\n : null,\n notified: !!value.notified\n}));\n\nmsg.payload = output;\nnode.log(JSON.stringify(msg.payload, null, 2));\nreturn msg;", + "outputs": 1, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 540, + "y": 340, + "wires": [ + [ + "2fc3cf8f165b7537" + ] + ] + }, + { + "id": "2fc3cf8f165b7537", + "type": "http response", + "z": "00b02bbd01c91485", + "name": "", + "statusCode": "", + "headers": {}, + "x": 770, + "y": 340, + "wires": [] + }, + { + "id": "81f6db49f4ad354a", + "type": "http in", + "z": "00b02bbd01c91485", + "name": "clear lockout", + "url": "/docker-update-lockouts/clear", + "method": "post", + "upload": false, + "skipBodyParsing": false, + "swaggerDoc": "", + "x": 210, + "y": 480, + "wires": [ + [ + "28d736c3d3a4cf14" + ] + ] + }, + { + "id": "7bae4cc1bd52dfd8", + "type": "http response", + "z": "00b02bbd01c91485", + "name": "", + "statusCode": "", + "headers": {}, + "x": 770, + "y": 480, + "wires": [] + }, + { + "id": "28d736c3d3a4cf14", + "type": "function", + "z": "00b02bbd01c91485", + "name": "Clear lockout", + "func": "let attempts = flow.get(\"dockerUpdateAttempts\") || {};\nconst key = (msg.payload.key || \"\").trim(); // trim whitespace\n\n// optionally log all keys for debugging\nnode.log(\"Available keys: \" + Object.keys(attempts).join(\", \"));\nnode.log(\"Requested key: '\" + key + \"'\");\n\nif (key in attempts) { // use 'in' to avoid false negatives\n delete attempts[key];\n flow.set(\"dockerUpdateAttempts\", attempts);\n\n msg.payload = { success: true, cleared: key };\n node.log(`Cleared update lock for ${key}`);\n} else {\n msg.payload = { success: false, error: `No lock found for '${key}'` };\n}\nreturn msg;", + "outputs": 1, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 490, + "y": 480, + "wires": [ + [ + "7bae4cc1bd52dfd8" + ] + ] + }, + { + "id": "b113615f19bd2588", + "type": "http in", + "z": "f16653fb4cb05bbe", + "name": "/health in", + "url": "/health", + "method": "get", + "upload": false, + "skipBodyParsing": false, + "swaggerDoc": "", + "x": 380, + "y": 220, + "wires": [ + [ + "4bf7d7901301ce7e" + ] + ] + }, + { + "id": "4bf7d7901301ce7e", + "type": "function", + "z": "f16653fb4cb05bbe", + "name": "health check", + "func": "msg.payload = { status: \"ok\" };\nmsg.headers = { \"Content-Type\": \"application/json\" };\nnode.log(msg.payload.status);\nreturn msg;", + "outputs": 1, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 670, + "y": 220, + "wires": [ + [ + "269da1ef164eeb72" + ] + ] + }, + { + "id": "269da1ef164eeb72", + "type": "http response", + "z": "f16653fb4cb05bbe", + "name": "", + "statusCode": "", + "headers": {}, + "x": 950, + "y": 220, + "wires": [] + }, + { + "id": "40ed22bfb88a0d78", + "type": "http in", + "z": "d0f45d2b6f117365", + "name": "/uptime-kuma in", + "url": "/uptime-kuma", + "method": "post", + "upload": false, + "skipBodyParsing": false, + "swaggerDoc": "", + "x": 320, + "y": 200, + "wires": [ + [ + "46affc0319a44fa9", + "ab7d36db8e9316f8" + ] + ] + }, + { + "id": "4e0b1edf6f60d701", + "type": "http response", + "z": "d0f45d2b6f117365", + "name": "response", + "statusCode": "", + "headers": {}, + "x": 860, + "y": 200, + "wires": [] + }, + { + "id": "46affc0319a44fa9", + "type": "link out", + "z": "d0f45d2b6f117365", + "name": "gotify domain name alerts", + "mode": "link", + "links": [ + "bed17b50dd678228" + ], + "x": 615, + "y": 120, + "wires": [] + }, + { + "id": "ab7d36db8e9316f8", + "type": "function", + "z": "d0f45d2b6f117365", + "name": "WEBHOOK /uptime-kuma IN", + "func": "node.log(\n \"Payload:\\n\" +\n JSON.stringify(msg.payload, null, 2)\n);\nreturn msg;", + "outputs": 1, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 620, + "y": 200, + "wires": [ + [ + "4e0b1edf6f60d701" + ] + ] + }, + { + "id": "0301a3cebd1eb23f", + "type": "http request", + "z": "c5240b64a962ea54", + "name": "Send to gotify", + "method": "POST", + "ret": "obj", + "paytoqs": "ignore", + "url": "https://gotify.lan.ddnsgeek.com/message?token=ATSMpSKrdNjKXeT", + "tls": "", + "persist": false, + "proxy": "", + "insecureHTTPParser": false, + "authType": "", + "senderr": false, + "headers": [ + { + "keyType": "other", + "keyValue": "Content-Type", + "valueType": "other", + "valueValue": "application/json" + } + ], + "x": 1300, + "y": 280, + "wires": [ + [] + ] + }, + { + "id": "bed17b50dd678228", + "type": "link in", + "z": "c5240b64a962ea54", + "name": "Doman name alerts", + "links": [ + "46affc0319a44fa9" + ], + "x": 275, + "y": 100, + "wires": [ + [ + "6e58de21ded7459e" + ] + ] + }, + { + "id": "6e58de21ded7459e", + "type": "function", + "z": "c5240b64a962ea54", + "name": "Domain name alerts", + "func": "const name = msg.payload.monitor.name;\nconst hb = msg.payload.heartbeat;\n\nconst isUp = hb.status === 1;\n\nconst icon = isUp ? \"✅\" : \"🔴\";\nconst state = isUp ? \"UP\" : \"DOWN\";\n\n// Build a short title for the Gotify notification\nconst title = `${icon} ${name} is ${state}`;\nconst time = hb.localDateTime.split(\" \")[1].split(\":\").slice(0, 2).join(\":\");\n// Build a more detailed message\nlet message = `${icon} Monitor: ${name}\\n`;\nmessage += `Status: ${state}\\n`;\nmessage += `Time: ${time}\\n`;\nmessage += `Details: ${hb.msg}`;\n\nif (hb.ping !== undefined) {\n message += `\\nPing: ${hb.ping} ms`;\n}\n\nif (hb.duration !== undefined) {\n message += `\\nCheck Interval: ${hb.duration} sec`;\n}\n\n// Higher priority for down alerts\nmsg.payload = {\n title: title,\n message: message,\n priority: isUp ? 5 : 8\n};\n\nreturn msg;", + "outputs": 1, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 500, + "y": 100, + "wires": [ + [ + "8630c7dfcdbcce50" + ] + ] + }, + { + "id": "8630c7dfcdbcce50", + "type": "function", + "z": "c5240b64a962ea54", + "name": "GOTIFY alert OUT", + "func": "node.log(JSON.stringify(msg.payload, null, 2));\nreturn msg;", + "outputs": 1, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 1070, + "y": 280, + "wires": [ + [ + "0301a3cebd1eb23f" + ] + ] + }, + { + "id": "0135d283b9edfb01", + "type": "function", + "z": "c5240b64a962ea54", + "name": "Docker Pull Failed", + "func": "const container = msg.container || \"unknown container\";\nconst code = msg.payload.code;\nconst stderr = flow.get(\"pull_stderr\") || \"Unknown error\";\n\nmsg.payload = {\n title: \"Docker Update Failed\",\n message: `Pull failed for ${container}\\n${stderr}`,\n priority: 8\n};\n\nreturn msg;", + "outputs": 1, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 490, + "y": 200, + "wires": [ + [ + "8630c7dfcdbcce50" + ] + ] + }, + { + "id": "ba2c4e239d3b1e1d", + "type": "link in", + "z": "c5240b64a962ea54", + "name": "Docker pull failed alerts", + "links": [ + "27ac6d1d2b208f99" + ], + "x": 275, + "y": 200, + "wires": [ + [ + "0135d283b9edfb01" + ] + ] + }, + { + "id": "4eafade32c867e40", + "type": "function", + "z": "c5240b64a962ea54", + "name": "Docker test failed", + "func": "const container = msg.container || \"unknown container\";\nconst code = msg.payload.code;\nconst stderr = flow.get(\"pull_stderr\") || \"Unknown error\";\n\nmsg.payload = {\n title: \"Testing Failed\",\n message: `Testing failed for ${container}`,\n priority: 8\n};\n\nreturn msg;", + "outputs": 1, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 490, + "y": 300, + "wires": [ + [ + "8630c7dfcdbcce50" + ] + ] + }, + { + "id": "10718f4768834442", + "type": "link in", + "z": "c5240b64a962ea54", + "name": "Docker test failed alerts", + "links": [ + "49c52031d95c0638" + ], + "x": 275, + "y": 300, + "wires": [ + [ + "4eafade32c867e40" + ] + ] + }, + { + "id": "7d8200040f9b1e83", + "type": "function", + "z": "c5240b64a962ea54", + "name": "Docker update success", + "func": "const container = msg.container || \"unknown container\";\nconst code = msg.payload.code;\nconst stderr = flow.get(\"pull_stderr\") || \"Unknown error\";\n\nmsg.payload = {\n title: \"Container Updated\",\n message: `The ${container} container has been succesfully updated`,\n priority: 8\n};\n\nreturn msg;", + "outputs": 1, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 490, + "y": 380, + "wires": [ + [ + "8630c7dfcdbcce50" + ] + ] + }, + { + "id": "f5771c9cc8e81779", + "type": "link in", + "z": "c5240b64a962ea54", + "name": "Docker update success alerts", + "links": [ + "b083fcf71669254e" + ], + "x": 275, + "y": 380, + "wires": [ + [ + "7d8200040f9b1e83" + ] + ] + }, + { + "id": "c3d07241f4a570af", + "type": "function", + "z": "c5240b64a962ea54", + "name": "Docker updates Unknown Project", + "func": "const container = msg.container || \"unknown container\";\nconst code = msg.payload.code;\nconst stderr = flow.get(\"pull_stderr\") || \"Unknown error\";\nconst project = msg.payload.labels.com_docker_compose_project\nmsg.payload = {\n title: \"Container Updates Failed\",\n message: `The ${container} container has failed.\\n\n Unknown project ${project}`,\n priority: 8\n};\n\nreturn msg;", + "outputs": 1, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 520, + "y": 460, + "wires": [ + [ + "8630c7dfcdbcce50" + ] + ] + }, + { + "id": "7c62509d505c281b", + "type": "link in", + "z": "c5240b64a962ea54", + "name": "Docker update unknown project", + "links": [ + "852d039f540dd0d3" + ], + "x": 275, + "y": 460, + "wires": [ + [ + "c3d07241f4a570af" + ] + ] + }, + { + "id": "d1346f7151103832", + "type": "function", + "z": "c5240b64a962ea54", + "name": "Docker updates for Raspi", + "func": "const container = msg.container || \"unknown container\";\nconst code = msg.payload.code;\nconst stderr = flow.get(\"pull_stderr\") || \"Unknown error\";\nconst project = msg.payload.labels.com_docker_compose_project\nmsg.payload = {\n title: \"Container Updates Available - Raspi\",\n message: `The ${container} container has updates available.`,\n priority: 8\n};\n\nreturn msg;", + "outputs": 1, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 490, + "y": 520, + "wires": [ + [ + "8630c7dfcdbcce50" + ] + ] + }, + { + "id": "e6c64cd6d405b8ed", + "type": "link in", + "z": "c5240b64a962ea54", + "name": "Docker update for raspi", + "links": [], + "x": 275, + "y": 520, + "wires": [ + [ + "d1346f7151103832" + ] + ] + }, + { + "id": "b72f58c8b6d6d265", + "type": "link in", + "z": "c5240b64a962ea54", + "name": "Docker update locked", + "links": [ + "0e6520dfb81a951b", + "77675958f77d2d5f" + ], + "x": 275, + "y": 580, + "wires": [ + [ + "1a9798d5c081240a" + ] + ] + }, + { + "id": "1a9798d5c081240a", + "type": "function", + "z": "c5240b64a962ea54", + "name": "Docker updates locked", + "func": "const container = msg.container || \"unknown container\";\nconst code = msg.payload.code;\nconst stderr = flow.get(\"pull_stderr\") || \"Unknown error\";\n//const project = msg.payload.labels.com_docker_compose_project\nmsg.payload = {\n title: \"Update Locked out\",\n message: `Container: ${container}\n Host: ${msg.host}\\n\n Manual Intervention required.`,\n priority: 8\n};\n\nreturn msg;", + "outputs": 1, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 480, + "y": 580, + "wires": [ + [ + "8630c7dfcdbcce50" + ] + ] + } +] \ No newline at end of file diff --git a/monitoring/node-red/data/.flows_cred.json.backup b/monitoring/node-red/data/.flows_cred.json.backup new file mode 100644 index 0000000..a064eb1 --- /dev/null +++ b/monitoring/node-red/data/.flows_cred.json.backup @@ -0,0 +1,3 @@ +{ + "$": "3a4824a80803ad539950f337d67e528bZGBrGLreu0SvnxrH7vE1YhegoHsDWV1xaC+K2ZKHKVkduSQVcOTDerb6wuXV" +} \ No newline at end of file diff --git a/monitoring/node-red/data/.npm/_cacache/content-v2/sha512/b0/47/c1458664fa9b6a08e9035110b523127a96bd7285d19472dc702f5dc498b927412b0ecd3273708fbf9d61754520599ac0b0e11f3e4c4d4ac784e78d7d97fe b/monitoring/node-red/data/.npm/_cacache/content-v2/sha512/b0/47/c1458664fa9b6a08e9035110b523127a96bd7285d19472dc702f5dc498b927412b0ecd3273708fbf9d61754520599ac0b0e11f3e4c4d4ac784e78d7d97fe new file mode 100644 index 0000000..294d108 Binary files /dev/null and b/monitoring/node-red/data/.npm/_cacache/content-v2/sha512/b0/47/c1458664fa9b6a08e9035110b523127a96bd7285d19472dc702f5dc498b927412b0ecd3273708fbf9d61754520599ac0b0e11f3e4c4d4ac784e78d7d97fe differ diff --git a/monitoring/node-red/data/.npm/_cacache/content-v2/sha512/c2/c2/b64870ea5c5a42b5772106f51123cf684d3c8381de10ccc07d01168d111d0a1ab79ee26fda320b3027c76cfc856119f7b440845a83c9f22d7d731643e62f b/monitoring/node-red/data/.npm/_cacache/content-v2/sha512/c2/c2/b64870ea5c5a42b5772106f51123cf684d3c8381de10ccc07d01168d111d0a1ab79ee26fda320b3027c76cfc856119f7b440845a83c9f22d7d731643e62f new file mode 100644 index 0000000..19e7842 --- /dev/null +++ b/monitoring/node-red/data/.npm/_cacache/content-v2/sha512/c2/c2/b64870ea5c5a42b5772106f51123cf684d3c8381de10ccc07d01168d111d0a1ab79ee26fda320b3027c76cfc856119f7b440845a83c9f22d7d731643e62f @@ -0,0 +1 @@ +{"_id":"node-red-debugger","_rev":"4-77842405de49ac8fcd21dc06e98f929a","name":"node-red-debugger","dist-tags":{"latest":"1.1.1"},"versions":{"1.0.0":{"name":"node-red-debugger","version":"1.0.0","description":"A flow debugger for Node-RED 2.x","repository":{"type":"git","url":"git+https://github.com/node-red/node-red-debugger.git"},"scripts":{"build":"(tsc || exit 1) && npm run tslint && npm run copyAssets","tslint":"tslint -c tslint.json -p tsconfig.json","copyAssets":"node scripts/copy-static-assets.js","dev":"nodemon --exec 'npm run build' -i dist -e 'ts html'","test":"npm run build"},"keywords":["node-red","debugger"],"author":{"name":"Nick O'Leary","email":"nick.oleary@gmail.com"},"license":"Apache-2","node-red":{"version":">=2.0.0","plugins":{"flow-debugger":"dist/flow-debugger.js"}},"devDependencies":{"@types/node":"^15.12.2","fs-extra":"^10.0.0","html-minifier":"^4.0.0","nodemon":"^2.0.7","tslint":"^6.1.3","typescript":"^4.3.2"},"gitHead":"3c27f6d64e6dbd2313e2f859f8ffb1bf9772ca72","bugs":{"url":"https://github.com/node-red/node-red-debugger/issues"},"homepage":"https://github.com/node-red/node-red-debugger#readme","_id":"node-red-debugger@1.0.0","_nodeVersion":"14.17.0","_npmVersion":"6.14.13","dist":{"integrity":"sha512-XaWptBinVBjXZYWmURwbTDTCD1XxmRzOidYyput3Pqnb+H7g+Q2wtdBVX/ROEL1pWAqL1rzIK4/wXPYF6A6WFA==","shasum":"75dfa1ed1c2197e69700769c18e7cd56c6a0c409","tarball":"https://registry.npmjs.org/node-red-debugger/-/node-red-debugger-1.0.0.tgz","fileCount":17,"unpackedSize":73748,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgw4TGCRA9TVsSAnZWagAAi1gP/jTTNax+Tw2C83Udjf/1\nqxYSS1goc55dtQ3F8wTLPuZwOx3eo2ylp6oc9YicXU4nOfRmz4mVsUlLE0fe\nlJYqbCITTBvfx82ZLnx9Xfy3F6rNbJWRlDKqjuIuyFbFXaZfsZYictHa7eh6\nhFIrLDaG8CedEQbPRgUKCNVpMVaCcMuNOUMccSv6gGkssOlNctRFHrmvPU2M\nwwwwMZ3XIoPdt5hJ2MN1XxsCYl4ehtXavq3TmNGrzm4IdX0iQRhkQ6ji9odi\nuJX5hkblHedIhJseA6pHeBkh6bdTBeJKPiYDxx+io4qw5xU8ehyo4MTeqp89\njzaiTkMQmr7+SUL1wFj+3crY54WBr5hDQDeKd/xYfGneYWgqPho+AW/eQOJl\nKmuhOqJNy/hF63AaoFXuXBwVoyYeYAf9M63EWmxPcaYGxOwJws4Je2LK6e+d\niuggG+rlAoHz5HSVj+JUxw/iE0gKiXQNcsS6a4RpDaV1PiiNqQaEvQfDNtH/\neoK104u4nk2MvDmPhJeCcWFR//Jmwgh/IQIWdJO2UZ0gvBWgXWe/aV91Ru/A\n3C5YKWdpWB7Y64QLsTBqHXkPZTP6mFJfKWZm+lGaWqWcx42wc7xYEHceHJBu\nQNcI3gqztCPVz0h5J4l451Wr4qtwehPDmfYKXT/O7K/RdAEc3qZoShDktufX\nF4C0\r\n=JLZ9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCFGkrByzKFV6QjHlfZa2JB176kwRJelihrKhT5+RfkTwIgPlLJhsoaRH6y2L140UGqgd+L4IW6epxKq9s0RxNQgrk="}]},"_npmUser":{"name":"knolleary","email":"nick.oleary@gmail.com"},"directories":{},"maintainers":[{"name":"knolleary","email":"nick.oleary@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/node-red-debugger_1.0.0_1623426246605_0.7855937877363888"},"_hasShrinkwrap":false},"1.0.1":{"name":"node-red-debugger","version":"1.0.1","description":"A flow debugger for Node-RED 2.x","repository":{"type":"git","url":"git+https://github.com/node-red/node-red-debugger.git"},"scripts":{"build":"(tsc || exit 1) && npm run tslint && npm run copyAssets","tslint":"tslint -c tslint.json -p tsconfig.json","copyAssets":"node scripts/copy-static-assets.js","dev":"nodemon --exec 'npm run build' -i dist -e 'ts html'","test":"npm run build"},"keywords":["node-red","debugger"],"author":{"name":"Nick O'Leary","email":"nick.oleary@gmail.com"},"license":"Apache-2","node-red":{"version":">=2.0.0","plugins":{"flow-debugger":"dist/flow-debugger.js"}},"devDependencies":{"@types/node":"^15.12.2","fs-extra":"^10.0.0","html-minifier":"^4.0.0","nodemon":"^2.0.7","tslint":"^6.1.3","typescript":"^4.3.2"},"gitHead":"de2973e309e8b59b8d11f4e67dc4fe062142b10d","bugs":{"url":"https://github.com/node-red/node-red-debugger/issues"},"homepage":"https://github.com/node-red/node-red-debugger#readme","_id":"node-red-debugger@1.0.1","_nodeVersion":"14.17.0","_npmVersion":"6.14.13","dist":{"integrity":"sha512-7zOaX/vCUgwpiHrhLbk6P9d3kZY2P9G4t/0x9P69KlKRT1NxekGYtYKRKjFA1GRX0pna//nfJMXwAX4eyzhRZg==","shasum":"42c902dacc3a02993553e62c96a230b7cdf53df3","tarball":"https://registry.npmjs.org/node-red-debugger/-/node-red-debugger-1.0.1.tgz","fileCount":17,"unpackedSize":73748,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgw5S2CRA9TVsSAnZWagAAlDsP/1WhoDXGylQd7dBfg6oA\n+JRNKrQcqkkguKCIMKr+hHQU/6JiyswmwRTVZvT35pPSsk9Cw66H7SPWNqIN\ncZBDt/k6Jb03rJl5GFv32+vmxSrOIfvaVjiosIqVWmynPNqSsClZknufZpqb\niSD3RhQ6fWmv2FoENTw+MapZ1QV6mZyFnZG62Qe9nnUETBcuLW5/QHjENd16\nI5iHf4GK02qMDGHc34RSjZx5DGLvEqqgKBlAXKlc1yjTorxMl6D+CWiCg0fn\nRZj8wCPwSZRs5oyKjTLJ3Z3DFihRH8ecV+n57U4ncAQ3g1xpBFxBO/wbb9ct\nNyQ0vvmLb/CiwQv5UgPvxng7phzpaVqMNFo1xeGLckei2c7tOIcBktD8WPHS\nGNIcPZb1Fgiis9zqtT5u7pusBs8ftFd81xTitFioHSqTCO0UALhtb7a5eXuK\ngDhlVbqAhKaRHjzQ23rKi/xc+zrmgyUvIJgxMOtMv4nSwKJ1/4I9dkmcGbcQ\n4g+zvtRSwpN+kq60f4rweTX6Vle3kz0zlCsm+UyR6dDgQwblmouyV9TLO6J+\nWqBcmZviaYcbtyuMSlJsa2iQm2x/MUJjLapvjwFV6I9n0REcB524qa6qW+ru\n5egTDkOXWiLARaJuzwfRFyJDLeAoTi74LkVuHhAcsWF9lDb6mcRyBC2YIgZS\nab0i\r\n=7gDE\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDIIg+Dq9L/PH+PutU4M+OXpZ68N5Rjsjw/eMIC9ogkgQIgJXyK0jxIM+tAssiiXICcxdAqI747mUiHlNyh4UXRbGM="}]},"_npmUser":{"name":"knolleary","email":"nick.oleary@gmail.com"},"directories":{},"maintainers":[{"name":"knolleary","email":"nick.oleary@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/node-red-debugger_1.0.1_1623430326297_0.4331967962654064"},"_hasShrinkwrap":false},"1.1.0":{"name":"node-red-debugger","version":"1.1.0","description":"A flow debugger for Node-RED 2.x","repository":{"type":"git","url":"git+https://github.com/node-red/node-red-debugger.git"},"scripts":{"build":"(tsc || exit 1) && npm run tslint && npm run copyAssets","tslint":"tslint -c tslint.json -p tsconfig.json","copyAssets":"node scripts/copy-static-assets.js","dev":"nodemon --exec 'npm run build' -i dist -i resources -e 'ts html css'","test":"npm run build"},"keywords":["node-red","debugger"],"author":{"name":"Nick O'Leary","email":"nick.oleary@gmail.com"},"license":"Apache-2","node-red":{"version":">=2.0.0","plugins":{"flow-debugger":"dist/flow-debugger.js"}},"devDependencies":{"@types/node":"^15.12.2","fs-extra":"^10.0.0","html-minifier":"^4.0.0","nodemon":"^2.0.7","tslint":"^6.1.3","typescript":"^4.3.2"},"gitHead":"72b8e8747032ea7eb87e120cdd6c03e5c5f8ff4b","bugs":{"url":"https://github.com/node-red/node-red-debugger/issues"},"homepage":"https://github.com/node-red/node-red-debugger#readme","_id":"node-red-debugger@1.1.0","_nodeVersion":"14.17.0","_npmVersion":"6.14.13","dist":{"integrity":"sha512-V7252AQEGdtrmXzgVBqK0f+O2R1yZ1D5ZiJKmz2r/xm2S6MmAp/mkP6N2UC11c9+qLatZuLtSEYs2/okVt7knA==","shasum":"e0cae2bc35da21ac3037359aa8e8e9098a968c78","tarball":"https://registry.npmjs.org/node-red-debugger/-/node-red-debugger-1.1.0.tgz","fileCount":20,"unpackedSize":87423,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg3t1gCRA9TVsSAnZWagAAb9YQAJsm4nc4ttpPstCVI1uB\nW5haaMb8R4SlWKiMFr9GyS6ut+ivfDKYJ6Fh6sFLZVJfzLRXT/UPLAhEoTYJ\nR4sgh8sBBAYv43kzXIjptVaB0Xq58/j2bxDLxPnlwax0aOVEgMENlESrK7to\nkUJcrvsreW8NE1gPCpwwzLpqmMFLdvG+kX+f+4hIS+rMnwRT5be5xdufNf5y\nP6wjJ9FgSZEvyBWCvIEIgaVa/tup+vqtRrFxJ2rf5qi6YOj9MUvzPCgFon+c\n17B3rUz51UVIHDu99pZ2jLPEadRoCNL2ArWI5X/tZZtufOPcPyZanCRuA+Ze\nBVdde0FWmrqqn3o/Vc1VA4l8TBYm6Gvd/FjJfTcyrNJYCG8nKHzv3SKKHB+e\nnmptZ83IwtXAc0YbHnPGLA7R6414KoPxPplKrOUZZqzz6Fl4xJ4vdVvXt9c1\nm4J+60ZOjkS1z52E//Ucimp/BG1qBErinMQ9+ZNAcQ5iYOO4tgwgdvwv+Xk6\n3kJgxvdQlbQk/mQ9C5VCkXhmZw35tJxLwLKGIMs95CkvKDyU14QdjNiFbNiV\nKs/7sz/Fx9L7wstzXT1e7FXKbf9Z73hx9mn5GprqdBEEjdc+AmzeJXh3d6UG\njBzipDX8pMTT2cbA/ZzXHYEoDZ2fOMt6m/mXFixrGDZuB1qfDgfuI79FjHz2\nLVs6\r\n=yESb\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC42gKjcci+dRJhwvpAf6CJ4PbapOEO30VApqFZrEKyNAiEA/5UaucZw72vQlOvCOoScl8fgQYQR5EQeqdD7F8K9oUQ="}]},"_npmUser":{"name":"knolleary","email":"nick.oleary@gmail.com"},"directories":{},"maintainers":[{"name":"knolleary","email":"nick.oleary@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/node-red-debugger_1.1.0_1625218399672_0.4417756923323586"},"_hasShrinkwrap":false},"1.1.1":{"name":"node-red-debugger","version":"1.1.1","description":"A flow debugger for Node-RED 2.x","repository":{"type":"git","url":"git+https://github.com/node-red/node-red-debugger.git"},"scripts":{"build":"(tsc || exit 1) && npm run tslint && npm run copyAssets","tslint":"tslint -c tslint.json -p tsconfig.json","copyAssets":"node scripts/copy-static-assets.js","dev":"nodemon --exec 'npm run build' -i dist -i resources -e 'ts html css'","test":"npm run build"},"keywords":["node-red","debugger"],"author":{"name":"Nick O'Leary","email":"nick.oleary@gmail.com"},"license":"Apache-2","node-red":{"version":">=2.0.0","plugins":{"flow-debugger":"dist/flow-debugger.js"}},"devDependencies":{"@types/node":"^15.12.2","fs-extra":"^10.0.0","html-minifier":"^4.0.0","nodemon":"^2.0.7","tslint":"^6.1.3","typescript":"^4.3.2"},"gitHead":"03ec572f899038a9386d774c7a86bbd8c7390441","bugs":{"url":"https://github.com/node-red/node-red-debugger/issues"},"homepage":"https://github.com/node-red/node-red-debugger#readme","_id":"node-red-debugger@1.1.1","_nodeVersion":"14.17.0","_npmVersion":"6.14.13","dist":{"integrity":"sha512-sEfBRYZk+ptqCOkDURC1IxJ6lr1yhdGUctxwL13EmLknQSsOzTJzcI+/nWF1RSBZmsCw4R8+TE1Kx4TnjX2X/g==","shasum":"0450ac3bfa437556ab33e9ece8a967ee38da907f","tarball":"https://registry.npmjs.org/node-red-debugger/-/node-red-debugger-1.1.1.tgz","fileCount":20,"unpackedSize":87568,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg+AG8CRA9TVsSAnZWagAAKIsP/36YhU4VVhovGTcnZ4K/\nWfQSPfx1F4snuw5g/mTf4JBhPB5Ej4ufsCqeG43wfzn5pz0NZJgR0irjm2Xn\nh3oUGrwN/KRir98Ms9aXMolQ5usCoP5IEd05NVOjW7EhfO42+Jx74i8VYqYn\ntfHtrrd7eMbjRJFzgUSdf1gFosxCvpQwF2WKXgzqHqrpxgg/8cCfkMK9OA4X\ndPnhcOEB5yOjoQIB964h62oLYrbpcJvvU2qfr3LVGC/n/+kDU9eVKEfaY5wA\niPZeHUyqnAsMkoNxhZqwEZnP/p7IUrIxYmRV3WcouFWxE/vh2qek13RkxE9c\nr8tY4hqMDZAFhI0sb9FOHEtFJPS6LH71IZiQdMZmRfWpfu6TMspg0vRnKXmm\nKS50Q7N17ZiNIEp5WKLskvldeorMp9+Y8xPoO9vhhAr1cSZJ/88JDC0epv7h\nuUJOeD1uR/KzHjyivQ2DYshwM30XzLAiYJHXExno5m0oXbQ5NsnF7+5G7FiJ\nA8+kpDr/QIuJRlMn2Pc/JWj3G/MKM7k5yX04W1nwvpue68uunDiiquDNUWi7\nSVB09EnGaODP9TC3V0f1wAPcp++DaVIUYFdv2CH9lW/6qIHQOeQ4MiMg/Jc+\nIse3Q/1srIQSlpMBpo+ZV27xy+bldkFRzne8smOXGsiI7byP8QG9pRXh+56d\nlU1i\r\n=9qR8\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDdX2dtKGX3opUZ18KiS0y4HV4tFRRbJE7X5iThmeKekwIgBDy60zfXxRBy/bNRcgXXbzQa0INkIRMB9jMVmndiQuk="}]},"_npmUser":{"name":"knolleary","email":"nick.oleary@gmail.com"},"directories":{},"maintainers":[{"name":"knolleary","email":"nick.oleary@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/node-red-debugger_1.1.1_1626866108052_0.6596553668642058"},"_hasShrinkwrap":false}},"time":{"created":"2021-06-11T15:44:06.605Z","1.0.0":"2021-06-11T15:44:06.740Z","modified":"2022-05-11T04:22:13.151Z","1.0.1":"2021-06-11T16:52:06.434Z","1.1.0":"2021-07-02T09:33:19.823Z","1.1.1":"2021-07-21T11:15:08.226Z"},"maintainers":[{"name":"knolleary","email":"nick.oleary@gmail.com"}],"description":"A flow debugger for Node-RED 2.x","homepage":"https://github.com/node-red/node-red-debugger#readme","keywords":["node-red","debugger"],"repository":{"type":"git","url":"git+https://github.com/node-red/node-red-debugger.git"},"author":{"name":"Nick O'Leary","email":"nick.oleary@gmail.com"},"bugs":{"url":"https://github.com/node-red/node-red-debugger/issues"},"license":"Apache-2","readme":"# Node-RED Flow Debugger\n\nThis module is a Plugin for Node-RED 2.x. It provides a flow debugger with the following\nfeatures:\n\n - set breakpoints on node inputs or outputs\n - pause the runtime manually or when a message arrives at a breakpoint\n - once paused you can:\n - inspect the queued up messages\n - step forward individual messages\n - drop messages\n\n## Installation\n\nInstall this module in your Node-RED user directory or via the Palette Manager\nthen restart Node-RED\n\n npm install node-red-debugger\n\n\n## Usage\n\nThe Flow Debugger adds a new sidebar tab in the editor. Select it from the dropdown\nmenu.\n\nBy default, the debugger is disabled. Click the 'disabled' toggle button to enable it.\n\nThe sidebar has two sections - a list of the breakpoints you have set and a list\nof any messages queued up in the runtime.\n\n### Working with breakpoints\n\nWith the debugger enabled, when you hover over a node's port a breakpoint indicator\nwill appear. Move your mouse over the indicator and click once - it will turn solid blue\nand an entry will appear in the sidebar.\n\nIf you click on it again, the breakpoint will be deactivated but remain in place (light blue).\n\nClicking on it again will remove the breakpoint entirely (dotted outline).\n\nYou can also deactive a breakpoint using its checkbox in the sidebar, and remove it by\nclicking the `x` button.\n\n### Pausing the runtime\n\nThe runtime will by paused whenever a message arrives at an active breakpoint. You\ncan also manually pause the runtime using the pause button in the sidebar.\n\nOnce paused, the flow will show how many messages are queued up at each node input\nand output. Those messages will also be listed in the sidebar - in the order the\nruntime will process them.\n\nIf you click the step button at the top of the sidebar, the runtime will process\nthe next message in the list. You can step individual messages by clicking the\nstep button that appears when you hover over the message.\n\nYou can also delete any message from the queue by clicking its delete button. This\nwill prevent the message from passing any further in the flow.\n\nYou can click the play button to resume the flows.\n\n\n## Limitations\n\n - Due to the way Subflows work, breakpoints on Subflow outputs will be ignored\n\n## Roadmap\n\n - Set conditions on individual breakpoints\n - Allow queued messages to be edited\n - Pause only selected nodes/flows/groups\n\n\n## Development\n\nThis plugin has been developed using TypeScript. This means that when running\nfrom the source code rather than npm, it must first be built.\n\n git clone https://github.com/node-red/node-red-debugger.git\n cd node-red-debugger\n npm install\n npm run build\n\nThis will generate all of the plugin files in the `dist` folder - which is where\nNode-RED will expect to load the files from.\n\n\nThen, in your Node-RED user directory (`~/.node-red`) run:\n\n npm install ``\n\n### Themeing\n\nThe Debugger sidebar will use the active Node-RED theme. For the breakpoints\ndrawn within the flow workspace, the following CSS variables will be used if they\nare set by the active theme.\n\n - `--red-ui-flow-debugger-breakpoint-fill`\n - `--red-ui-flow-debugger-breakpoint-stroke`\n - `--red-ui-flow-debugger-breakpoint-active-fill`\n - `--red-ui-flow-debugger-breakpoint-active-stroke`\n - `--red-ui-flow-debugger-breakpoint-inactive-fill`\n - `--red-ui-flow-debugger-breakpoint-inactive-stroke`\n - `--red-ui-flow-debugger-breakpoint-label`\n - `--red-ui-flow-debugger-breakpoint-label-active`\n","readmeFilename":"README.md"} \ No newline at end of file diff --git a/monitoring/node-red/data/.npm/_cacache/index-v5/15/a4/2638498d877ec2c8c3d88cb9c08d7867c52d3fceb6fc64cc5abde73b01a9 b/monitoring/node-red/data/.npm/_cacache/index-v5/15/a4/2638498d877ec2c8c3d88cb9c08d7867c52d3fceb6fc64cc5abde73b01a9 new file mode 100644 index 0000000..608faea --- /dev/null +++ b/monitoring/node-red/data/.npm/_cacache/index-v5/15/a4/2638498d877ec2c8c3d88cb9c08d7867c52d3fceb6fc64cc5abde73b01a9 @@ -0,0 +1,2 @@ + +910aac156dabb4fcf662d29b6bd825588e1e1844 {"key":"make-fetch-happen:request-cache:https://registry.npmjs.org/node-red-debugger/-/node-red-debugger-1.1.1.tgz","integrity":"sha512-sEfBRYZk+ptqCOkDURC1IxJ6lr1yhdGUctxwL13EmLknQSsOzTJzcI+/nWF1RSBZmsCw4R8+TE1Kx4TnjX2X/g==","time":1775352975936,"size":22123,"metadata":{"time":1775352975918,"url":"https://registry.npmjs.org/node-red-debugger/-/node-red-debugger-1.1.1.tgz","reqHeaders":{},"resHeaders":{"cache-control":"public, immutable, max-age=31557600","content-type":"application/octet-stream","date":"Sun, 05 Apr 2026 01:36:15 GMT","etag":"\"8d40a313fd218e46c3e4fe78121b9267\"","last-modified":"Wed, 21 Jul 2021 11:15:11 GMT","vary":"Accept-Encoding"},"options":{"compress":true}}} \ No newline at end of file diff --git a/monitoring/node-red/data/.npm/_cacache/index-v5/48/03/b8903b717bbc1ad41b3f37148db48f54e0828c1aef870973f6672895d689 b/monitoring/node-red/data/.npm/_cacache/index-v5/48/03/b8903b717bbc1ad41b3f37148db48f54e0828c1aef870973f6672895d689 new file mode 100644 index 0000000..8b8b812 --- /dev/null +++ b/monitoring/node-red/data/.npm/_cacache/index-v5/48/03/b8903b717bbc1ad41b3f37148db48f54e0828c1aef870973f6672895d689 @@ -0,0 +1,2 @@ + +aaa2f94f98f0490d343865ece4ec971006a4f1c3 {"key":"make-fetch-happen:request-cache:https://registry.npmjs.org/node-red-debugger","integrity":"sha512-wsK2SHDqXFpCtXchBvURI89oTTyDgd4QzMB9ARaNER0KGree4m/aMgswJ8ds/IVhGfe0QIRag8nyLX1zFkPmLw==","time":1775352975866,"size":15640,"metadata":{"time":1775352975857,"url":"https://registry.npmjs.org/node-red-debugger","reqHeaders":{"accept":"application/json"},"resHeaders":{"cache-control":"public, max-age=300","content-encoding":"gzip","content-type":"application/json","date":"Sun, 05 Apr 2026 01:36:15 GMT","etag":"W/\"907dbbf9d3078f923fc58d814f174384\"","last-modified":"Wed, 11 May 2022 04:22:14 GMT","vary":"accept-encoding, accept"},"options":{"compress":true}}} \ No newline at end of file diff --git a/monitoring/node-red/data/.npm/_logs/2026-04-05T01_36_15_515Z-debug-0.log b/monitoring/node-red/data/.npm/_logs/2026-04-05T01_36_15_515Z-debug-0.log new file mode 100644 index 0000000..9ef2dc8 --- /dev/null +++ b/monitoring/node-red/data/.npm/_logs/2026-04-05T01_36_15_515Z-debug-0.log @@ -0,0 +1,29 @@ +0 verbose cli /usr/local/bin/node /usr/local/bin/npm +1 info using npm@10.8.2 +2 info using node@v20.20.1 +3 silly config load:file:/usr/local/lib/node_modules/npm/npmrc +4 silly config load:file:/data/.npmrc +5 silly config load:file:/usr/src/node-red/.npmrc +6 silly config load:file:/usr/local/etc/npmrc +7 verbose title npm install node-red-debugger@1.1.1 +8 verbose argv "install" "--no-audit" "--no-update-notifier" "--no-fund" "--save" "--save-prefix" "~" "--omit" "dev" "--engine-strict" "node-red-debugger@1.1.1" +9 verbose logfile logs-max:10 dir:/data/.npm/_logs/2026-04-05T01_36_15_515Z- +10 verbose logfile /data/.npm/_logs/2026-04-05T01_36_15_515Z-debug-0.log +11 silly packumentCache heap:2111832064 maxSize:527958016 maxEntrySize:263979008 +12 silly logfile done cleaning log files +13 silly idealTree buildDeps +14 silly fetch manifest node-red-debugger@1.1.1 +15 silly packumentCache full:https://registry.npmjs.org/node-red-debugger cache-miss +16 http fetch GET 200 https://registry.npmjs.org/node-red-debugger 101ms (cache miss) +17 silly packumentCache full:https://registry.npmjs.org/node-red-debugger set size:undefined disposed:false +18 silly placeDep ROOT node-red-debugger@1.1.1 OK for: node-red-project@0.0.1 want: 1.1.1 +19 silly reify moves {} +20 silly tarball no local data for node-red-debugger@https://registry.npmjs.org/node-red-debugger/-/node-red-debugger-1.1.1.tgz. Extracting by manifest. +21 http fetch GET 200 https://registry.npmjs.org/node-red-debugger/-/node-red-debugger-1.1.1.tgz 55ms (cache miss) +22 silly ADD node_modules/node-red-debugger +23 verbose cwd /data +24 verbose os Linux 6.12.78 +25 verbose node v20.20.1 +26 verbose npm v10.8.2 +27 verbose exit 0 +28 info ok diff --git a/monitoring/node-red/data/context/00b02bbd01c91485/flow.json b/monitoring/node-red/data/context/00b02bbd01c91485/flow.json new file mode 100644 index 0000000..95144d6 --- /dev/null +++ b/monitoring/node-red/data/context/00b02bbd01c91485/flow.json @@ -0,0 +1,44 @@ +{ + "dockerUpdateAttempts": { + "node-exporter|prom/node-exporter:latest|docker": { + "time": 1775631942178, + "status": "started" + }, + "prometheus|prom/prometheus:latest|docker": { + "time": 1775631942180, + "status": "started" + }, + "nextcloud-redis|redis:latest|docker": { + "time": 1775631942186, + "status": "started" + }, + "searxng-webapp|searxng/searxng:latest|docker": { + "time": 1775631942187, + "status": "started" + }, + "traefik|traefik:3|docker": { + "time": 1775631942188, + "status": "started" + }, + "traefik|unknown|raspi": { + "time": 1775631942191, + "status": "started" + }, + "telegraf|unknown|raspi": { + "time": 1775763342447, + "status": "started" + }, + "authelia|authelia/authelia:latest|docker": { + "time": 1775804742531, + "status": "started" + }, + "passbolt-webapp|passbolt/passbolt:latest-ce|docker": { + "time": 1775804742539, + "status": "started" + }, + "gramps-web|ghcr.io/gramps-project/grampsweb:latest|docker": { + "time": 1775891142715, + "status": "started" + } + } +} \ No newline at end of file diff --git a/monitoring/node-red/data/context/global/global.json b/monitoring/node-red/data/context/global/global.json new file mode 100644 index 0000000..2e883c9 --- /dev/null +++ b/monitoring/node-red/data/context/global/global.json @@ -0,0 +1,3 @@ +{ + "dockerUpdateAttempts": {} +} \ No newline at end of file diff --git a/monitoring/node-red/data/flows.json b/monitoring/node-red/data/flows.json new file mode 100644 index 0000000..4f2577c --- /dev/null +++ b/monitoring/node-red/data/flows.json @@ -0,0 +1,1122 @@ +[ + { + "id": "00b02bbd01c91485", + "type": "tab", + "label": "Grafana Docker Safe Update", + "disabled": false, + "info": "" + }, + { + "id": "f16653fb4cb05bbe", + "type": "tab", + "label": "Health Check", + "disabled": false, + "info": "", + "env": [] + }, + { + "id": "d0f45d2b6f117365", + "type": "tab", + "label": "uptime-kuma alerts", + "disabled": false, + "info": "", + "env": [] + }, + { + "id": "c5240b64a962ea54", + "type": "tab", + "label": "Gotify Messages", + "disabled": false, + "info": "", + "env": [] + }, + { + "id": "22f648a14d2e8fae", + "type": "inject", + "z": "00b02bbd01c91485", + "name": "Test Alert", + "props": [ + { + "p": "payload" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": "", + "topic": "", + "payload": "{\"receiver\":\"node-red\",\"status\":\"firing\",\"alerts\":[{\"status\":\"firing\",\"labels\":{\"Active\":\"telegraf: 0 updates\",\"Restored\":\"telegraf: 0 updates\",\"alertname\":\"Updates\",\"com_docker_compose_project\":\"core\",\"compose_image\":\"telegraf:latest\",\"container\":\"telegraf\",\"grafana_folder\":\"Infrastructure\",\"job\":\"container-updates\",\"running_image\":\"telegraf:latest\"},\"annotations\":{},\"startsAt\":\"2026-03-31T01:16:10Z\",\"endsAt\":\"0001-01-01T00:00:00Z\",\"generatorURL\":\"https://grafana.lan.ddnsgeek.com/alerting/grafana/bfgysfo3iregwf/view?orgId=1\",\"fingerprint\":\"49b1e1dbf1255191\",\"silenceURL\":\"https://grafana.lan.ddnsgeek.com/alerting/silence/new?alertmanager=grafana&matcher=__alert_rule_uid__%3Dbfgysfo3iregwf&matcher=Active%3Dtelegraf%3A+0+updates&matcher=Restored%3Dtelegraf%3A+0+updates&matcher=com_docker_compose_project%3Dcore&matcher=compose_image%3Dtelegraf%3Alatest&matcher=container%3Dtelegraf&matcher=job%3Dcontainer-updates&matcher=running_image%3Dtelegraf%3Alatest&orgId=1\",\"dashboardURL\":\"https://grafana.lan.ddnsgeek.com/d/ad895wr?from=1774916170000&orgId=1&to=1774926701171\",\"panelURL\":\"https://grafana.lan.ddnsgeek.com/d/ad895wr?from=1774916170000&orgId=1&to=1774926701171&viewPanel=6\",\"ruleUID\":\"bfgysfo3iregwf\",\"values\":{\"A\":1,\"D\":1},\"valueString\":\"[ var='A' labels={com_docker_compose_project=core, compose_image=telegraf:latest, container=telegraf, job=container-updates, running_image=telegraf:latest} type='query' value=1 ], [ var='D' labels={com_docker_compose_project=core, compose_image=telegraf:latest, container=telegraf, job=container-updates, running_image=telegraf:latest} type='threshold' value=1 ]\",\"orgId\":1},{\"status\":\"firing\",\"labels\":{\"Active\":\"update-test: 0 updates\",\"Restored\":\"update-test: 0 updates\",\"alertname\":\"Updates\",\"com_docker_compose_project\":\"core\",\"compose_image\":\"nginx:1.27.1\",\"container\":\"update-test\",\"grafana_folder\":\"Infrastructure\",\"job\":\"container-updates\",\"running_image\":\"nginx:1.27.0\"},\"annotations\":{},\"startsAt\":\"2026-03-31T01:15:10Z\",\"endsAt\":\"0001-01-01T00:00:00Z\",\"generatorURL\":\"https://grafana.lan.ddnsgeek.com/alerting/grafana/bfgysfo3iregwf/view?orgId=1\",\"fingerprint\":\"c56bd9f28943cfac\",\"silenceURL\":\"https://grafana.lan.ddnsgeek.com/alerting/silence/new?alertmanager=grafana&matcher=__alert_rule_uid__%3Dbfgysfo3iregwf&matcher=Active%3Dupdate-test%3A+0+updates&matcher=Restored%3Dupdate-test%3A+0+updates&matcher=com_docker_compose_project%3Dcore&matcher=compose_image%3Dnginx%3A1.27.1&matcher=container%3Dupdate-test&matcher=job%3Dcontainer-updates&matcher=running_image%3Dnginx%3A1.27.0&orgId=1\",\"dashboardURL\":\"https://grafana.lan.ddnsgeek.com/d/ad895wr?from=1774916110000&orgId=1&to=1774926701171\",\"panelURL\":\"https://grafana.lan.ddnsgeek.com/d/ad895wr?from=1774916110000&orgId=1&to=1774926701171&viewPanel=6\",\"ruleUID\":\"bfgysfo3iregwf\",\"values\":{\"A\":1,\"D\":1},\"valueString\":\"[ var='A' labels={com_docker_compose_project=core, compose_image=nginx:1.27.1, container=update-test, job=container-updates, running_image=nginx:1.27.0} type='query' value=1 ], [ var='D' labels={com_docker_compose_project=core, compose_image=nginx:1.27.1, container=update-test, job=container-updates, running_image=nginx:1.27.0} type='threshold' value=1 ]\",\"orgId\":1}],\"groupLabels\":{\"alertname\":\"Updates\",\"grafana_folder\":\"Infrastructure\"},\"commonLabels\":{\"alertname\":\"Updates\",\"com_docker_compose_project\":\"core\",\"grafana_folder\":\"Infrastructure\",\"job\":\"container-updates\"},\"commonAnnotations\":{},\"externalURL\":\"https://grafana.lan.ddnsgeek.com/\",\"appVersion\":\"12.4.2\",\"version\":\"1\",\"groupKey\":\"{}/{__grafana_autogenerated__=\\\"true\\\"}/{__grafana_receiver__=\\\"node-red\\\"}/{__grafana_route_settings_hash__=\\\"f177b219cbbdd2e2\\\"}:{alertname=\\\"Updates\\\", grafana_folder=\\\"Infrastructure\\\"}\",\"truncatedAlerts\":0,\"orgId\":1,\"title\":\"[FIRING:2] Updates Infrastructure (core container-updates)\",\"state\":\"alerting\",\"message\":\"**Firing**\\n\\nValue: A=1, D=1\\nLabels:\\n - alertname = Updates\\n - Active = telegraf: 0 updates\\n - Restored = telegraf: 0 updates\\n - com_docker_compose_project = core\\n - compose_image = telegraf:latest\\n - container = telegraf\\n - grafana_folder = Infrastructure\\n - job = container-updates\\n - running_image = telegraf:latest\\nAnnotations:\\nSource: https://grafana.lan.ddnsgeek.com/alerting/grafana/bfgysfo3iregwf/view?orgId=1\\nSilence: https://grafana.lan.ddnsgeek.com/alerting/silence/new?alertmanager=grafana&matcher=__alert_rule_uid__%3Dbfgysfo3iregwf&matcher=Active%3Dtelegraf%3A+0+updates&matcher=Restored%3Dtelegraf%3A+0+updates&matcher=com_docker_compose_project%3Dcore&matcher=compose_image%3Dtelegraf%3Alatest&matcher=container%3Dtelegraf&matcher=job%3Dcontainer-updates&matcher=running_image%3Dtelegraf%3Alatest&orgId=1\\nDashboard: https://grafana.lan.ddnsgeek.com/d/ad895wr?from=1774916170000&orgId=1&to=1774926701171\\nPanel: https://grafana.lan.ddnsgeek.com/d/ad895wr?from=1774916170000&orgId=1&to=1774926701171&viewPanel=6\\n\\nValue: A=1, D=1\\nLabels:\\n - alertname = Updates\\n - Active = update-test: 0 updates\\n - Restored = update-test: 0 updates\\n - com_docker_compose_project = core\\n - compose_image = nginx:1.27.1\\n - container = update-test\\n - grafana_folder = Infrastructure\\n - job = container-updates\\n - running_image = nginx:1.27.0\\nAnnotations:\\nSource: https://grafana.lan.ddnsgeek.com/alerting/grafana/bfgysfo3iregwf/view?orgId=1\\nSilence: https://grafana.lan.ddnsgeek.com/alerting/silence/new?alertmanager=grafana&matcher=__alert_rule_uid__%3Dbfgysfo3iregwf&matcher=Active%3Dupdate-test%3A+0+updates&matcher=Restored%3Dupdate-test%3A+0+updates&matcher=com_docker_compose_project%3Dcore&matcher=compose_image%3Dnginx%3A1.27.1&matcher=container%3Dupdate-test&matcher=job%3Dcontainer-updates&matcher=running_image%3Dnginx%3A1.27.0&orgId=1\\nDashboard: https://grafana.lan.ddnsgeek.com/d/ad895wr?from=1774916110000&orgId=1&to=1774926701171\\nPanel: https://grafana.lan.ddnsgeek.com/d/ad895wr?from=1774916110000&orgId=1&to=1774926701171&viewPanel=6\\n\"}", + "payloadType": "json", + "x": 140, + "y": 100, + "wires": [ + [ + "671243b648c669fe" + ] + ] + }, + { + "id": "17eef927bdc12e54", + "type": "function", + "z": "00b02bbd01c91485", + "name": "Create Pull Command", + "func": "const labels = msg.payload.alerts.labels || {};\nconst container = labels.container;\nconst image = labels.compose_image || labels.running_image || labels.image;\nconst project = labels.com_docker_compose_project\n\nif (project == \"core\") {\n var host = \"docker\"\n}\nelse {\n host = \"raspi\"\n}\n\nif (!container) {\n node.warn(\"No container found in alert labels\");\n return null; // skip this alert\n}\n\nmsg.payload = `/compose/${host}/services-up.sh --profile all pull -q ${container}`;\nmsg.container = container;\nmsg.image = image;\nmsg.host = host;\nnode.log(`New docker update available\n Container: ${container}\n Image: ${image}\n Host: ${host}`)\nreturn msg;", + "outputs": 1, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 1300, + "y": 80, + "wires": [ + [ + "e92429c3061966f7" + ] + ] + }, + { + "id": "e92429c3061966f7", + "type": "exec", + "z": "00b02bbd01c91485", + "command": "", + "addpay": "payload", + "append": "", + "useSpawn": "false", + "timer": "", + "winHide": false, + "oldrc": false, + "name": "Pull Image", + "x": 1510, + "y": 80, + "wires": [ + [ + "5c36c5b0e44d7cb0" + ], + [ + "5c36c5b0e44d7cb0" + ], + [ + "3af6aa9cbaad6ff9" + ] + ] + }, + { + "id": "b8a933687445fb13", + "type": "exec", + "z": "00b02bbd01c91485", + "command": "", + "addpay": "payload", + "append": "", + "useSpawn": "false", + "timer": "70", + "winHide": false, + "oldrc": true, + "name": "Test New Image", + "x": 2160, + "y": 80, + "wires": [ + [ + "40e040d2b58bbaa1", + "4c182d7a643805cd" + ], + [ + "4c182d7a643805cd" + ], + [] + ] + }, + { + "id": "40e040d2b58bbaa1", + "type": "switch", + "z": "00b02bbd01c91485", + "name": "Check Test Result", + "property": "payload", + "propertyType": "msg", + "rules": [ + { + "t": "cont", + "v": "0", + "vt": "str" + }, + { + "t": "else" + } + ], + "checkall": "true", + "repair": false, + "outputs": 2, + "x": 2370, + "y": 80, + "wires": [ + [ + "da5d95a30589805c" + ], + [ + "47ac22574893de41" + ] + ] + }, + { + "id": "ab2063f9180cd1aa", + "type": "exec", + "z": "00b02bbd01c91485", + "command": "", + "addpay": "payload", + "append": "", + "useSpawn": "false", + "timer": "", + "winHide": false, + "oldrc": true, + "name": "Deploy Production Container", + "x": 2960, + "y": 80, + "wires": [ + [ + "32e3684b63a6f13e" + ], + [ + "e8e4151333935b78", + "32e3684b63a6f13e" + ], + [] + ] + }, + { + "id": "a4c73e8e3e87fab7", + "type": "http in", + "z": "00b02bbd01c91485", + "name": "Grafana Webhook", + "url": "/grafana-update", + "method": "post", + "upload": false, + "skipBodyParsing": false, + "swaggerDoc": "", + "x": 110, + "y": 60, + "wires": [ + [ + "671243b648c669fe" + ] + ] + }, + { + "id": "3af6aa9cbaad6ff9", + "type": "switch", + "z": "00b02bbd01c91485", + "name": "image pulled OK?", + "property": "payload.code", + "propertyType": "msg", + "rules": [ + { + "t": "eq", + "v": "0", + "vt": "num" + }, + { + "t": "else" + } + ], + "checkall": "true", + "repair": false, + "outputs": 2, + "x": 1710, + "y": 80, + "wires": [ + [ + "96c81501330c20e3" + ], + [ + "1de1d1befec88aa4" + ] + ] + }, + { + "id": "96c81501330c20e3", + "type": "function", + "z": "00b02bbd01c91485", + "name": "Build Test Command", + "func": "const container = msg.container;\nconst image = msg.image;\nconst host = msg.host;\nmsg.payload = `/data/test-container.sh ${container} ${host}`;\nmsg.image = image;\nmsg.container = container;\nmsg.host = host\nnode.log(`Pull Successful\n Container: ${container}\n Image: ${msg.image}\n Host: ${host}`\n )\nreturn msg;", + "outputs": 1, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 1940, + "y": 80, + "wires": [ + [ + "b8a933687445fb13" + ] + ] + }, + { + "id": "95e72a493b5b736c", + "type": "split", + "z": "00b02bbd01c91485", + "name": "", + "splt": "\\n", + "spltType": "str", + "arraySplt": 1, + "arraySpltType": "len", + "stream": true, + "addname": "", + "property": "payload.alerts", + "x": 610, + "y": 80, + "wires": [ + [ + "298528baa0f776b4" + ] + ] + }, + { + "id": "da5d95a30589805c", + "type": "function", + "z": "00b02bbd01c91485", + "name": "Build Deploy Command", + "func": "const container = msg.container;\nconst image = msg.image;\nconst host = msg.host;\nmsg.payload = `/compose/${host}/services-up.sh --profile all up -d ${container}`;\nmsg.image = image;\nmsg.container = container;\nmsg.host = host;\nnode.log(`Test Successful\n Container: ${container}\n Image: ${msg.image}\n Host: ${host}`\n )\nreturn msg;", + "outputs": 1, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 2670, + "y": 80, + "wires": [ + [ + "ab2063f9180cd1aa" + ] + ] + }, + { + "id": "27ac6d1d2b208f99", + "type": "link out", + "z": "00b02bbd01c91485", + "name": "Docker image pull fail", + "mode": "link", + "links": [ + "ba2c4e239d3b1e1d" + ], + "x": 2095, + "y": 140, + "wires": [] + }, + { + "id": "49c52031d95c0638", + "type": "link out", + "z": "00b02bbd01c91485", + "name": "Docker image test fail", + "mode": "link", + "links": [ + "10718f4768834442" + ], + "x": 2795, + "y": 140, + "wires": [] + }, + { + "id": "b083fcf71669254e", + "type": "link out", + "z": "00b02bbd01c91485", + "name": "Docker update success", + "mode": "link", + "links": [ + "f5771c9cc8e81779" + ], + "x": 3415, + "y": 80, + "wires": [] + }, + { + "id": "671243b648c669fe", + "type": "function", + "z": "00b02bbd01c91485", + "name": "WEBHOOK /grafana-update IN", + "func": "node.log(\n \"Payload:\\n\" +\n JSON.stringify(msg.payload, null, 2)\n);\nreturn msg;", + "outputs": 1, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 390, + "y": 80, + "wires": [ + [ + "95e72a493b5b736c" + ] + ] + }, + { + "id": "e8e4151333935b78", + "type": "function", + "z": "00b02bbd01c91485", + "name": "Deployment Success", + "func": "const attempts = flow.get(\"dockerUpdateAttempts\") || {};\n\nif (msg.updateKey && attempts[msg.updateKey]) {\n delete attempts[msg.updateKey];\n flow.set(\"dockerUpdateAttempts\", attempts);\n}\nnode.log(`Deployment Successful\n Container: ${msg.container}\n Image: ${msg.image}\n Host: ${msg.host}\n`);\n\nreturn msg;", + "outputs": 1, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 3240, + "y": 80, + "wires": [ + [ + "b083fcf71669254e" + ] + ] + }, + { + "id": "1de1d1befec88aa4", + "type": "function", + "z": "00b02bbd01c91485", + "name": "Pull Image Failed", + "func": "const labels = msg.payload.alerts.labels || {};\nconst container = labels.container;\nconst host = msg.host\nconst image = labels.compose_image || labels.running_image || labels.image;\n\nlet attempts = flow.get(\"dockerUpdateAttempts\") || {};\n\nif (msg.updateKey && attempts[msg.updateKey]) {\n const firstFailure = !attempts[msg.updateKey].notified;\n\n attempts[msg.updateKey].status = \"test_failed\";\n attempts[msg.updateKey].failedAt = Date.now();\n\n if (firstFailure) {\n attempts[msg.updateKey].notified = true;\n\n msg.notification = {\n title: `Docker update locked out: ${msg.container}`,\n message:\n `Automatic update for ${msg.container} failed.\\n\n Image: ${msg.image}\n Host: ${msg.host}\n Result: ${attempts[msg.updateKey].status}\\n\n Further Grafana alerts for this update will be ignored until manual intervention.`\n };\n\n flow.set(\"dockerUpdateAttempts\", attempts);\n\n // send to 2 outputs:\n // output 1 = existing failure handling\n // output 2 = notification flow\n return [msg, msg];\n }\n\n flow.set(\"dockerUpdateAttempts\", attempts);\n}\n\nnode.log(`Pull image failed\n Command: ${msg.payload}\n Container: ${container}\n Image: ${image}\n Host: ${host}`)\nreturn [msg, null];", + "outputs": 2, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 1930, + "y": 140, + "wires": [ + [ + "27ac6d1d2b208f99" + ], + [ + "0e6520dfb81a951b" + ] + ] + }, + { + "id": "47ac22574893de41", + "type": "function", + "z": "00b02bbd01c91485", + "name": "Test Image Failed", + "func": "//const labels = msg.payload.alerts.labels || {};\n//const container = labels.container;\nconst host = msg.host;\n//const image = labels.compose_image || labels.running_image || labels.image;\n\nlet attempts = flow.get(\"dockerUpdateAttempts\") || {};\n\nif (msg.updateKey && attempts[msg.updateKey]) {\n const firstFailure = !attempts[msg.updateKey].notified;\n\n attempts[msg.updateKey].status = \"test_failed\";\n attempts[msg.updateKey].failedAt = Date.now();\n\n if (firstFailure) {\n attempts[msg.updateKey].notified = true;\n\n msg.notification = {\n title: `Docker update locked out: ${msg.container}`,\n message:\n `Automatic update for ${msg.container} failed.\\n\n Image: ${msg.image}\n Host: ${msg.host}\n Result: ${attempts[msg.updateKey].status}\\n\n Further Grafana alerts for this update will be ignored until manual intervention.`\n };\n\n flow.set(\"dockerUpdateAttempts\", attempts);\n\n // send to 2 outputs:\n // output 1 = existing failure handling\n // output 2 = notification flow\n return [msg, msg];\n }\n\n flow.set(\"dockerUpdateAttempts\", attempts);\n}\n\nnode.log(`Test image failed\\n\n Command: ${msg.payload}\\n\n Container: ${msg.container}\\n\n Image: ${msg.image}\\n\n Host: ${host}`)\nreturn [msg, null];", + "outputs": 2, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 2650, + "y": 140, + "wires": [ + [ + "49c52031d95c0638" + ], + [ + "77675958f77d2d5f" + ] + ] + }, + { + "id": "298528baa0f776b4", + "type": "switch", + "z": "00b02bbd01c91485", + "name": "docker project name", + "property": "payload.alerts.labels.com_docker_compose_project", + "propertyType": "msg", + "rules": [ + { + "t": "eq", + "v": "core", + "vt": "str" + }, + { + "t": "eq", + "v": "raspi", + "vt": "str" + }, + { + "t": "else" + } + ], + "checkall": "true", + "repair": false, + "outputs": 3, + "x": 800, + "y": 80, + "wires": [ + [ + "bad4d106425b7dd2" + ], + [ + "bad4d106425b7dd2" + ], + [ + "1ab4069c08a68fa3" + ] + ] + }, + { + "id": "1ab4069c08a68fa3", + "type": "function", + "z": "00b02bbd01c91485", + "name": "Unknown Project", + "func": "const labels = msg.payload.alerts.labels || {};\nconst container = labels.container;\nconst image = labels.compose_image || labels.running_image || labels.image;\nconst project = labels.com_docker_compose_project\n\nnode.warn(`Unable to map project name ${project} to host.\\n\n Updates for ${container} failed`)\nreturn msg;", + "outputs": 1, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 1290, + "y": 200, + "wires": [ + [ + "852d039f540dd0d3" + ] + ] + }, + { + "id": "852d039f540dd0d3", + "type": "link out", + "z": "00b02bbd01c91485", + "name": "Docker updates fail unknown", + "mode": "link", + "links": [ + "7c62509d505c281b" + ], + "x": 1455, + "y": 200, + "wires": [] + }, + { + "id": "f4b91e278109e661", + "type": "function", + "z": "00b02bbd01c91485", + "name": "Repeat update Suppresed", + "func": "node.warn(\n `${msg.payload.alerts.labels.container} ` +\n `(${msg.payload.alerts.labels.compose_image})`\n);\nreturn msg;", + "outputs": 1, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 1310, + "y": 140, + "wires": [ + [] + ] + }, + { + "id": "5c36c5b0e44d7cb0", + "type": "function", + "z": "00b02bbd01c91485", + "name": "Logging", + "func": "//const labels = msg.payload.alerts.labels || {};\n//const container = labels.container;\n//const image = labels.compose_image || labels.running_image || labels.image;\n\nif (msg.payload != \"\") {\n node.log(msg.payload)\n}\nreturn msg;", + "outputs": 1, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 1680, + "y": 40, + "wires": [ + [] + ] + }, + { + "id": "4c182d7a643805cd", + "type": "function", + "z": "00b02bbd01c91485", + "name": "Logging", + "func": "//const labels = msg.payload.alerts.labels || {};\n//const container = labels.container;\n//const image = labels.compose_image || labels.running_image || labels.image;\nif (msg.payload != \"\") {\n node.log(msg.payload)\n}\nreturn msg;", + "outputs": 1, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 2340, + "y": 40, + "wires": [ + [] + ] + }, + { + "id": "32e3684b63a6f13e", + "type": "function", + "z": "00b02bbd01c91485", + "name": "Logging", + "func": "//const labels = msg.payload.alerts.labels || {};\n//const container = labels.container;\n//const image = labels.compose_image || labels.running_image || labels.image;\nif (msg.payload != \"\") {\n node.log(msg.payload)\n}\nreturn msg;", + "outputs": 1, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 3200, + "y": 40, + "wires": [ + [] + ] + }, + { + "id": "bad4d106425b7dd2", + "type": "function", + "z": "00b02bbd01c91485", + "name": "Check Already Attempted", + "func": "const labels = msg.payload.alerts.labels || {};\n\nconst container = labels.container;\nconst image = labels.compose_image || labels.running_image || labels.image;\nconst project = labels.com_docker_compose_project\n\n// Load persistent attempt registry\nlet attempts = flow.get(\"dockerUpdateAttempts\") || {};\n\nif (project == \"core\") {\n var host = \"docker\"\n}\nelse {\n host = \"raspi\"\n}\n\n// Unique key for this exact update attempt\nconst key = `${container}|${image}|${host}`;\n\n// If we've already tried this image for this container, suppress it\nif (attempts[key]) {\n node.warn(\n `Ignoring repeated update alert for ${container} -> ${image}. ` +\n `Already attempted at ${new Date(attempts[key].time).toISOString()}`\n );\n\n msg.suppressed = true;\n msg.updateKey = key;\n msg.attemptInfo = attempts[key];\n\n // output 1 = continue flow\n // output 2 = suppressed repeat\n return [null, msg];\n}\n\n// First time we've seen this update, record it immediately\nattempts[key] = {\n time: Date.now(),\n status: \"started\"\n};\n\nflow.set(\"dockerUpdateAttempts\", attempts);\n\nmsg.updateKey = key;\n\nnode.log(`First attempt for ${container} -> ${image}`);\n\n// continue normal flow\nreturn [msg, null];", + "outputs": 2, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 1050, + "y": 80, + "wires": [ + [ + "17eef927bdc12e54" + ], + [ + "f4b91e278109e661" + ] + ] + }, + { + "id": "0e6520dfb81a951b", + "type": "link out", + "z": "00b02bbd01c91485", + "name": "Docker image update locked", + "mode": "link", + "links": [ + "b72f58c8b6d6d265" + ], + "x": 2095, + "y": 200, + "wires": [] + }, + { + "id": "77675958f77d2d5f", + "type": "link out", + "z": "00b02bbd01c91485", + "name": "Docker image update locked", + "mode": "link", + "links": [ + "b72f58c8b6d6d265" + ], + "x": 2795, + "y": 200, + "wires": [] + }, + { + "id": "8c74f9646c655f07", + "type": "http in", + "z": "00b02bbd01c91485", + "name": "/docker-update-lockouts in", + "url": "/docker-update-lockouts", + "method": "get", + "upload": false, + "skipBodyParsing": false, + "swaggerDoc": "", + "x": 250, + "y": 340, + "wires": [ + [ + "bf13590833ea0288" + ] + ] + }, + { + "id": "bf13590833ea0288", + "type": "function", + "z": "00b02bbd01c91485", + "name": "get docker update lockouts", + "func": "const attempts = flow.get(\"dockerUpdateAttempts\") || {};\n\nconst output = Object.entries(attempts).map(([key, value]) => ({\n key,\n status: value.status,\n firstAttempt: new Date(value.time).toISOString(),\n failedAt: value.failedAt\n ? new Date(value.failedAt).toISOString()\n : null,\n notified: !!value.notified\n}));\n\nmsg.payload = output;\nnode.log(JSON.stringify(msg.payload, null, 2));\nreturn msg;", + "outputs": 1, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 540, + "y": 340, + "wires": [ + [ + "2fc3cf8f165b7537" + ] + ] + }, + { + "id": "2fc3cf8f165b7537", + "type": "http response", + "z": "00b02bbd01c91485", + "name": "", + "statusCode": "", + "headers": {}, + "x": 770, + "y": 340, + "wires": [] + }, + { + "id": "81f6db49f4ad354a", + "type": "http in", + "z": "00b02bbd01c91485", + "name": "clear lockout", + "url": "/docker-update-lockouts/clear", + "method": "post", + "upload": false, + "skipBodyParsing": false, + "swaggerDoc": "", + "x": 210, + "y": 480, + "wires": [ + [ + "28d736c3d3a4cf14" + ] + ] + }, + { + "id": "7bae4cc1bd52dfd8", + "type": "http response", + "z": "00b02bbd01c91485", + "name": "", + "statusCode": "", + "headers": {}, + "x": 770, + "y": 480, + "wires": [] + }, + { + "id": "28d736c3d3a4cf14", + "type": "function", + "z": "00b02bbd01c91485", + "name": "Clear lockout", + "func": "let attempts = flow.get(\"dockerUpdateAttempts\") || {};\nconst key = (msg.payload.key || \"\").trim(); // trim whitespace\n\n// optionally log all keys for debugging\nnode.log(\"Available keys: \" + Object.keys(attempts).join(\", \"));\nnode.log(\"Requested key: '\" + key + \"'\");\n\nif (key in attempts) { // use 'in' to avoid false negatives\n delete attempts[key];\n flow.set(\"dockerUpdateAttempts\", attempts);\n\n msg.payload = { success: true, cleared: key };\n node.log(`Cleared update lock for ${key}`);\n} else {\n msg.payload = { success: false, error: `No lock found for '${key}'` };\n}\nreturn msg;", + "outputs": 1, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 490, + "y": 480, + "wires": [ + [ + "7bae4cc1bd52dfd8" + ] + ] + }, + { + "id": "b113615f19bd2588", + "type": "http in", + "z": "f16653fb4cb05bbe", + "name": "/health in", + "url": "/health", + "method": "get", + "upload": false, + "skipBodyParsing": false, + "swaggerDoc": "", + "x": 380, + "y": 220, + "wires": [ + [ + "4bf7d7901301ce7e" + ] + ] + }, + { + "id": "4bf7d7901301ce7e", + "type": "function", + "z": "f16653fb4cb05bbe", + "name": "health check", + "func": "msg.payload = { status: \"ok\" };\nmsg.headers = { \"Content-Type\": \"application/json\" };\nnode.log(msg.payload.status);\nreturn msg;", + "outputs": 1, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 670, + "y": 220, + "wires": [ + [ + "269da1ef164eeb72" + ] + ] + }, + { + "id": "269da1ef164eeb72", + "type": "http response", + "z": "f16653fb4cb05bbe", + "name": "", + "statusCode": "", + "headers": {}, + "x": 950, + "y": 220, + "wires": [] + }, + { + "id": "40ed22bfb88a0d78", + "type": "http in", + "z": "d0f45d2b6f117365", + "name": "/uptime-kuma in", + "url": "/uptime-kuma", + "method": "post", + "upload": false, + "skipBodyParsing": false, + "swaggerDoc": "", + "x": 320, + "y": 200, + "wires": [ + [ + "46affc0319a44fa9", + "ab7d36db8e9316f8" + ] + ] + }, + { + "id": "4e0b1edf6f60d701", + "type": "http response", + "z": "d0f45d2b6f117365", + "name": "response", + "statusCode": "", + "headers": {}, + "x": 860, + "y": 200, + "wires": [] + }, + { + "id": "46affc0319a44fa9", + "type": "link out", + "z": "d0f45d2b6f117365", + "name": "gotify domain name alerts", + "mode": "link", + "links": [ + "bed17b50dd678228" + ], + "x": 615, + "y": 120, + "wires": [] + }, + { + "id": "ab7d36db8e9316f8", + "type": "function", + "z": "d0f45d2b6f117365", + "name": "WEBHOOK /uptime-kuma IN", + "func": "node.log(\n \"Payload:\\n\" +\n JSON.stringify(msg.payload, null, 2)\n);\nreturn msg;", + "outputs": 1, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 620, + "y": 200, + "wires": [ + [ + "4e0b1edf6f60d701" + ] + ] + }, + { + "id": "0301a3cebd1eb23f", + "type": "http request", + "z": "c5240b64a962ea54", + "name": "Send to gotify", + "method": "POST", + "ret": "obj", + "paytoqs": "ignore", + "url": "https://gotify.lan.ddnsgeek.com/message?token=ATSMpSKrdNjKXeT", + "tls": "", + "persist": false, + "proxy": "", + "insecureHTTPParser": false, + "authType": "", + "senderr": false, + "headers": [ + { + "keyType": "other", + "keyValue": "Content-Type", + "valueType": "other", + "valueValue": "application/json" + } + ], + "x": 1300, + "y": 280, + "wires": [ + [] + ] + }, + { + "id": "bed17b50dd678228", + "type": "link in", + "z": "c5240b64a962ea54", + "name": "Doman name alerts", + "links": [ + "46affc0319a44fa9" + ], + "x": 275, + "y": 100, + "wires": [ + [ + "6e58de21ded7459e" + ] + ] + }, + { + "id": "6e58de21ded7459e", + "type": "function", + "z": "c5240b64a962ea54", + "name": "Domain name alerts", + "func": "const name = msg.payload.monitor.name;\nconst hb = msg.payload.heartbeat;\n\nconst isUp = hb.status === 1;\n\nconst icon = isUp ? \"✅\" : \"🔴\";\nconst state = isUp ? \"UP\" : \"DOWN\";\n\n// Build a short title for the Gotify notification\nconst title = `${icon} ${name} is ${state}`;\nconst time = hb.localDateTime.split(\" \")[1].split(\":\").slice(0, 2).join(\":\");\n// Build a more detailed message\nlet message = `${icon} Monitor: ${name}\\n`;\nmessage += `Status: ${state}\\n`;\nmessage += `Time: ${time}\\n`;\nmessage += `Details: ${hb.msg}`;\n\nif (hb.ping !== undefined) {\n message += `\\nPing: ${hb.ping} ms`;\n}\n\nif (hb.duration !== undefined) {\n message += `\\nCheck Interval: ${hb.duration} sec`;\n}\n\n// Higher priority for down alerts\nmsg.payload = {\n title: title,\n message: message,\n priority: isUp ? 5 : 8\n};\n\nreturn msg;", + "outputs": 1, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 500, + "y": 100, + "wires": [ + [ + "8630c7dfcdbcce50" + ] + ] + }, + { + "id": "8630c7dfcdbcce50", + "type": "function", + "z": "c5240b64a962ea54", + "name": "GOTIFY alert OUT", + "func": "node.log(JSON.stringify(msg.payload, null, 2));\nreturn msg;", + "outputs": 1, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 1070, + "y": 280, + "wires": [ + [ + "0301a3cebd1eb23f" + ] + ] + }, + { + "id": "0135d283b9edfb01", + "type": "function", + "z": "c5240b64a962ea54", + "name": "Docker Pull Failed", + "func": "const container = msg.container || \"unknown container\";\nconst code = msg.payload.code;\nconst stderr = flow.get(\"pull_stderr\") || \"Unknown error\";\n\nmsg.payload = {\n title: \"Docker Update Failed\",\n message: `Pull failed for ${container}\\n${stderr}`,\n priority: 8\n};\n\nreturn msg;", + "outputs": 1, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 490, + "y": 200, + "wires": [ + [ + "8630c7dfcdbcce50" + ] + ] + }, + { + "id": "ba2c4e239d3b1e1d", + "type": "link in", + "z": "c5240b64a962ea54", + "name": "Docker pull failed alerts", + "links": [ + "27ac6d1d2b208f99" + ], + "x": 275, + "y": 200, + "wires": [ + [ + "0135d283b9edfb01" + ] + ] + }, + { + "id": "4eafade32c867e40", + "type": "function", + "z": "c5240b64a962ea54", + "name": "Docker test failed", + "func": "const container = msg.container || \"unknown container\";\nconst code = msg.payload.code;\nconst stderr = flow.get(\"pull_stderr\") || \"Unknown error\";\n\nmsg.payload = {\n title: \"Testing Failed\",\n message: `Testing failed for ${container}`,\n priority: 8\n};\n\nreturn msg;", + "outputs": 1, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 490, + "y": 300, + "wires": [ + [ + "8630c7dfcdbcce50" + ] + ] + }, + { + "id": "10718f4768834442", + "type": "link in", + "z": "c5240b64a962ea54", + "name": "Docker test failed alerts", + "links": [ + "49c52031d95c0638" + ], + "x": 275, + "y": 300, + "wires": [ + [ + "4eafade32c867e40" + ] + ] + }, + { + "id": "7d8200040f9b1e83", + "type": "function", + "z": "c5240b64a962ea54", + "name": "Docker update success", + "func": "const container = msg.container || \"unknown container\";\nconst code = msg.payload.code;\nconst stderr = flow.get(\"pull_stderr\") || \"Unknown error\";\n\nmsg.payload = {\n title: \"Container Updated\",\n message: `Container: ${container}\n Host: ${msg.host}`,\n priority: 8\n};\n\nreturn msg;", + "outputs": 1, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 490, + "y": 380, + "wires": [ + [ + "8630c7dfcdbcce50" + ] + ] + }, + { + "id": "f5771c9cc8e81779", + "type": "link in", + "z": "c5240b64a962ea54", + "name": "Docker update success alerts", + "links": [ + "b083fcf71669254e" + ], + "x": 275, + "y": 380, + "wires": [ + [ + "7d8200040f9b1e83" + ] + ] + }, + { + "id": "c3d07241f4a570af", + "type": "function", + "z": "c5240b64a962ea54", + "name": "Docker updates Unknown Project", + "func": "const container = msg.container || \"unknown container\";\nconst code = msg.payload.code;\nconst stderr = flow.get(\"pull_stderr\") || \"Unknown error\";\nconst project = msg.payload.labels.com_docker_compose_project\nmsg.payload = {\n title: \"Container Updates Failed\",\n message: `The ${container} container has failed.\\n\n Unknown project ${project}`,\n priority: 8\n};\n\nreturn msg;", + "outputs": 1, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 520, + "y": 460, + "wires": [ + [ + "8630c7dfcdbcce50" + ] + ] + }, + { + "id": "7c62509d505c281b", + "type": "link in", + "z": "c5240b64a962ea54", + "name": "Docker update unknown project", + "links": [ + "852d039f540dd0d3" + ], + "x": 275, + "y": 460, + "wires": [ + [ + "c3d07241f4a570af" + ] + ] + }, + { + "id": "d1346f7151103832", + "type": "function", + "z": "c5240b64a962ea54", + "name": "Docker updates for Raspi", + "func": "const container = msg.container || \"unknown container\";\nconst code = msg.payload.code;\nconst stderr = flow.get(\"pull_stderr\") || \"Unknown error\";\nconst project = msg.payload.labels.com_docker_compose_project\nmsg.payload = {\n title: \"Container Updates Available - Raspi\",\n message: `The ${container} container has updates available.`,\n priority: 8\n};\n\nreturn msg;", + "outputs": 1, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 490, + "y": 520, + "wires": [ + [ + "8630c7dfcdbcce50" + ] + ] + }, + { + "id": "e6c64cd6d405b8ed", + "type": "link in", + "z": "c5240b64a962ea54", + "name": "Docker update for raspi", + "links": [], + "x": 275, + "y": 520, + "wires": [ + [ + "d1346f7151103832" + ] + ] + }, + { + "id": "b72f58c8b6d6d265", + "type": "link in", + "z": "c5240b64a962ea54", + "name": "Docker update locked", + "links": [ + "0e6520dfb81a951b", + "77675958f77d2d5f" + ], + "x": 275, + "y": 580, + "wires": [ + [ + "1a9798d5c081240a" + ] + ] + }, + { + "id": "1a9798d5c081240a", + "type": "function", + "z": "c5240b64a962ea54", + "name": "Docker updates locked", + "func": "const container = msg.container || \"unknown container\";\nconst code = msg.payload.code;\nconst stderr = flow.get(\"pull_stderr\") || \"Unknown error\";\n//const project = msg.payload.labels.com_docker_compose_project\nmsg.payload = {\n title: \"Update Locked out\",\n message: `Container: ${container}\n Host: ${msg.host}\\n\n Manual Intervention required.`,\n priority: 8\n};\n\nreturn msg;", + "outputs": 1, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 480, + "y": 580, + "wires": [ + [ + "8630c7dfcdbcce50" + ] + ] + } +] \ No newline at end of file diff --git a/monitoring/node-red/data/flows_cred.json b/monitoring/node-red/data/flows_cred.json new file mode 100644 index 0000000..4cc398b --- /dev/null +++ b/monitoring/node-red/data/flows_cred.json @@ -0,0 +1,3 @@ +{ + "$": "793e894c453e963b28f6b2f601eb1089FMPGL4pXtRVHmXNPWy9/lr/WoWBaGVA=" +} \ No newline at end of file diff --git a/monitoring/node-red/data/node_modules/.package-lock.json b/monitoring/node-red/data/node_modules/.package-lock.json new file mode 100644 index 0000000..b252c9b --- /dev/null +++ b/monitoring/node-red/data/node_modules/.package-lock.json @@ -0,0 +1,14 @@ +{ + "name": "node-red-project", + "version": "0.0.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "node_modules/node-red-debugger": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/node-red-debugger/-/node-red-debugger-1.1.1.tgz", + "integrity": "sha512-sEfBRYZk+ptqCOkDURC1IxJ6lr1yhdGUctxwL13EmLknQSsOzTJzcI+/nWF1RSBZmsCw4R8+TE1Kx4TnjX2X/g==", + "license": "Apache-2" + } + } +} diff --git a/monitoring/node-red/data/node_modules/node-red-debugger/CHANGELOG.md b/monitoring/node-red/data/node_modules/node-red-debugger/CHANGELOG.md new file mode 100644 index 0000000..8fb9244 --- /dev/null +++ b/monitoring/node-red/data/node_modules/node-red-debugger/CHANGELOG.md @@ -0,0 +1,19 @@ +### 1.1.1 + + - Do not send full message object in messageQueued event Fixes #8 + +### 1.1.0 + + - Require Node-RED 2.0.0-beta.2 + - Allow debugger to pause just breakpoint nodes + - Better display >99 message queue count on node annotation + - Publish debugger state as retained to make resync easier + - Add Japanese translations (#7) @kazuhitoyokoi + +### 1.0.1 + + - Fix case sensitivity of filenames due to TypeScript being TypeScript + +### 1.0.0 + + - First public release of the Flow Debugger diff --git a/monitoring/node-red/data/node_modules/node-red-debugger/LICENSE b/monitoring/node-red/data/node_modules/node-red-debugger/LICENSE new file mode 100644 index 0000000..feaf1c9 --- /dev/null +++ b/monitoring/node-red/data/node_modules/node-red-debugger/LICENSE @@ -0,0 +1,178 @@ +Copyright OpenJS Foundation and other contributors, https://openjsf.org/ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS diff --git a/monitoring/node-red/data/node_modules/node-red-debugger/README.md b/monitoring/node-red/data/node_modules/node-red-debugger/README.md new file mode 100644 index 0000000..bff8ee2 --- /dev/null +++ b/monitoring/node-red/data/node_modules/node-red-debugger/README.md @@ -0,0 +1,105 @@ +# Node-RED Flow Debugger + +This module is a Plugin for Node-RED 2.x. It provides a flow debugger with the following +features: + + - set breakpoints on node inputs or outputs + - pause the runtime manually or when a message arrives at a breakpoint + - once paused you can: + - inspect the queued up messages + - step forward individual messages + - drop messages + +## Installation + +Install this module in your Node-RED user directory or via the Palette Manager +then restart Node-RED + + npm install node-red-debugger + + +## Usage + +The Flow Debugger adds a new sidebar tab in the editor. Select it from the dropdown +menu. + +By default, the debugger is disabled. Click the 'disabled' toggle button to enable it. + +The sidebar has two sections - a list of the breakpoints you have set and a list +of any messages queued up in the runtime. + +### Working with breakpoints + +With the debugger enabled, when you hover over a node's port a breakpoint indicator +will appear. Move your mouse over the indicator and click once - it will turn solid blue +and an entry will appear in the sidebar. + +If you click on it again, the breakpoint will be deactivated but remain in place (light blue). + +Clicking on it again will remove the breakpoint entirely (dotted outline). + +You can also deactive a breakpoint using its checkbox in the sidebar, and remove it by +clicking the `x` button. + +### Pausing the runtime + +The runtime will by paused whenever a message arrives at an active breakpoint. You +can also manually pause the runtime using the pause button in the sidebar. + +Once paused, the flow will show how many messages are queued up at each node input +and output. Those messages will also be listed in the sidebar - in the order the +runtime will process them. + +If you click the step button at the top of the sidebar, the runtime will process +the next message in the list. You can step individual messages by clicking the +step button that appears when you hover over the message. + +You can also delete any message from the queue by clicking its delete button. This +will prevent the message from passing any further in the flow. + +You can click the play button to resume the flows. + + +## Limitations + + - Due to the way Subflows work, breakpoints on Subflow outputs will be ignored + +## Roadmap + + - Set conditions on individual breakpoints + - Allow queued messages to be edited + - Pause only selected nodes/flows/groups + + +## Development + +This plugin has been developed using TypeScript. This means that when running +from the source code rather than npm, it must first be built. + + git clone https://github.com/node-red/node-red-debugger.git + cd node-red-debugger + npm install + npm run build + +This will generate all of the plugin files in the `dist` folder - which is where +Node-RED will expect to load the files from. + + +Then, in your Node-RED user directory (`~/.node-red`) run: + + npm install `` + +### Themeing + +The Debugger sidebar will use the active Node-RED theme. For the breakpoints +drawn within the flow workspace, the following CSS variables will be used if they +are set by the active theme. + + - `--red-ui-flow-debugger-breakpoint-fill` + - `--red-ui-flow-debugger-breakpoint-stroke` + - `--red-ui-flow-debugger-breakpoint-active-fill` + - `--red-ui-flow-debugger-breakpoint-active-stroke` + - `--red-ui-flow-debugger-breakpoint-inactive-fill` + - `--red-ui-flow-debugger-breakpoint-inactive-stroke` + - `--red-ui-flow-debugger-breakpoint-label` + - `--red-ui-flow-debugger-breakpoint-label-active` diff --git a/monitoring/node-red/data/node_modules/node-red-debugger/dist/flow-debugger.html b/monitoring/node-red/data/node_modules/node-red-debugger/dist/flow-debugger.html new file mode 100644 index 0000000..42c29cf --- /dev/null +++ b/monitoring/node-red/data/node_modules/node-red-debugger/dist/flow-debugger.html @@ -0,0 +1,2 @@ + + diff --git a/monitoring/node-red/data/node_modules/node-red-debugger/dist/flow-debugger.js b/monitoring/node-red/data/node_modules/node-red-debugger/dist/flow-debugger.js new file mode 100644 index 0000000..2280be7 --- /dev/null +++ b/monitoring/node-red/data/node_modules/node-red-debugger/dist/flow-debugger.js @@ -0,0 +1,140 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const debugger_1 = require("./lib/debugger"); +const location_1 = require("./lib/location"); +module.exports = (RED) => { + const apiRoot = "/flow-debugger"; + RED.plugins.registerPlugin("node-red-debugger", { + onadd: () => { + const flowDebugger = new debugger_1.Debugger(RED); + const routeAuthHandler = RED.auth.needsPermission("flow-debugger.write"); + RED.comms.publish("flow-debugger/connected", true, true); + function publishState() { + RED.comms.publish("flow-debugger/state", flowDebugger.getState()); + } + flowDebugger.on("paused", (event) => { + RED.comms.publish("flow-debugger/paused", event); + }); + flowDebugger.on("resumed", (event) => { + RED.comms.publish("flow-debugger/resumed", event); + }); + flowDebugger.on("messageQueued", (event) => { + // Don't include the full message on the event + // event.msg = RED.util.encodeObject({msg:event.msg}, {maxLength: 100}); + delete event.msg; + RED.comms.publish("flow-debugger/messageQueued", event); + }); + flowDebugger.on("messageDispatched", (event) => { + RED.comms.publish("flow-debugger/messageDispatched", event); + }); + // flowDebugger.on("step", (event) => { + // + // }); + RED.httpAdmin.get(`${apiRoot}`, (_, res) => { + res.json(flowDebugger.getState()); + }); + RED.httpAdmin.put(`${apiRoot}`, routeAuthHandler, (req, res) => { + let stateChanged = false; + if (req.body.hasOwnProperty("enabled")) { + const enabled = !!req.body.enabled; + if (enabled && !flowDebugger.enabled) { + flowDebugger.enable(); + stateChanged = true; + } + else if (!enabled && flowDebugger.enabled) { + flowDebugger.disable(); + stateChanged = true; + } + } + if (req.body.hasOwnProperty("config")) { + stateChanged = flowDebugger.setConfig(req.body.config); + } + if (stateChanged) { + publishState(); + } + res.json(flowDebugger.getState()); + }); + RED.httpAdmin.get(`${apiRoot}/breakpoints`, routeAuthHandler, (_, res) => { + res.json(flowDebugger.getBreakpoints()); + }); + RED.httpAdmin.put(`${apiRoot}/breakpoints/:id`, routeAuthHandler, (req, res) => { + flowDebugger.setBreakpointActive(req.params.id, req.body.active); + res.json(flowDebugger.getBreakpoint(req.params.id)); + }); + RED.httpAdmin.delete(`${apiRoot}/breakpoints/:id`, routeAuthHandler, (req, res) => { + flowDebugger.clearBreakpoint(req.params.id); + res.sendStatus(200); + }); + RED.httpAdmin.post(`${apiRoot}/breakpoints`, routeAuthHandler, (req, res) => { + // req.body.location + const breakpointId = flowDebugger.setBreakpoint(new location_1.Location(req.body.id, req.body.path, req.body.portType, req.body.portIndex)); + res.json(flowDebugger.getBreakpoint(breakpointId)); + }); + RED.httpAdmin.get(`${apiRoot}/messages`, routeAuthHandler, (_, res) => { + res.json(Array.from(flowDebugger.getMessageQueue()).map(m => { + const result = { + id: m.id, + location: m.location.toString(), + destination: undefined, + msg: RED.util.encodeObject({ msg: m.event.msg }, { maxLength: 100 }) + }; + if (m.event.hasOwnProperty('source')) { + // SendEvent - so include the destination location id + result.destination = m.event.destination.id + "[i][0]"; + } + return result; + })); + }); + RED.httpAdmin.get(`${apiRoot}/messages/:id`, routeAuthHandler, (req, res) => { + const id = req.params.id; + const messageEvent = flowDebugger.getMessageQueue().get(parseInt(id, 10)); + if (messageEvent) { + const result = { + id: messageEvent.id, + location: messageEvent.location, + destination: undefined, + msg: RED.util.encodeObject({ msg: messageEvent.event.msg }, { maxLength: 100 }) + }; + if (messageEvent.event.hasOwnProperty('source')) { + // SendEvent - so include the destination location id + result.destination = messageEvent.event.destination.id + "[i][0]"; + } + res.json(result); + } + else { + res.sendStatus(404); + } + }); + RED.httpAdmin.delete(`${apiRoot}/messages/:id`, routeAuthHandler, (req, res) => { + flowDebugger.deleteMessage(parseInt(req.params.id, 10)); + res.sendStatus(200); + }); + RED.httpAdmin.post(`${apiRoot}/pause`, routeAuthHandler, (_, res) => { + flowDebugger.pause(); + res.sendStatus(200); + }); + RED.httpAdmin.post(`${apiRoot}/step`, routeAuthHandler, (req, res) => { + let stepMessage = null; + if (req.body && req.body.message) { + stepMessage = req.body.message; + } + flowDebugger.step(stepMessage); + res.sendStatus(200); + }); + RED.httpAdmin.post(`${apiRoot}/resume`, routeAuthHandler, (_, res) => { + flowDebugger.resume(); + res.sendStatus(200); + }); + } + }); +}; +/* + +/flow-debugger/enable +/flow-debugger/disable +/flow-debugger/breakpoint + + + +*/ +//# sourceMappingURL=flow-debugger.js.map \ No newline at end of file diff --git a/monitoring/node-red/data/node_modules/node-red-debugger/dist/flow-debugger.js.map b/monitoring/node-red/data/node_modules/node-red-debugger/dist/flow-debugger.js.map new file mode 100644 index 0000000..66c418b --- /dev/null +++ b/monitoring/node-red/data/node_modules/node-red-debugger/dist/flow-debugger.js.map @@ -0,0 +1 @@ +{"version":3,"file":"flow-debugger.js","sourceRoot":"","sources":["../src/flow-debugger.ts"],"names":[],"mappings":";;AAAA,6CAAuC;AAEvC,6CAAuC;AAEvC,MAAM,CAAC,OAAO,GAAG,CAAC,GAAO,EAAE,EAAE;IAEzB,MAAM,OAAO,GAAG,gBAAgB,CAAC;IAEjC,GAAG,CAAC,OAAO,CAAC,cAAc,CAA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/B,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;YACxB,CAAC,CAAC,CAAC;YAEH,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,OAAO,SAAS,EAAE,gBAAgB,EAAE,CAAC,CAAK,EAAE,GAAO,EAAE,EAAE;gBACzE,YAAY,CAAC,MAAM,EAAE,CAAC;gBACtB,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;YACxB,CAAC,CAAC,CAAC;QACP,CAAC;KACJ,CAAC,CAAA;AACN,CAAC,CAAA;AACD;;;;;;;;EAQE"} \ No newline at end of file diff --git a/monitoring/node-red/data/node_modules/node-red-debugger/dist/lib/MessageQueue.js b/monitoring/node-red/data/node_modules/node-red-debugger/dist/lib/MessageQueue.js new file mode 100644 index 0000000..6a614d5 --- /dev/null +++ b/monitoring/node-red/data/node_modules/node-red-debugger/dist/lib/MessageQueue.js @@ -0,0 +1,83 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MessageQueue = void 0; +class MessageQueue { + constructor(queueName) { + this.queueName = queueName; + this.previousName = `previousBy${queueName}`; + this.nextName = `nextBy${queueName}`; + this.length = 0; + } + enqueue(event) { + if (!this.head) { + this.head = event; + } + event[this.previousName] = this.tail; + if (this.tail) { + this.tail[this.nextName] = event; + } + this.tail = event; + this.length++; + } + next() { + const result = this.head; + if (result) { + this.remove(result); + this.length--; + } + return result; + } + peek() { + return this.head; + } + get(id) { + let p = this.head; + while (p) { + if (p.id === id) { + return p; + } + p = p[this.nextName]; + } + } + remove(event) { + const previousEvent = event[this.previousName]; + const nextEvent = event[this.nextName]; + if (previousEvent) { + previousEvent[this.nextName] = nextEvent; + } + else { + this.head = nextEvent; + } + if (nextEvent) { + nextEvent[this.previousName] = previousEvent; + } + else { + this.tail = previousEvent; + } + this.length--; + } + *[Symbol.iterator]() { + let p = this.head; + while (p) { + yield p; + p = p[this.nextName]; + } + } + dump() { + let result = `MessageQueue ${this.queueName} [${this.length}] + head: ${this.head.id} + tail: ${this.tail.id} + list: `; + let p = this.head; + while (p) { + result = result + p.id; + p = p[this.nextName]; + if (p) { + result += " > "; + } + } + return result; + } +} +exports.MessageQueue = MessageQueue; +//# sourceMappingURL=MessageQueue.js.map \ No newline at end of file diff --git a/monitoring/node-red/data/node_modules/node-red-debugger/dist/lib/MessageQueue.js.map b/monitoring/node-red/data/node_modules/node-red-debugger/dist/lib/MessageQueue.js.map new file mode 100644 index 0000000..d1d70e0 --- /dev/null +++ b/monitoring/node-red/data/node_modules/node-red-debugger/dist/lib/MessageQueue.js.map @@ -0,0 +1 @@ +{"version":3,"file":"MessageQueue.js","sourceRoot":"","sources":["../../src/lib/MessageQueue.ts"],"names":[],"mappings":";;;AAEA,MAAa,YAAY;IAQrB,YAAY,SAAgB;QACxB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,YAAY,GAAG,aAAa,SAAS,EAAE,CAAA;QAC5C,IAAI,CAAC,QAAQ,GAAG,SAAS,SAAS,EAAE,CAAA;QACpC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IACpB,CAAC;IACD,OAAO,CAAC,KAAkB;QACtB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YACZ,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;SACrB;QACD,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC;QACrC,IAAI,IAAI,CAAC,IAAI,EAAE;YACX,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;SACpC;QACD,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;QAClB,IAAI,CAAC,MAAM,EAAE,CAAC;IAClB,CAAC;IACD,IAAI;QACA,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC;QACzB,IAAI,MAAM,EAAE;YACR,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACpB,IAAI,CAAC,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AAC;QACF,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC;QAClB,OAAM,CAAC,EAAE;YACL,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC;YACvB,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACrB,IAAI,CAAC,EAAE;gBACH,MAAM,IAAI,KAAK,CAAC;aACnB;SACJ;QACD,OAAO,MAAM,CAAA;IAEjB,CAAC;CACJ;AAnFD,oCAmFC"} \ No newline at end of file diff --git a/monitoring/node-red/data/node_modules/node-red-debugger/dist/lib/debugger.js b/monitoring/node-red/data/node_modules/node-red-debugger/dist/lib/debugger.js new file mode 100644 index 0000000..edf9d54 --- /dev/null +++ b/monitoring/node-red/data/node_modules/node-red-debugger/dist/lib/debugger.js @@ -0,0 +1,370 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Debugger = void 0; +const Location = __importStar(require("./location")); +const MessageQueue_1 = require("./MessageQueue"); +const events_1 = require("events"); +const DEBUGGER_PAUSED = Symbol("node-red-debugger: paused"); +let BREAKPOINT_ID = 1; +class Debugger extends events_1.EventEmitter { + // Events: + // paused / resumed + constructor(RED) { + super(); + this.config = { + breakpointAction: "pause-all" + }; + this.RED = RED; + this.enabled = false; + this.breakpoints = new Map(); + this.pausedLocations = new Set(); + this.breakpointsByLocation = new Map(); + this.queuesByLocation = {}; + this.messageQueue = new MessageQueue_1.MessageQueue("Time"); + this.eventNumber = 0; + } + log(message) { + this.RED.log.info(`[flow-debugger] ${message}`); + } + checkLocation(location, event, done) { + const breakpointId = location.getBreakpointLocation(); + if (this.isNodePaused(location.id)) { + this.queueEvent(location, event, done); + } + else { + if (event.msg && event.msg[DEBUGGER_PAUSED]) { + this.pause({ + reason: "step", + node: location.id + }); + this.queueEvent(location, event, done); + } + else { + const bp = this.breakpointsByLocation.get(breakpointId); + if (bp && bp.active) { + this.pause({ + reason: "breakpoint", + node: location.id, + breakpoint: bp.id + }); + this.queueEvent(location, event, done); + } + else { + done(); + } + } + } + } + enable() { + this.log("Enabled"); + this.enabled = true; + this.RED.hooks.add("preRoute.flow-debugger", (sendEvent, done) => { + if (isNodeInSubflowModule(sendEvent.source.node)) { + // Inside a subflow module - don't pause the event + done(); + return; + } + if (sendEvent.source.node._flow.TYPE !== "flow" && sendEvent.source.node.id === sendEvent.source.node._flow.id) { + // This is the subflow output which, in the current implementation + // means the message is actually about to be routed to the first node + // inside the subflow, not the output of actual subflow. + done(); + return; + } + if (sendEvent.cloneMessage) { + sendEvent.msg = this.RED.util.cloneMessage(sendEvent.msg); + sendEvent.cloneMessage = false; + } + const eventLocation = Location.createLocation(sendEvent); + // console.log("preRoute",eventLocation.toString()); + this.checkLocation(eventLocation, sendEvent, done); + }); + this.RED.hooks.add("onReceive.flow-debugger", (receiveEvent, done) => { + if (receiveEvent.destination.node.type === "inject") { + // Never pause an Inject node's internal receive event + done(); + return; + } + if (isNodeInSubflowModule(receiveEvent.destination.node)) { + // Inside a subflow module - don't pause the event + done(); + return; + } + const eventLocation = Location.createLocation(receiveEvent); + // console.log("onReceive",eventLocation.toString()); + this.checkLocation(eventLocation, receiveEvent, done); + }); + } + disable() { + this.log("Disabled"); + this.enabled = false; + this.RED.hooks.remove("*.flow-debugger"); + this.pausedLocations.clear(); + this.drainQueues(true); + } + pause(event) { + if (this.enabled) { + let logReason; + if (event) { + if (this.config.breakpointAction === "pause-all") { + this.pausedLocations.clear(); + this.pausedLocations.add("*"); + } + else { + this.pausedLocations.add(event.node); + } + if (event.reason === "breakpoint") { + logReason = "@" + this.breakpoints.get(event.breakpoint).location.toString(); + } + else if (event.reason === "step") { + logReason = "@" + event.node; + } + event.pausedLocations = [...this.pausedLocations]; + } + else { + // Manual pause + this.pausedLocations.clear(); + this.pausedLocations.add("*"); + logReason = "manual"; + } + this.log(`Flows paused: ${logReason}`); + this.emit("paused", event || { reason: "manual" }); + } + } + resume(nodeId) { + if (this.pausedLocations.size === 0) { + return; + } + if (!nodeId || nodeId === "*") { + console.log("resume - clear all locations"); + this.pausedLocations.clear(); + } + else if (nodeId && this.pausedLocations.has(nodeId)) { + this.pausedLocations.delete(nodeId); + } + else { + // Nothing has been unpaused + return; + } + this.log("Flows resumed"); + this.emit("resumed", { node: nodeId }); + this.drainQueues(); + } + deleteMessage(messageId) { + const nextEvent = this.messageQueue.get(messageId); + if (nextEvent) { + this.messageQueue.remove(nextEvent); + const nextEventLocation = nextEvent.location.toString(); + this.queuesByLocation[nextEventLocation].remove(nextEvent); + const queueDepth = this.queuesByLocation[nextEventLocation].length; + if (queueDepth === 0) { + delete this.queuesByLocation[nextEventLocation]; + } + this.emit("messageDispatched", { id: nextEvent.id, location: nextEventLocation, depth: queueDepth }); + // Call done with false to prevent any further processing + nextEvent.done(false); + } + } + isNodePaused(nodeId) { + return this.pausedLocations.has("*") || this.pausedLocations.has(nodeId); + } + drainQueues(quiet) { + for (const nextEvent of this.messageQueue) { + const eventNodeId = nextEvent.location.id; + if (!this.isNodePaused(eventNodeId)) { + const nextEventLocation = nextEvent.location.toString(); + this.queuesByLocation[nextEventLocation].remove(nextEvent); + const queueDepth = this.queuesByLocation[nextEventLocation].length; + if (queueDepth === 0) { + delete this.queuesByLocation[nextEventLocation]; + } + if (!quiet) { + this.emit("messageDispatched", { id: nextEvent.id, location: nextEventLocation, depth: queueDepth }); + } + if (nextEvent.event.msg[DEBUGGER_PAUSED]) { + delete nextEvent.event.msg[DEBUGGER_PAUSED]; + } + nextEvent.done(); + this.messageQueue.remove(nextEvent); + } + } + } + setBreakpoint(location) { + const bp = { + id: (BREAKPOINT_ID++) + "", + location, + active: true, + mode: "all" + }; + this.breakpoints.set(bp.id, bp); + this.breakpointsByLocation.set(location.toString(), bp); + return bp.id; + } + getBreakpoint(breakpointId) { + return this.breakpoints.get(breakpointId); + } + setBreakpointActive(breakpointId, state) { + const bp = this.breakpoints.get(breakpointId); + if (bp) { + bp.active = state; + } + } + clearBreakpoint(breakpointId) { + const bp = this.breakpoints.get(breakpointId); + if (bp) { + this.breakpoints.delete(breakpointId); + this.breakpointsByLocation.delete(bp.location.toString()); + } + } + getBreakpoints() { + return Array.from(this.breakpoints.values()); + } + step(messageId) { + if (this.enabled) { + let nextEvent; + if (messageId) { + nextEvent = this.messageQueue.get(messageId); + if (nextEvent) { + this.messageQueue.remove(nextEvent); + } + } + else { + nextEvent = this.messageQueue.next(); + } + if (nextEvent) { + const nextEventLocation = nextEvent.location.toString(); + this.log("Step: " + nextEventLocation); + this.queuesByLocation[nextEventLocation].remove(nextEvent); + const queueDepth = this.queuesByLocation[nextEventLocation].length; + if (queueDepth === 0) { + delete this.queuesByLocation[nextEventLocation]; + } + nextEvent.event.msg[DEBUGGER_PAUSED] = true; + this.emit("messageDispatched", { id: nextEvent.id, location: nextEventLocation, depth: queueDepth }); + nextEvent.done(); + } + } + } + setConfig(newConfig) { + let changed = false; + for (const key in this.config) { + if (newConfig.hasOwnProperty(key) && this.config[key] !== newConfig[key]) { + changed = true; + this.config[key] = newConfig[key]; + } + } + return changed; + } + getState() { + if (!this.enabled) { + return { enabled: false }; + } + return { + enabled: true, + pausedLocations: [...this.pausedLocations], + config: this.config, + breakpoints: this.getBreakpoints(), + queues: this.getMessageQueueDepths() + }; + } + getMessageSummary() { + return Array.from(this.messageQueue).map(m => { + return { + id: m.id, + location: m.location + }; + }); + } + getMessageQueue() { + return this.messageQueue; + } + getMessageQueueDepths() { + if (!this.enabled) { + return {}; + } + const result = {}; + for (const [locationId, queue] of Object.entries(this.queuesByLocation)) { + result[locationId] = { depth: queue.length }; + } + return result; + } + dump() { + let result = `Debugger State +--- +${this.messageQueue.dump()} +`; + const locationIds = Object.keys(this.queuesByLocation); + locationIds.forEach(id => { + result += `--- +Location: ${id} +${this.queuesByLocation[id].dump()} +`; + }); + return result; + } + queueEvent(location, event, done) { + const locationId = location.toString(); + if (!this.queuesByLocation[locationId]) { + this.queuesByLocation[locationId] = new MessageQueue_1.MessageQueue("Location"); + } + const messageEvent = { + id: this.eventNumber++, + event, + location, + done, + nextByLocation: null, + previousByLocation: null, + nextByTime: null, + previousByTime: null + }; + this.queuesByLocation[locationId].enqueue(messageEvent); + this.messageQueue.enqueue(messageEvent); + const queuedEvent = { + id: messageEvent.id, + location: locationId, + msg: event.msg, + depth: this.queuesByLocation[locationId].length, + destination: null, + }; + if (event.hasOwnProperty('source')) { + // SendEvent - so include the destination location id + queuedEvent.destination = "/" + event.destination.id + "[i][0]"; + } + this.emit("messageQueued", queuedEvent); + } +} +exports.Debugger = Debugger; +const MODULE_TYPE_RE = /^module:/; +function isNodeInSubflowModule(node) { + let f = node._flow; + do { + if (f.TYPE === "flow") { + return false; + } + if (MODULE_TYPE_RE.test(f.TYPE)) { + return true; + } + f = f.parent; + } while (f && f.TYPE); + return false; +} +//# sourceMappingURL=debugger.js.map \ No newline at end of file diff --git a/monitoring/node-red/data/node_modules/node-red-debugger/dist/lib/debugger.js.map b/monitoring/node-red/data/node_modules/node-red-debugger/dist/lib/debugger.js.map new file mode 100644 index 0000000..7b32d01 --- /dev/null +++ b/monitoring/node-red/data/node_modules/node-red-debugger/dist/lib/debugger.js.map @@ -0,0 +1 @@ +{"version":3,"file":"debugger.js","sourceRoot":"","sources":["../../src/lib/debugger.ts"],"names":[],"mappings":";;;;;;;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C3C,CAAC;CACJ;AAtVD,4BAsVC;AAED,MAAM,cAAc,GAAG,UAAU,CAAC;AAElC,SAAS,qBAAqB,CAAC,IAAQ;IACnC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;IACnB,GAAG;QACC,IAAI,CAAC,CAAC,IAAI,KAAK,MAAM,EAAE;YACnB,OAAO,KAAK,CAAC;SAChB;QACD,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE;YAC7B,OAAO,IAAI,CAAC;SACf;QACD,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;KAChB,QAAO,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE;IACrB,OAAO,KAAK,CAAC;AACjB,CAAC"} \ No newline at end of file diff --git a/monitoring/node-red/data/node_modules/node-red-debugger/dist/lib/location.js b/monitoring/node-red/data/node_modules/node-red-debugger/dist/lib/location.js new file mode 100644 index 0000000..97b8712 --- /dev/null +++ b/monitoring/node-red/data/node_modules/node-red-debugger/dist/lib/location.js @@ -0,0 +1,46 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createLocation = exports.Location = void 0; +class Location { + constructor(nodeId, nodePath, portType = "o", portIndex = 0) { + this.inSubflow = false; + this.id = nodeId; + this.path = nodePath; + this.portType = portType; + this.portIndex = portIndex; + } + getBreakpointLocation() { + if (this.inSubflow) { + return `*/${this.id}[${this.portType}][${this.portIndex}]`; + } + else { + return this.toString(); + } + } + toString() { + return `${this.path}/${this.id}[${this.portType}][${this.portIndex}]`; + } +} +exports.Location = Location; +function createLocation(event) { + let node; + let portType; + let portIndex; + if (event.hasOwnProperty("source")) { + node = event.source.node; + portType = "o"; + portIndex = event.source.port; + } + else { + node = event.destination.node; + portType = "i"; + portIndex = 0; + } + const l = new Location(node._alias || node.id, node._flow.path, portType, portIndex); + if (node._alias) { + l.inSubflow = true; + } + return l; +} +exports.createLocation = createLocation; +//# sourceMappingURL=location.js.map \ No newline at end of file diff --git a/monitoring/node-red/data/node_modules/node-red-debugger/dist/lib/location.js.map b/monitoring/node-red/data/node_modules/node-red-debugger/dist/lib/location.js.map new file mode 100644 index 0000000..dd20e2c --- /dev/null +++ b/monitoring/node-red/data/node_modules/node-red-debugger/dist/lib/location.js.map @@ -0,0 +1 @@ +{"version":3,"file":"location.js","sourceRoot":"","sources":["../../src/lib/location.ts"],"names":[],"mappings":";;;AAIA,MAAa,QAAQ;IAYjB,YAAY,MAAa,EAAE,QAAe,EAAE,WAAkB,GAAG,EAAE,SAAS,GAAC,CAAC;QAF9E,cAAS,GAAW,KAAK,CAAC;QAGtB,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC/B,CAAC;IACD,qBAAqB;QACjB,IAAI,IAAI,CAAC,SAAS,EAAE;YAChB,OAAO,KAAK,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,SAAS,GAAG,CAAA;SAC7D;aAAM;YACH,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;SAC1B;IACL,CAAC;IACD,QAAQ;QACJ,OAAO,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,SAAS,GAAG,CAAA;IACzE,CAAC;CACJ;AA5BD,4BA4BC;AAED,SAAgB,cAAc,CAAC,KAA4B;IACvD,IAAI,IAAQ,CAAC;IACb,IAAI,QAAiB,CAAC;IACtB,IAAI,SAAgB,CAAC;IACrB,IAAI,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE;QAChC,IAAI,GAAI,KAAmB,CAAC,MAAM,CAAC,IAAI,CAAC;QACxC,QAAQ,GAAG,GAAG,CAAC;QACf,SAAS,GAAI,KAAmB,CAAC,MAAM,CAAC,IAAI,CAAC;KAChD;SAAM;QACH,IAAI,GAAI,KAAsB,CAAC,WAAW,CAAC,IAAI,CAAC;QAChD,QAAQ,GAAG,GAAG,CAAC;QACf,SAAS,GAAG,CAAC,CAAC;KACjB;IACD,MAAM,CAAC,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;IACrF,IAAI,IAAI,CAAC,MAAM,EAAE;QACb,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC;KACtB;IACD,OAAO,CAAC,CAAC;AACb,CAAC;AAlBD,wCAkBC"} \ No newline at end of file diff --git a/monitoring/node-red/data/node_modules/node-red-debugger/dist/lib/types.js b/monitoring/node-red/data/node_modules/node-red-debugger/dist/lib/types.js new file mode 100644 index 0000000..11e638d --- /dev/null +++ b/monitoring/node-red/data/node_modules/node-red-debugger/dist/lib/types.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/monitoring/node-red/data/node_modules/node-red-debugger/dist/lib/types.js.map b/monitoring/node-red/data/node_modules/node-red-debugger/dist/lib/types.js.map new file mode 100644 index 0000000..9561242 --- /dev/null +++ b/monitoring/node-red/data/node_modules/node-red-debugger/dist/lib/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/monitoring/node-red/data/node_modules/node-red-debugger/dist/locales/en-US/flow-debugger.json b/monitoring/node-red/data/node_modules/node-red-debugger/dist/locales/en-US/flow-debugger.json new file mode 100644 index 0000000..fb0a88a --- /dev/null +++ b/monitoring/node-red/data/node_modules/node-red-debugger/dist/locales/en-US/flow-debugger.json @@ -0,0 +1,27 @@ +{ + "label": { + "debugger": "Flow Debugger", + "debuggerShort": "debugger", + "breakpoints": "Breakpoints", + "messages":"Messages", + "output": "output", + "input": "input", + "paused": "Flows paused", + "resume": "Resume flows", + "step": "Step flows", + "pause": "Pause flows", + "deleteMessage": "Delete message", + "stepMessage": "Step message", + "filter": { + "label": "Filter messages", + "all": "all nodes", + "flow": "current flow" + }, + "settings": "Debugger options", + "breakpointAction": { + "label": "Breakpoint action", + "pause-all": "pause all nodes", + "pause-bp": "pause at breakpoint" + } + } +} diff --git a/monitoring/node-red/data/node_modules/node-red-debugger/dist/locales/ja/flow-debugger.json b/monitoring/node-red/data/node_modules/node-red-debugger/dist/locales/ja/flow-debugger.json new file mode 100644 index 0000000..5aed0a7 --- /dev/null +++ b/monitoring/node-red/data/node_modules/node-red-debugger/dist/locales/ja/flow-debugger.json @@ -0,0 +1,27 @@ +{ + "label": { + "debugger": "フローデバッガ", + "debuggerShort": "デバッガ", + "breakpoints": "ブレイクポイント", + "messages": "メッセージ", + "output": "出力", + "input": "入力", + "paused": "フローを停止しました", + "resume": "フローを再開", + "step": "フローをステップ実行", + "pause": "フローを停止", + "deleteMessage": "メッセージを削除", + "stepMessage": "メッセージをステップ実行", + "filter": { + "label": "メッセージの絞り込み", + "all": "全てのノード", + "flow": "現在のフロー" + }, + "settings": "デバッガオプション", + "breakpointAction": { + "label": "ブレイクポイントの動作", + "pause-all": "全てのノードを停止", + "pause-bp": "ブレイクポイントで停止" + } + } +} diff --git a/monitoring/node-red/data/node_modules/node-red-debugger/dist/nr-types.js b/monitoring/node-red/data/node_modules/node-red-debugger/dist/nr-types.js new file mode 100644 index 0000000..4bf6893 --- /dev/null +++ b/monitoring/node-red/data/node_modules/node-red-debugger/dist/nr-types.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=nr-types.js.map \ No newline at end of file diff --git a/monitoring/node-red/data/node_modules/node-red-debugger/dist/nr-types.js.map b/monitoring/node-red/data/node_modules/node-red-debugger/dist/nr-types.js.map new file mode 100644 index 0000000..7488926 --- /dev/null +++ b/monitoring/node-red/data/node_modules/node-red-debugger/dist/nr-types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"nr-types.js","sourceRoot":"","sources":["../src/nr-types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/monitoring/node-red/data/node_modules/node-red-debugger/package.json b/monitoring/node-red/data/node_modules/node-red-debugger/package.json new file mode 100644 index 0000000..b375986 --- /dev/null +++ b/monitoring/node-red/data/node_modules/node-red-debugger/package.json @@ -0,0 +1,37 @@ +{ + "name": "node-red-debugger", + "version": "1.1.1", + "description": "A flow debugger for Node-RED 2.x", + "repository": { + "type": "git", + "url": "https://github.com/node-red/node-red-debugger.git" + }, + "scripts": { + "build": "(tsc || exit 1) && npm run tslint && npm run copyAssets", + "tslint": "tslint -c tslint.json -p tsconfig.json", + "copyAssets": "node scripts/copy-static-assets.js", + "dev": "nodemon --exec 'npm run build' -i dist -i resources -e 'ts html css'", + "test": "npm run build" + }, + "keywords": ["node-red","debugger"], + "author": "Nick O'Leary ", + "files": [ + "dist", + "resources" + ], + "license": "Apache-2", + "node-red": { + "version": ">=2.0.0", + "plugins": { + "flow-debugger": "dist/flow-debugger.js" + } + }, + "devDependencies": { + "@types/node": "^15.12.2", + "fs-extra": "^10.0.0", + "html-minifier": "^4.0.0", + "nodemon": "^2.0.7", + "tslint": "^6.1.3", + "typescript": "^4.3.2" + } +} diff --git a/monitoring/node-red/data/node_modules/node-red-debugger/resources/style.css b/monitoring/node-red/data/node_modules/node-red-debugger/resources/style.css new file mode 100644 index 0000000..b0a2bad --- /dev/null +++ b/monitoring/node-red/data/node_modules/node-red-debugger/resources/style.css @@ -0,0 +1 @@ +.red-ui-flow-debugger{height:100%;display:flex;flex-direction:column}.red-ui-flow-debugger-stack{overflow-y:scroll;background:var(--red-ui-primary-background)}.red-ui-flow-debugger-stack .red-ui-palette-category:last-child{border-bottom:1px solid var(--red-ui-secondary-border-color)}.red-ui-flow-debugger.disabled .red-ui-sidebar-header>:not(:first-child){display:none}.red-ui-flow-debugger.disabled .red-ui-flow-debugger-stack{display:none}.red-ui-flow-debugger .red-ui-sidebar-header{flex:0 0 auto;display:flex}.red-ui-flow-debugger .red-ui-sidebar-header>*{flex-shrink:0}.red-ui-flow-debugger .red-ui-editableList-border{border:none;border-radius:0}.red-ui-flow-debugger .red-ui-editableList-container{padding:0}.red-ui-flow-debugger .red-ui-editableList-container li{padding:0}.red-ui-flow-debugger .red-ui-editableList-container li .red-ui-editableList-item-remove{right:3px}.red-ui-flow-debugger-breakpoint-list,.red-ui-flow-debugger-message-list{min-height:30px}.red-ui-flow-debugger-breakpoint-list .red-ui-editableList-item-content{padding:6px 8px}.red-ui-flow-debugger-message-list .red-ui-editableList-item-content{padding:6px 0}.red-ui-flow-debugger-message .red-ui-debug-msg-meta{display:flex;padding-left:10px}.red-ui-flow-debugger-breakpoint{user-select:none;display:flex;align-items:center}.red-ui-flow-debugger-breakpoint .red-ui-node-icon{margin-left:6px;margin-right:6px}.red-ui-flow-debugger-breakpoint.red-ui-flow-debugger-breakpoint-input .red-ui-node-icon:before,.red-ui-flow-debugger-breakpoint.red-ui-flow-debugger-breakpoint-output .red-ui-node-icon:after{position:absolute;top:calc(50% - 4px);left:-5px;width:7px;height:7px;display:block;content:"";background:var(--red-ui-node-port-background);border:1px solid var(--red-ui-node-border);border-radius:2px}.red-ui-flow-debugger-breakpoint.red-ui-flow-debugger-breakpoint-output .red-ui-node-icon:after{left:20px}.red-ui-flow-debugger .red-ui-editableList-container li.highlight{background:#e6e6e6}.red-ui-flow-debugger .red-ui-editableList-container li.pending{opacity:.4}.red-ui-flow-debugger-breakpoint input[type=checkbox]{margin-top:0;margin-right:4px}.red-ui-flow-debugger-breakpoint>:nth-child(2){flex-grow:1;flex-shrink:1;overflow:hidden}.red-ui-flow-debugger-breakpoint:not(.active) :not(:first-child){opacity:.7}.red-ui-flow-debugger-breakpoint-port{flex-shrink:0;height:22px}.red-ui-flow-debugger-breakpoint-port svg{stroke:red;stroke-width:1;fill:none}.red-ui-flow-debugger-port-overlay{cursor:pointer;display:none}.red-ui-flow-debugger-port-overlay-background{fill:var(--red-ui-flow-debugger-breakpoint-fill,#fff);stroke-width:1;stroke:var(--red-ui-flow-debugger-breakpoint-stroke,#58d)}.red-ui-flow-debugger-port-overlay-background.red-ui-flow-debugger-port-overlay-pulse{fill:none!important;stroke-width:1;stroke:var(--red-ui-flow-debugger-breakpoint-stroke,#58d);animation:red-ui-flow-debugger-port-overlay-pulse-kf .6s linear}@keyframes red-ui-flow-debugger-port-overlay-pulse-kf{0%{transform:scale(.8);opacity:1}50%{opacity:.5}70%{opacity:.2}100%{transform:scale(2,1.5);opacity:0}}.red-ui-flow-debugger-port-overlay.active .red-ui-flow-debugger-port-overlay-background{fill:var(--red-ui-flow-debugger-breakpoint-active-fill,#59e);stroke:var(--red-ui-flow-debugger-breakpoint-active-stroke,#36b)}.red-ui-flow-debugger-port-overlay.inactive .red-ui-flow-debugger-port-overlay-background{fill:var(--red-ui-flow-debugger-breakpoint-inactive-fill,#def);stroke:var(--red-ui-flow-debugger-breakpoint-inactive-stroke,#59e)}.red-ui-flow-debugger-port-overlay.pending .red-ui-flow-debugger-port-overlay-background{fill:var(--red-ui-flow-debugger-breakpoint-inactive-fill,#def);stroke:var(--red-ui-flow-debugger-breakpoint-inactive-stroke,#59e);stroke-dasharray:4 2;opacity:.8}.red-ui-flow-debugger-port-overlay-highlight{stroke-width:1.5;fill:none;stroke-dasharray:4 2;stroke:var(--red-ui-node-selected-color,#ff7f0e);transform:scale(1.2,1.5)}.red-ui-flow-debugger-port-overlay.active,.red-ui-flow-debugger-port-overlay.hasMessages,.red-ui-flow-debugger-port-overlay.inactive,.red-ui-flow-debugger-port-overlay.pending{display:inherit}.red-ui-flow-debugger-port-overlay-label{stroke-width:0;fill:var(--red-ui-flow-debugger-breakpoint-label,var(--red-ui-node-label-color,#000));font-size:9pt;text-anchor:end}.red-ui-flow-debugger-port-overlay-label.small{font-size:7pt;transform:translate(2px,-1px)}.red-ui-flow-debugger-port-overlay.active .red-ui-flow-debugger-port-overlay-label{fill:var(--red-ui-flow-debugger-breakpoint-label-active,#fff)}.red-ui-flow-debugger-notification{display:flex}.red-ui-flow-debugger-notification>.red-ui-flow-debugger-toolbar{flex-grow:1;text-align:right}.red-ui-flow-debugger-message:hover .red-ui-flow-debugger-msg-tools{display:inline}.red-ui-flow-debugger-msg-tools{position:absolute;right:5px;display:none}.red-ui-flow-debugger-settings{background:var(--red-ui-tertiary-background);color:var(--red-ui-primary-text-color)}.red-ui-flow-debugger-settings div{margin:0 0 6px 0}.red-ui-flow-debugger-settings label{display:flex;align-items:center;margin-left:10px}.red-ui-flow-debugger-settings input[type=radio]{margin:0 5px 0 0}.red-ui-flow-debugger-message-load{display:block;padding:0;font-size:.8em;color:var(--red-ui-tertiary-text-color)}.red-ui-flow-debugger-message-load a{display:block;padding:6px 0 8px 25px}.red-ui-flow-debugger-annotation-paused{stroke:var(--red-ui-flow-debugger-breakpoint-active-stroke,#36b)} \ No newline at end of file diff --git a/monitoring/node-red/data/package-lock.json b/monitoring/node-red/data/package-lock.json new file mode 100644 index 0000000..df7edaf --- /dev/null +++ b/monitoring/node-red/data/package-lock.json @@ -0,0 +1,21 @@ +{ + "name": "node-red-project", + "version": "0.0.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "node-red-project", + "version": "0.0.1", + "dependencies": { + "node-red-debugger": "~1.1.1" + } + }, + "node_modules/node-red-debugger": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/node-red-debugger/-/node-red-debugger-1.1.1.tgz", + "integrity": "sha512-sEfBRYZk+ptqCOkDURC1IxJ6lr1yhdGUctxwL13EmLknQSsOzTJzcI+/nWF1RSBZmsCw4R8+TE1Kx4TnjX2X/g==", + "license": "Apache-2" + } + } +} diff --git a/monitoring/node-red/data/package.json b/monitoring/node-red/data/package.json new file mode 100644 index 0000000..e78b2cb --- /dev/null +++ b/monitoring/node-red/data/package.json @@ -0,0 +1,9 @@ +{ + "name": "node-red-project", + "description": "A Node-RED Project", + "version": "0.0.1", + "private": true, + "dependencies": { + "node-red-debugger": "~1.1.1" + } +} diff --git a/monitoring/node-red/data/settings.js b/monitoring/node-red/data/settings.js new file mode 100644 index 0000000..ef5af14 --- /dev/null +++ b/monitoring/node-red/data/settings.js @@ -0,0 +1,623 @@ +/** + * This is the default settings file provided by Node-RED. + * + * It can contain any valid JavaScript code that will get run when Node-RED + * is started. + * + * Lines that start with // are commented out. + * Each entry should be separated from the entries above and below by a comma ',' + * + * For more information about individual settings, refer to the documentation: + * https://nodered.org/docs/user-guide/runtime/configuration + * + * The settings are split into the following sections: + * - Flow File and User Directory Settings + * - Security + * - Server Settings + * - Runtime Settings + * - Editor Settings + * - Node Settings + * + **/ + +module.exports = { + +/******************************************************************************* + * Flow File and User Directory Settings + * - flowFile + * - credentialSecret + * - flowFilePretty + * - userDir + * - nodesDir + ******************************************************************************/ + + /** The file containing the flows. If not set, defaults to flows_.json **/ + flowFile: 'flows.json', + + /** By default, credentials are encrypted in storage using a generated key. To + * specify your own secret, set the following property. + * If you want to disable encryption of credentials, set this property to false. + * Note: once you set this property, do not change it - doing so will prevent + * node-red from being able to decrypt your existing credentials and they will be + * lost. + */ + //credentialSecret: "a-secret-key", + + /** By default, the flow JSON will be formatted over multiple lines making + * it easier to compare changes when using version control. + * To disable pretty-printing of the JSON set the following property to false. + */ + flowFilePretty: true, + + /** By default, all user data is stored in a directory called `.node-red` under + * the user's home directory. To use a different location, the following + * property can be used + */ + //userDir: '/home/nol/.node-red/', + + /** Node-RED scans the `nodes` directory in the userDir to find local node files. + * The following property can be used to specify an additional directory to scan. + */ + //nodesDir: '/home/nol/.node-red/nodes', + +/******************************************************************************* + * Security + * - adminAuth + * - https + * - httpsRefreshInterval + * - requireHttps + * - httpNodeAuth + * - httpStaticAuth + ******************************************************************************/ + + /** To password protect the Node-RED editor and admin API, the following + * property can be used. See https://nodered.org/docs/security.html for details. + */ + //adminAuth: { + // type: "credentials", + // users: [{ + // username: "admin", + // password: "$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN.", + // permissions: "*" + // }] + //}, + + /** The following property can be used to enable HTTPS + * This property can be either an object, containing both a (private) key + * and a (public) certificate, or a function that returns such an object. + * See http://nodejs.org/api/https.html#https_https_createserver_options_requestlistener + * for details of its contents. + */ + + /** Option 1: static object */ + //https: { + // key: require("fs").readFileSync('privkey.pem'), + // cert: require("fs").readFileSync('cert.pem') + //}, + + /** Option 2: function that returns the HTTP configuration object */ + // https: function() { + // // This function should return the options object, or a Promise + // // that resolves to the options object + // return { + // key: require("fs").readFileSync('privkey.pem'), + // cert: require("fs").readFileSync('cert.pem') + // } + // }, + + /** If the `https` setting is a function, the following setting can be used + * to set how often, in hours, the function will be called. That can be used + * to refresh any certificates. + */ + //httpsRefreshInterval : 12, + + /** The following property can be used to cause insecure HTTP connections to + * be redirected to HTTPS. + */ + //requireHttps: true, + + /** To password protect the node-defined HTTP endpoints (httpNodeRoot), + * including node-red-dashboard, or the static content (httpStatic), the + * following properties can be used. + * The `pass` field is a bcrypt hash of the password. + * See https://nodered.org/docs/security.html#generating-the-password-hash + */ + //httpNodeAuth: {user:"user",pass:"$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN."}, + //httpStaticAuth: {user:"user",pass:"$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN."}, + +/******************************************************************************* + * Server Settings + * - uiPort + * - uiHost + * - apiMaxLength + * - httpServerOptions + * - httpAdminRoot + * - httpAdminMiddleware + * - httpAdminCookieOptions + * - httpNodeRoot + * - httpNodeCors + * - httpNodeMiddleware + * - httpStatic + * - httpStaticRoot + * - httpStaticCors + ******************************************************************************/ + + /** the tcp port that the Node-RED web server is listening on */ + uiPort: process.env.PORT || 1880, + + /** By default, the Node-RED UI accepts connections on all IPv4 interfaces. + * To listen on all IPv6 addresses, set uiHost to "::", + * The following property can be used to listen on a specific interface. For + * example, the following would only allow connections from the local machine. + */ + //uiHost: "127.0.0.1", + + /** The maximum size of HTTP request that will be accepted by the runtime api. + * Default: 5mb + */ + //apiMaxLength: '5mb', + + /** The following property can be used to pass custom options to the Express.js + * server used by Node-RED. For a full list of available options, refer + * to http://expressjs.com/en/api.html#app.settings.table + */ + //httpServerOptions: { }, + + /** By default, the Node-RED UI is available at http://localhost:1880/ + * The following property can be used to specify a different root path. + * If set to false, this is disabled. + */ + //httpAdminRoot: '/admin', + + /** The following property can be used to add a custom middleware function + * in front of all admin http routes. For example, to set custom http + * headers. It can be a single function or an array of middleware functions. + */ + // httpAdminMiddleware: function(req,res,next) { + // // Set the X-Frame-Options header to limit where the editor + // // can be embedded + // //res.set('X-Frame-Options', 'sameorigin'); + // next(); + // }, + + /** The following property can be used to set addition options on the session + * cookie used as part of adminAuth authentication system + * Available options are documented here: https://www.npmjs.com/package/express-session#cookie + */ + // httpAdminCookieOptions: { }, + + /** Some nodes, such as HTTP In, can be used to listen for incoming http requests. + * By default, these are served relative to '/'. The following property + * can be used to specify a different root path. If set to false, this is + * disabled. + */ + //httpNodeRoot: '/red-nodes', + + /** The following property can be used to configure cross-origin resource sharing + * in the HTTP nodes. + * See https://github.com/troygoode/node-cors#configuration-options for + * details on its contents. The following is a basic permissive set of options: + */ + //httpNodeCors: { + // origin: "*", + // methods: "GET,PUT,POST,DELETE" + //}, + + /** If you need to set an http proxy please set an environment variable + * called http_proxy (or HTTP_PROXY) outside of Node-RED in the operating system. + * For example - http_proxy=http://myproxy.com:8080 + * (Setting it here will have no effect) + * You may also specify no_proxy (or NO_PROXY) to supply a comma separated + * list of domains to not proxy, eg - no_proxy=.acme.co,.acme.co.uk + */ + + /** The following property can be used to add a custom middleware function + * in front of all http in nodes. This allows custom authentication to be + * applied to all http in nodes, or any other sort of common request processing. + * It can be a single function or an array of middleware functions. + */ + //httpNodeMiddleware: function(req,res,next) { + // // Handle/reject the request, or pass it on to the http in node by calling next(); + // // Optionally skip our rawBodyParser by setting this to true; + // //req.skipRawBodyParser = true; + // next(); + //}, + + /** When httpAdminRoot is used to move the UI to a different root path, the + * following property can be used to identify a directory of static content + * that should be served at http://localhost:1880/. + * When httpStaticRoot is set differently to httpAdminRoot, there is no need + * to move httpAdminRoot + */ + //httpStatic: '/home/nol/node-red-static/', //single static source + /** + * OR multiple static sources can be created using an array of objects... + * Each object can also contain an options object for further configuration. + * See https://expressjs.com/en/api.html#express.static for available options. + * They can also contain an option `cors` object to set specific Cross-Origin + * Resource Sharing rules for the source. `httpStaticCors` can be used to + * set a default cors policy across all static routes. + */ + //httpStatic: [ + // {path: '/home/nol/pics/', root: "/img/"}, + // {path: '/home/nol/reports/', root: "/doc/"}, + // {path: '/home/nol/videos/', root: "/vid/", options: {maxAge: '1d'}} + //], + + /** + * All static routes will be appended to httpStaticRoot + * e.g. if httpStatic = "/home/nol/docs" and httpStaticRoot = "/static/" + * then "/home/nol/docs" will be served at "/static/" + * e.g. if httpStatic = [{path: '/home/nol/pics/', root: "/img/"}] + * and httpStaticRoot = "/static/" + * then "/home/nol/pics/" will be served at "/static/img/" + */ + //httpStaticRoot: '/static/', + + /** The following property can be used to configure cross-origin resource sharing + * in the http static routes. + * See https://github.com/troygoode/node-cors#configuration-options for + * details on its contents. The following is a basic permissive set of options: + */ + //httpStaticCors: { + // origin: "*", + // methods: "GET,PUT,POST,DELETE" + //}, + + /** The following property can be used to modify proxy options */ + // proxyOptions: { + // mode: "legacy", // legacy mode is for non-strict previous proxy determination logic (node-red < v4 compatible) + // }, + +/******************************************************************************* + * Runtime Settings + * - lang + * - runtimeState + * - telemetry + * - diagnostics + * - logging + * - contextStorage + * - exportGlobalContextKeys + * - externalModules + ******************************************************************************/ + + /** Uncomment the following to run node-red in your preferred language. + * Available languages include: en-US (default), ja, de, zh-CN, zh-TW, ru, ko + * Some languages are more complete than others. + */ + // lang: "de", + + /** Configure diagnostics options + * - enabled: When `enabled` is `true` (or unset), diagnostics data will + * be available at http://localhost:1880/diagnostics + * - ui: When `ui` is `true` (or unset), the action `show-system-info` will + * be available to logged in users of node-red editor + */ + diagnostics: { + /** enable or disable diagnostics endpoint. Must be set to `false` to disable */ + enabled: true, + /** enable or disable diagnostics display in the node-red editor. Must be set to `false` to disable */ + ui: true, + }, + /** Configure runtimeState options + * - enabled: When `enabled` is `true` flows runtime can be Started/Stopped + * by POSTing to available at http://localhost:1880/flows/state + * - ui: When `ui` is `true`, the action `core:start-flows` and + * `core:stop-flows` will be available to logged in users of node-red editor + * Also, the deploy menu (when set to default) will show a stop or start button + */ + runtimeState: { + /** enable or disable flows/state endpoint. Must be set to `false` to disable */ + enabled: false, + /** show or hide runtime stop/start options in the node-red editor. Must be set to `false` to hide */ + ui: false, + }, + telemetry: { + /** + * By default, telemetry is disabled until the user provides consent the first + * time they open the editor. + * + * The following property can be uncommented and set to true/false to enable/disable + * telemetry without seeking further consent in the editor. + * The user can override this setting via the user settings dialog within the editor + */ + // enabled: true, + /** + * If telemetry is enabled, the editor will notify the user if a new version of Node-RED + * is available. Set the following property to false to disable this notification. + */ + // updateNotification: true + }, + /** Configure the logging output */ + logging: { + /** Only console logging is currently supported */ + console: { + /** Level of logging to be recorded. Options are: + * fatal - only those errors which make the application unusable should be recorded + * error - record errors which are deemed fatal for a particular request + fatal errors + * warn - record problems which are non fatal + errors + fatal errors + * info - record information about the general running of the application + warn + error + fatal errors + * debug - record information which is more verbose than info + info + warn + error + fatal errors + * trace - record very detailed logging + debug + info + warn + error + fatal errors + * off - turn off all logging (doesn't affect metrics or audit) + */ + level: "info", + /** Whether or not to include metric events in the log output */ + metrics: false, + /** Whether or not to include audit events in the log output */ + audit: false + } + }, + + /** Context Storage + * The following property can be used to enable context storage. The configuration + * provided here will enable file-based context that flushes to disk every 30 seconds. + * Refer to the documentation for further options: https://nodered.org/docs/api/context/ + */ + contextStorage: { + default: { + module:"localfilesystem" + }, + }, + + /** `global.keys()` returns a list of all properties set in global context. + * This allows them to be displayed in the Context Sidebar within the editor. + * In some circumstances it is not desirable to expose them to the editor. The + * following property can be used to hide any property set in `functionGlobalContext` + * from being list by `global.keys()`. + * By default, the property is set to false to avoid accidental exposure of + * their values. Setting this to true will cause the keys to be listed. + */ + exportGlobalContextKeys: false, + + /** Configure how the runtime will handle external npm modules. + * This covers: + * - whether the editor will allow new node modules to be installed + * - whether nodes, such as the Function node are allowed to have their + * own dynamically configured dependencies. + * The allow/denyList options can be used to limit what modules the runtime + * will install/load. It can use '*' as a wildcard that matches anything. + */ + externalModules: { + // autoInstall: false, /** Whether the runtime will attempt to automatically install missing modules */ + // autoInstallRetry: 30, /** Interval, in seconds, between reinstall attempts */ + // palette: { /** Configuration for the Palette Manager */ + // allowInstall: true, /** Enable the Palette Manager in the editor */ + // allowUpdate: true, /** Allow modules to be updated in the Palette Manager */ + // allowUpload: true, /** Allow module tgz files to be uploaded and installed */ + // allowList: ['*'], + // denyList: [], + // allowUpdateList: ['*'], + // denyUpdateList: [] + // }, + // modules: { /** Configuration for node-specified modules */ + // allowInstall: true, + // allowList: [], + // denyList: [] + // } + }, + + +/******************************************************************************* + * Editor Settings + * - disableEditor + * - editorTheme + ******************************************************************************/ + + /** The following property can be used to disable the editor. The admin API + * is not affected by this option. To disable both the editor and the admin + * API, use either the httpRoot or httpAdminRoot properties + */ + //disableEditor: false, + + /** Customising the editor + * See https://nodered.org/docs/user-guide/runtime/configuration#editor-themes + * for all available options. + */ + editorTheme: { + /** The following property can be used to set a custom theme for the editor. + * See https://github.com/node-red-contrib-themes/theme-collection for + * a collection of themes to chose from. + */ + //theme: "", + + /** To disable the 'Welcome to Node-RED' tour that is displayed the first + * time you access the editor for each release of Node-RED, set this to false + */ + //tours: false, + + palette: { + /** The following property can be used to order the categories in the editor + * palette. If a node's category is not in the list, the category will get + * added to the end of the palette. + * If not set, the following default order is used: + */ + //categories: ['subflows', 'common', 'function', 'network', 'sequence', 'parser', 'storage'], + }, + + projects: { + /** To enable the Projects feature, set this value to true */ + enabled: false, + workflow: { + /** Set the default projects workflow mode. + * - manual - you must manually commit changes + * - auto - changes are automatically committed + * This can be overridden per-user from the 'Git config' + * section of 'User Settings' within the editor + */ + mode: "manual" + } + }, + + codeEditor: { + /** Select the text editor component used by the editor. + * As of Node-RED V3, this defaults to "monaco", but can be set to "ace" if desired + */ + lib: "monaco", + options: { + /** The follow options only apply if the editor is set to "monaco" + * + * theme - must match the file name of a theme in + * packages/node_modules/@node-red/editor-client/src/vendor/monaco/dist/theme + * e.g. "tomorrow-night", "upstream-sunburst", "github", "my-theme" + */ + // theme: "vs", + /** other overrides can be set e.g. fontSize, fontFamily, fontLigatures etc. + * for the full list, see https://microsoft.github.io/monaco-editor/docs.html#interfaces/editor.IStandaloneEditorConstructionOptions.html + */ + //fontSize: 14, + //fontFamily: "Cascadia Code, Fira Code, Consolas, 'Courier New', monospace", + //fontLigatures: true, + } + }, + + markdownEditor: { + mermaid: { + /** enable or disable mermaid diagram in markdown document + */ + enabled: true + } + }, + + multiplayer: { + /** To enable the Multiplayer feature, set this value to true */ + enabled: false + }, + }, + +/******************************************************************************* + * Node Settings + * - fileWorkingDirectory + * - functionGlobalContext + * - functionExternalModules + * - globalFunctionTimeout + * - functionTimeout + * - nodeMessageBufferMaxLength + * - ui (for use with Node-RED Dashboard) + * - debugUseColors + * - debugMaxLength + * - debugStatusLength + * - execMaxBufferSize + * - httpRequestTimeout + * - mqttReconnectTime + * - serialReconnectTime + * - socketReconnectTime + * - socketTimeout + * - tcpMsgQueueSize + * - inboundWebSocketTimeout + * - tlsConfigDisableLocalFiles + * - webSocketNodeVerifyClient + ******************************************************************************/ + + /** The working directory to handle relative file paths from within the File nodes + * defaults to the working directory of the Node-RED process. + */ + //fileWorkingDirectory: "", + + /** Allow the Function node to load additional npm modules directly */ + functionExternalModules: true, + + + /** + * The default timeout (in seconds) for all Function nodes. + * Individual nodes can set their own timeout value within their configuration. + */ + globalFunctionTimeout: 0, + + /** + * Default timeout, in seconds, for the Function node. 0 means no timeout is applied + * This value is applied when the node is first added to the workspace - any changes + * must then be made with the individual node configurations. + * To set a global timeout value, use `globalFunctionTimeout` + */ + functionTimeout: 0, + + /** The following property can be used to set predefined values in Global Context. + * This allows extra node modules to be made available with in Function node. + * For example, the following: + * functionGlobalContext: { os:require('os') } + * will allow the `os` module to be accessed in a Function node using: + * global.get("os") + */ + functionGlobalContext: { + // os:require('os'), + }, + + /** The maximum number of messages nodes will buffer internally as part of their + * operation. This applies across a range of nodes that operate on message sequences. + * defaults to no limit. A value of 0 also means no limit is applied. + */ + //nodeMessageBufferMaxLength: 0, + + /** If you installed the optional node-red-dashboard you can set it's path + * relative to httpNodeRoot + * Other optional properties include + * readOnly:{boolean}, + * middleware:{function or array}, (req,res,next) - http middleware + * ioMiddleware:{function or array}, (socket,next) - socket.io middleware + */ + //ui: { path: "ui" }, + + /** Colourise the console output of the debug node */ + //debugUseColors: true, + + /** The maximum length, in characters, of any message sent to the debug sidebar tab */ + debugMaxLength: 1000, + + /** The maximum length, in characters, of status messages under the debug node */ + //debugStatusLength: 32, + + /** Maximum buffer size for the exec node. Defaults to 10Mb */ + //execMaxBufferSize: 10000000, + + /** Timeout in milliseconds for HTTP request connections. Defaults to 120s */ + //httpRequestTimeout: 120000, + + /** Retry time in milliseconds for MQTT connections */ + mqttReconnectTime: 15000, + + /** Retry time in milliseconds for Serial port connections */ + serialReconnectTime: 15000, + + /** Retry time in milliseconds for TCP socket connections */ + //socketReconnectTime: 10000, + + /** Timeout in milliseconds for TCP server socket connections. Defaults to no timeout */ + //socketTimeout: 120000, + + /** Maximum number of messages to wait in queue while attempting to connect to TCP socket + * defaults to 1000 + */ + //tcpMsgQueueSize: 2000, + + /** Timeout in milliseconds for inbound WebSocket connections that do not + * match any configured node. Defaults to 5000 + */ + //inboundWebSocketTimeout: 5000, + + /** To disable the option for using local files for storing keys and + * certificates in the TLS configuration node, set this to true. + */ + //tlsConfigDisableLocalFiles: true, + + /** The following property can be used to verify WebSocket connection attempts. + * This allows, for example, the HTTP request headers to be checked to ensure + * they include valid authentication information. + */ + //webSocketNodeVerifyClient: function(info) { + // /** 'info' has three properties: + // * - origin : the value in the Origin header + // * - req : the HTTP request + // * - secure : true if req.connection.authorized or req.connection.encrypted is set + // * + // * The function should return true if the connection should be accepted, false otherwise. + // * + // * Alternatively, if this function is defined to accept a second argument, callback, + // * it can be used to verify the client asynchronously. + // * The callback takes three arguments: + // * - result : boolean, whether to accept the connection or not + // * - code : if result is false, the HTTP error status to return + // * - reason: if result is false, the HTTP reason string to return + // */ + //}, +} diff --git a/monitoring/node-red/data/test-container.sh b/monitoring/node-red/data/test-container.sh new file mode 100755 index 0000000..6337602 --- /dev/null +++ b/monitoring/node-red/data/test-container.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash +# test-container.sh +# Usage: ./test-container.sh container_name host + +container="$1" +host="$2" +test_name="testing-${container}" + +compose_script="/compose/${host}/services-up.sh" + +# Run container in detached mode +$compose_script --profile all run -d --name "$test_name" --build "$container" >/dev/null 2>&1 + +# Poll health status +timeout=60 # seconds +interval=2 # seconds +elapsed=0 +result=1 # default to failure + +while [ $elapsed -lt $timeout ]; do + status=$(docker inspect --format='{{.State.Health.Status}}' "$test_name" 2>/dev/null) + if [ "$status" == "healthy" ]; then +# echo "healthy" + result=0 # success + break + elif [ "$status" == "unhealthy" ]; then +# echo "unhealthy" + result=1 # failure + break + fi + sleep $interval + elapsed=$((elapsed + interval)) +done + +# Timeout case +if [ $elapsed -ge $timeout ]; then +# echo "timeout" + result=1 +fi + +# Cleanup +docker rm "$test_name" --force >/dev/null 2>&1 + +#echo "Exiting with $result" >&2 + +echo $result +exit $result diff --git a/monitoring/node-red/data/test-container.sh.old b/monitoring/node-red/data/test-container.sh.old new file mode 100755 index 0000000..96b7d89 --- /dev/null +++ b/monitoring/node-red/data/test-container.sh.old @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# test-container.sh +# Usage: ./test-container.sh container_name + +container="$1" +test_name="testing-${container}" +compose_script="/home/nixos/docker/services-up.sh" + +# Run container in detached mode +$compose_script --profile all run -d --name "$test_name" --rm --build "$container" + +# Poll health status +timeout=60 # seconds +interval=2 # seconds +elapsed=0 + +while [ $elapsed -lt $timeout ]; do + status=$(docker inspect --format='{{.State.Health.Status}}' "$test_name" 2>/dev/null) + if [ "$status" == "healthy" ]; then + echo "healthy" + break + elif [ "$status" == "unhealthy" ]; then + echo "unhealthy" + break + fi + sleep $interval + elapsed=$((elapsed + interval)) +done + +# Cleanup +docker rm -f "$test_name" >/dev/null 2>&1 diff --git a/monitoring/node-red/data/webhook.json b/monitoring/node-red/data/webhook.json new file mode 100644 index 0000000..39570d1 --- /dev/null +++ b/monitoring/node-red/data/webhook.json @@ -0,0 +1 @@ +{"receiver":"node-red","status":"firing","alerts":[{"status":"firing","labels":{"Active":"telegraf: 0 updates","Restored":"telegraf: 0 updates","alertname":"Updates","com_docker_compose_project":"core","compose_image":"telegraf:latest","container":"telegraf","grafana_folder":"Infrastructure","job":"container-updates","running_image":"telegraf:latest"},"annotations":{},"startsAt":"2026-03-31T01:16:10Z","endsAt":"0001-01-01T00:00:00Z","generatorURL":"https://grafana.lan.ddnsgeek.com/alerting/grafana/bfgysfo3iregwf/view?orgId=1","fingerprint":"49b1e1dbf1255191","silenceURL":"https://grafana.lan.ddnsgeek.com/alerting/silence/new?alertmanager=grafana&matcher=__alert_rule_uid__%3Dbfgysfo3iregwf&matcher=Active%3Dtelegraf%3A+0+updates&matcher=Restored%3Dtelegraf%3A+0+updates&matcher=com_docker_compose_project%3Dcore&matcher=compose_image%3Dtelegraf%3Alatest&matcher=container%3Dtelegraf&matcher=job%3Dcontainer-updates&matcher=running_image%3Dtelegraf%3Alatest&orgId=1","dashboardURL":"https://grafana.lan.ddnsgeek.com/d/ad895wr?from=1774916170000&orgId=1&to=1774926701171","panelURL":"https://grafana.lan.ddnsgeek.com/d/ad895wr?from=1774916170000&orgId=1&to=1774926701171&viewPanel=6","ruleUID":"bfgysfo3iregwf","values":{"A":1,"D":1},"valueString":"[ var='A' labels={com_docker_compose_project=core, compose_image=telegraf:latest, container=telegraf, job=container-updates, running_image=telegraf:latest} type='query' value=1 ], [ var='D' labels={com_docker_compose_project=core, compose_image=telegraf:latest, container=telegraf, job=container-updates, running_image=telegraf:latest} type='threshold' value=1 ]","orgId":1},{"status":"firing","labels":{"Active":"update-test: 0 updates","Restored":"update-test: 0 updates","alertname":"Updates","com_docker_compose_project":"core","compose_image":"nginx:1.27.1","container":"update-test","grafana_folder":"Infrastructure","job":"container-updates","running_image":"nginx:1.27.0"},"annotations":{},"startsAt":"2026-03-31T01:15:10Z","endsAt":"0001-01-01T00:00:00Z","generatorURL":"https://grafana.lan.ddnsgeek.com/alerting/grafana/bfgysfo3iregwf/view?orgId=1","fingerprint":"c56bd9f28943cfac","silenceURL":"https://grafana.lan.ddnsgeek.com/alerting/silence/new?alertmanager=grafana&matcher=__alert_rule_uid__%3Dbfgysfo3iregwf&matcher=Active%3Dupdate-test%3A+0+updates&matcher=Restored%3Dupdate-test%3A+0+updates&matcher=com_docker_compose_project%3Dcore&matcher=compose_image%3Dnginx%3A1.27.1&matcher=container%3Dupdate-test&matcher=job%3Dcontainer-updates&matcher=running_image%3Dnginx%3A1.27.0&orgId=1","dashboardURL":"https://grafana.lan.ddnsgeek.com/d/ad895wr?from=1774916110000&orgId=1&to=1774926701171","panelURL":"https://grafana.lan.ddnsgeek.com/d/ad895wr?from=1774916110000&orgId=1&to=1774926701171&viewPanel=6","ruleUID":"bfgysfo3iregwf","values":{"A":1,"D":1},"valueString":"[ var='A' labels={com_docker_compose_project=core, compose_image=nginx:1.27.1, container=update-test, job=container-updates, running_image=nginx:1.27.0} type='query' value=1 ], [ var='D' labels={com_docker_compose_project=core, compose_image=nginx:1.27.1, container=update-test, job=container-updates, running_image=nginx:1.27.0} type='threshold' value=1 ]","orgId":1}],"groupLabels":{"alertname":"Updates","grafana_folder":"Infrastructure"},"commonLabels":{"alertname":"Updates","com_docker_compose_project":"core","grafana_folder":"Infrastructure","job":"container-updates"},"commonAnnotations":{},"externalURL":"https://grafana.lan.ddnsgeek.com/","appVersion":"12.4.2","version":"1","groupKey":"{}/{__grafana_autogenerated__=\"true\"}/{__grafana_receiver__=\"node-red\"}/{__grafana_route_settings_hash__=\"f177b219cbbdd2e2\"}:{alertname=\"Updates\", grafana_folder=\"Infrastructure\"}","truncatedAlerts":0,"orgId":1,"title":"[FIRING:2] Updates Infrastructure (core container-updates)","state":"alerting","message":"**Firing**\n\nValue: A=1, D=1\nLabels:\n - alertname = Updates\n - Active = telegraf: 0 updates\n - Restored = telegraf: 0 updates\n - com_docker_compose_project = core\n - compose_image = telegraf:latest\n - container = telegraf\n - grafana_folder = Infrastructure\n - job = container-updates\n - running_image = telegraf:latest\nAnnotations:\nSource: https://grafana.lan.ddnsgeek.com/alerting/grafana/bfgysfo3iregwf/view?orgId=1\nSilence: https://grafana.lan.ddnsgeek.com/alerting/silence/new?alertmanager=grafana&matcher=__alert_rule_uid__%3Dbfgysfo3iregwf&matcher=Active%3Dtelegraf%3A+0+updates&matcher=Restored%3Dtelegraf%3A+0+updates&matcher=com_docker_compose_project%3Dcore&matcher=compose_image%3Dtelegraf%3Alatest&matcher=container%3Dtelegraf&matcher=job%3Dcontainer-updates&matcher=running_image%3Dtelegraf%3Alatest&orgId=1\nDashboard: https://grafana.lan.ddnsgeek.com/d/ad895wr?from=1774916170000&orgId=1&to=1774926701171\nPanel: https://grafana.lan.ddnsgeek.com/d/ad895wr?from=1774916170000&orgId=1&to=1774926701171&viewPanel=6\n\nValue: A=1, D=1\nLabels:\n - alertname = Updates\n - Active = update-test: 0 updates\n - Restored = update-test: 0 updates\n - com_docker_compose_project = core\n - compose_image = nginx:1.27.1\n - container = update-test\n - grafana_folder = Infrastructure\n - job = container-updates\n - running_image = nginx:1.27.0\nAnnotations:\nSource: https://grafana.lan.ddnsgeek.com/alerting/grafana/bfgysfo3iregwf/view?orgId=1\nSilence: https://grafana.lan.ddnsgeek.com/alerting/silence/new?alertmanager=grafana&matcher=__alert_rule_uid__%3Dbfgysfo3iregwf&matcher=Active%3Dupdate-test%3A+0+updates&matcher=Restored%3Dupdate-test%3A+0+updates&matcher=com_docker_compose_project%3Dcore&matcher=compose_image%3Dnginx%3A1.27.1&matcher=container%3Dupdate-test&matcher=job%3Dcontainer-updates&matcher=running_image%3Dnginx%3A1.27.0&orgId=1\nDashboard: https://grafana.lan.ddnsgeek.com/d/ad895wr?from=1774916110000&orgId=1&to=1774926701171\nPanel: https://grafana.lan.ddnsgeek.com/d/ad895wr?from=1774916110000&orgId=1&to=1774926701171&viewPanel=6\n"}