/
gabelchik
/
dpcs-diagnostics
Обзор
Документация
Войти
/
gabelchik
/
dpcs-diagnostics
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
node-red-data/flows.json
181 строка
4 KB
Leo
между комп
22 июл 2026, 16:03
22 июл 2026, 16:03
2494a77
Код
Авторство
О чём код?
[ { "id": "flow_diag", "type": "tab", "label": "DPCS Diagnostics", "disabled": false, "info": "" }, { "id": "2f1ac5b2e9c3f6b5", "type": "websocket-listener", "path": "/ws/full-report", "wholemsg": "false" }, { "id": "inject_cron", "type": "inject", "z": "flow_diag", "name": "Периодический запуск", "props": [], "repeat": "15", "crontab": "", "once": true, "onceDelay": "0.1", "topic": "", "x": 170, "y": 120, "wires": [ [ "change_get" ] ] }, { "id": "change_get", "type": "change", "z": "flow_diag", "name": "Настройка GET", "rules": [ { "t": "set", "p": "method", "pt": "msg", "to": "GET", "tot": "str" }, { "t": "set", "p": "url", "pt": "msg", "to": "http://diagnostics-app:8000/api/v1/diagnostics", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 460, "y": 120, "wires": [ [ "http_req_diag" ] ] }, { "id": "inject_operator", "type": "inject", "z": "flow_diag", "name": "Частичная диагностика", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "{\"run_modules\":[\"resources\"]}", "payloadType": "json", "x": 150, "y": 200, "wires": [ [ "change_post" ] ] }, { "id": "change_post", "type": "change", "z": "flow_diag", "name": "Настройка POST", "rules": [ { "t": "set", "p": "method", "pt": "msg", "to": "POST", "tot": "str" }, { "t": "set", "p": "url", "pt": "msg", "to": "http://diagnostics-app:8000/api/v1/diagnostics/partial", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 450, "y": 200, "wires": [ [ "http_req_diag" ] ] }, { "id": "http_req_diag", "type": "http request", "z": "flow_diag", "name": "Запрос диагностики", "method": "use", "ret": "obj", "paytoqs": "ignore", "url": "", "tls": "", "persist": false, "proxy": "", "insecureHTTPParser": false, "authType": "", "senderr": false, "headers": [], "x": 740, "y": 160, "wires": [ [ "func_middleware", "314037193e234b98" ] ] }, { "id": "func_middleware", "type": "function", "z": "flow_diag", "name": "Middleware: Статус и Время", "func": "const report = msg.payload;\nconst nodeName = report.node_name || \"unknown_node\";\nlet serversCache = flow.get(\"serversCache\") || {};\n\nif (msg.statusCode === 200 && report) {\n serversCache[nodeName] = {\n status: report.status,\n timestamp: report.timestamp\n };\n} else {\n serversCache[nodeName] = {\n status: \"NETWORK_FAILURE\",\n timestamp: new Date().toISOString()\n };\n}\n\nflow.set(\"serversCache\", serversCache);\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1040, "y": 100, "wires": [ [] ] }, { "id": "314037193e234b98", "type": "websocket out", "z": "flow_diag", "name": "", "server": "2f1ac5b2e9c3f6b5", "client": "", "x": 1010, "y": 200, "wires": [] } ]