Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [
- {
- "id": "23d2490305cb0609",
- "type": "group",
- "z": "1e32d6e89ce21de1",
- "name": "MainOffice Status",
- "style": {
- "stroke": "#ffff00",
- "label": true,
- "color": "#000000",
- "fill": "#ffff00"
- },
- "nodes": [
- "2eda9e9146d0c28a",
- "95dbde41aedc2207",
- "fde7ace2244b6fca",
- "3282312c2ce6c0ec",
- "ec4e2a623b721c9d",
- "692678513817a5c4",
- "546d291493483958",
- "3f9c0d455921ed2a",
- "e70a45b001a9ee12",
- "e20b3a694b4cacde",
- "56b150a54d99e71d",
- "6d96c26b0c61368e",
- "da43c62cb7cd668c",
- "6b633b0827291612",
- "2b9cb8fbeab5f04b",
- "307619128adbc77b",
- "9f9f42d0b01c4f28",
- "96ac73962e0fa3fd"
- ],
- "x": 1074,
- "y": 239,
- "w": 862,
- "h": 389.5
- },
- {
- "id": "2eda9e9146d0c28a",
- "type": "ui-button",
- "z": "1e32d6e89ce21de1",
- "g": "23d2490305cb0609",
- "group": "811a74e1e67d6a78",
- "name": "Clear Badge Print Queue",
- "label": "Clear Badge Print Queue",
- "order": 3,
- "width": 0,
- "height": 0,
- "tooltip": "",
- "color": "",
- "bgcolor": "",
- "className": "",
- "icon": "",
- "payload": "",
- "payloadType": "str",
- "topic": "topic",
- "topicType": "msg",
- "x": 1210,
- "y": 500,
- "wires": [
- [
- "692678513817a5c4"
- ]
- ]
- },
- {
- "id": "95dbde41aedc2207",
- "type": "ui-button",
- "z": "1e32d6e89ce21de1",
- "g": "23d2490305cb0609",
- "group": "811a74e1e67d6a78",
- "name": "Reboot Badge Server",
- "label": "Reboot Badge Server",
- "order": 5,
- "width": 0,
- "height": 0,
- "tooltip": "",
- "color": "",
- "bgcolor": "",
- "className": "",
- "icon": "",
- "payload": "",
- "payloadType": "str",
- "topic": "topic",
- "topicType": "msg",
- "x": 1200,
- "y": 580,
- "wires": [
- [
- "ec4e2a623b721c9d"
- ]
- ]
- },
- {
- "id": "fde7ace2244b6fca",
- "type": "ui-text",
- "z": "1e32d6e89ce21de1",
- "g": "23d2490305cb0609",
- "group": "811a74e1e67d6a78",
- "order": 2,
- "width": 0,
- "height": 0,
- "name": "Step One",
- "label": "Step One",
- "format": "{{msg.payload}}",
- "layout": "row-spread",
- "x": 1160,
- "y": 460,
- "wires": []
- },
- {
- "id": "3282312c2ce6c0ec",
- "type": "ui-text",
- "z": "1e32d6e89ce21de1",
- "g": "23d2490305cb0609",
- "group": "811a74e1e67d6a78",
- "order": 4,
- "width": 0,
- "height": 0,
- "name": "Step Two",
- "label": "Step Two (if step one does not fix it)",
- "format": "{{msg.payload}}",
- "layout": "row-spread",
- "x": 1160,
- "y": 540,
- "wires": []
- },
- {
- "id": "ec4e2a623b721c9d",
- "type": "exec",
- "z": "1e32d6e89ce21de1",
- "g": "23d2490305cb0609",
- "command": "ssh [email protected] qm reboot 102",
- "addpay": false,
- "append": "",
- "useSpawn": "false",
- "timer": "",
- "winHide": false,
- "oldrc": false,
- "name": "",
- "x": 1475,
- "y": 580,
- "wires": [
- [
- "3f9c0d455921ed2a",
- "e20b3a694b4cacde"
- ],
- [],
- []
- ]
- },
- {
- "id": "692678513817a5c4",
- "type": "exec",
- "z": "1e32d6e89ce21de1",
- "g": "23d2490305cb0609",
- "command": "ssh -i /home/node-red-user/.ssh/id_rsa_printqueue [email protected] powershell.exe -NoProfile -ExecutionPolicy Bypass -EncodedCommand RwBlAHQALQBQAHIAaQBuAHQASgBvAGIAIAAtAFAAcgBpAG4AdABlAHIATgBhAG0AZQAgACIARQB2AG8AbABpAHMAIABQAHIAaQBtAGEAYwB5ACAAMgAiACAALQBFAHIAcgBvAHIAQQBjAHQAaQBvAG4AIABTAGkAbABlAG4AdABsAHkAQwBvAG4AdABpAG4AdQBlACAAfAAgAFIAZQBtAG8AdgBlAC0AUAByAGkAbgB0AEoAbwBiACAALQBFAHIAcgBvAHIAQQBjAHQAaQBvAG4AIABTAGkAbABlAG4AdABsAHkAQwBvAG4AdABpAG4AdQBlAA==",
- "addpay": false,
- "append": "",
- "useSpawn": "false",
- "timer": "",
- "winHide": false,
- "oldrc": false,
- "name": "Command",
- "x": 1410,
- "y": 500,
- "wires": [
- [
- "546d291493483958",
- "e70a45b001a9ee12"
- ],
- [],
- []
- ]
- },
- {
- "id": "546d291493483958",
- "type": "ui-notification",
- "z": "1e32d6e89ce21de1",
- "g": "23d2490305cb0609",
- "position": "top right",
- "displayTime": "3",
- "outputs": 0,
- "name": "Queue Notification",
- "x": 1610,
- "y": 500,
- "wires": []
- },
- {
- "id": "3f9c0d455921ed2a",
- "type": "ui-notification",
- "z": "1e32d6e89ce21de1",
- "g": "23d2490305cb0609",
- "position": "top right",
- "displayTime": "3",
- "outputs": 0,
- "name": "Reboot Notification",
- "x": 1750,
- "y": 580,
- "wires": []
- },
- {
- "id": "e70a45b001a9ee12",
- "type": "template",
- "z": "1e32d6e89ce21de1",
- "g": "23d2490305cb0609",
- "name": "",
- "field": "payload",
- "fieldType": "msg",
- "format": "handlebars",
- "syntax": "mustache",
- "template": "Queue Cleared\n",
- "output": "str",
- "x": 1580,
- "y": 460,
- "wires": [
- [
- "96ac73962e0fa3fd"
- ]
- ]
- },
- {
- "id": "e20b3a694b4cacde",
- "type": "template",
- "z": "1e32d6e89ce21de1",
- "g": "23d2490305cb0609",
- "name": "",
- "field": "payload",
- "fieldType": "msg",
- "format": "handlebars",
- "syntax": "mustache",
- "template": "Badge Server Rebooted",
- "output": "str",
- "x": 1700,
- "y": 540,
- "wires": [
- [
- "96ac73962e0fa3fd"
- ]
- ]
- },
- {
- "id": "56b150a54d99e71d",
- "type": "function",
- "z": "1e32d6e89ce21de1",
- "g": "23d2490305cb0609",
- "name": "Check Servers",
- "func": "// List of servers to check\nconst servers = [\n { name: 'BackupServer', host: '10.0.0.242' },\n { name: 'PrintServer', host: '10.0.0.205' },\n { name: 'ProxyServer1', host: '10.0.0.211' },\n { name: 'ProxyServer2', host: '10.0.0.240' },\n { name: 'ProxyServer3', host: '10.0.0.7' },\n { name: 'DatabaseServer', host: '10.0.0.33' },\n { name: 'GateControl', host: '10.0.0.252'}\n];\n\n// Placeholder for ping functionality\n// In a real environment, you would use an appropriate library\nconst ping = {\n promise: {\n probe: async (host) => {\n // This is a mock. Replace with actual ping logic.\n return { alive: Math.random() > 0.1 }; // Simulate 90% success rate\n }\n }\n};\n\n// Perform pings asynchronously\nasync function pingAll() {\n const failed = [];\n const failedNames = [];\n const pingPromises = servers.map(async (server) => {\n try {\n const res = await ping.promise.probe(server.host, { timeout: 5 });\n if (!res.alive) {\n failed.push(server.host);\n failedNames.push(server.name);\n }\n return res.alive;\n } catch (e) {\n failed.push(server.host);\n failedNames.push(server.name);\n return false;\n }\n });\n\n const results = await Promise.all(pingPromises);\n const allSuccessful = results.every(result => result === true);\n\n msg.payload = allSuccessful;\n msg.who = allSuccessful ? [] : failed;\n if (!allSuccessful) {\n msg.failedServers = failedNames.join(', ');\n }\n\n // Update node status\n if (allSuccessful) {\n node.status({ fill: 'green', shape: 'dot', text: 'All servers OK' });\n } else {\n node.status({ fill: 'red', shape: 'ring', text: `Failed: ${failed.join(', ')}` });\n }\n\n return msg;\n}\n\n// Execute pings and return message\nreturn pingAll();",
- "outputs": 1,
- "noerr": 0,
- "initialize": "",
- "finalize": "",
- "libs": [],
- "x": 1360,
- "y": 340,
- "wires": [
- [
- "6d96c26b0c61368e",
- "6b633b0827291612",
- "2b9cb8fbeab5f04b"
- ]
- ]
- },
- {
- "id": "6d96c26b0c61368e",
- "type": "ui_led",
- "z": "1e32d6e89ce21de1",
- "g": "928dac7e3004687d",
- "group": "894f972b49de2bb4",
- "order": 9,
- "width": 0,
- "height": 0,
- "label": "MainOffice Servers",
- "labelPlacement": "left",
- "labelAlignment": "left",
- "colorForValue": [
- {
- "color": "#ff0000",
- "value": "false",
- "valueType": "bool"
- },
- {
- "color": "#00ff00",
- "value": "true",
- "valueType": "bool"
- }
- ],
- "allowColorForValueInMessage": false,
- "shape": "circle",
- "showGlow": true,
- "name": "MainOffice Servers",
- "x": 1600,
- "y": 340,
- "wires": []
- },
- {
- "id": "da43c62cb7cd668c",
- "type": "ui-text",
- "z": "1e32d6e89ce21de1",
- "g": "23d2490305cb0609",
- "group": "894f972b49de2bb4",
- "order": 10,
- "width": 0,
- "height": 0,
- "name": "MainOfficeServersTxt",
- "label": "Issue List:",
- "format": "{{msg.payload}}",
- "layout": "row-left",
- "x": 1810,
- "y": 420,
- "wires": []
- },
- {
- "id": "6b633b0827291612",
- "type": "change",
- "z": "1e32d6e89ce21de1",
- "g": "23d2490305cb0609",
- "name": "",
- "rules": [
- {
- "t": "set",
- "p": "payload",
- "pt": "msg",
- "to": "failedServers",
- "tot": "msg"
- }
- ],
- "action": "",
- "property": "",
- "from": "",
- "to": "",
- "reg": false,
- "x": 1600,
- "y": 420,
- "wires": [
- [
- "da43c62cb7cd668c"
- ]
- ]
- },
- {
- "id": "2b9cb8fbeab5f04b",
- "type": "switch",
- "z": "1e32d6e89ce21de1",
- "g": "23d2490305cb0609",
- "name": "",
- "property": "payload",
- "propertyType": "msg",
- "rules": [
- {
- "t": "true"
- },
- {
- "t": "false"
- }
- ],
- "checkall": "true",
- "repair": false,
- "outputs": 2,
- "x": 1570,
- "y": 380,
- "wires": [
- [
- "307619128adbc77b"
- ],
- []
- ]
- },
- {
- "id": "307619128adbc77b",
- "type": "change",
- "z": "1e32d6e89ce21de1",
- "g": "23d2490305cb0609",
- "name": "",
- "rules": [
- {
- "t": "set",
- "p": "payload",
- "pt": "msg",
- "to": "All OK!",
- "tot": "str"
- }
- ],
- "action": "",
- "property": "",
- "from": "",
- "to": "",
- "reg": false,
- "x": 1720,
- "y": 380,
- "wires": [
- [
- "da43c62cb7cd668c"
- ]
- ]
- },
- {
- "id": "9f9f42d0b01c4f28",
- "type": "inject",
- "z": "1e32d6e89ce21de1",
- "g": "23d2490305cb0609",
- "name": "",
- "props": [
- {
- "p": "payload"
- },
- {
- "p": "topic",
- "vt": "str"
- }
- ],
- "repeat": "15",
- "crontab": "",
- "once": true,
- "onceDelay": 0.1,
- "topic": "",
- "payload": "",
- "payloadType": "date",
- "x": 1290,
- "y": 280,
- "wires": [
- [
- "56b150a54d99e71d"
- ]
- ]
- },
- {
- "id": "96ac73962e0fa3fd",
- "type": "http request",
- "z": "1e32d6e89ce21de1",
- "g": "23d2490305cb0609",
- "name": "",
- "method": "POST",
- "ret": "txt",
- "paytoqs": "ignore",
- "url": "https://ntfy.example.com/MyServers",
- "tls": "",
- "persist": false,
- "proxy": "",
- "authType": "",
- "x": 1830,
- "y": 500,
- "wires": [
- []
- ]
- },
- {
- "id": "811a74e1e67d6a78",
- "type": "ui_group",
- "name": "System Controls",
- "page": "c04e10945eb62c25",
- "width": "6",
- "height": "1",
- "order": -1,
- "showTitle": true,
- "tab": "c04e10945eb62c25"
- },
- {
- "id": "894f972b49de2bb4",
- "type": "ui-group",
- "name": "Servers",
- "page": "c04e10945eb62c25",
- "width": 6,
- "height": 1,
- "order": 2,
- "showTitle": true,
- "className": "",
- "visible": "true",
- "disabled": "false",
- "groupType": "default"
- },
- {
- "id": "c04e10945eb62c25",
- "type": "ui-page",
- "name": "Main Control",
- "ui": "45ca1105dfb31f68",
- "path": "/page1",
- "icon": "home",
- "layout": "grid",
- "theme": "63fdccd97cf5caec",
- "breakpoints": [
- {
- "name": "Default",
- "px": "0",
- "cols": "3"
- },
- {
- "name": "Tablet",
- "px": "576",
- "cols": "6"
- },
- {
- "name": "Small Desktop",
- "px": "768",
- "cols": "9"
- },
- {
- "name": "Desktop",
- "px": "1024",
- "cols": "12"
- }
- ],
- "order": 1,
- "className": "",
- "visible": "true",
- "disabled": "false"
- },
- {
- "id": "45ca1105dfb31f68",
- "type": "ui-base",
- "name": "My Dashboard",
- "path": "/dashboard",
- "appIcon": "",
- "includeClientData": true,
- "acceptsClientConfig": [
- "ui-notification",
- "ui-control"
- ],
- "showPathInSidebar": false,
- "headerContent": "page",
- "navigationStyle": "default",
- "titleBarStyle": "default",
- "showReconnectNotification": true,
- "notificationDisplayTime": 1,
- "showDisconnectNotification": true,
- "allowInstall": true
- },
- {
- "id": "63fdccd97cf5caec",
- "type": "ui-theme",
- "name": "Default Theme",
- "colors": {
- "surface": "#ffffff",
- "primary": "#0094CE",
- "bgPage": "#eeeeee",
- "groupBg": "#ffffff",
- "groupOutline": "#cccccc"
- },
- "sizes": {
- "density": "default",
- "pagePadding": "12px",
- "groupGap": "12px",
- "groupBorderRadius": "4px",
- "widgetGap": "12px"
- }
- },
- {
- "id": "9f14354163ed49e0",
- "type": "global-config",
- "env": [],
- "modules": {
- "@flowfuse/node-red-dashboard": "1.24.2"
- }
- }
- ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement