Skip to content

Instantly share code, notes, and snippets.

@papercodeIN
Last active June 23, 2024 15:52
Show Gist options
  • Select an option

  • Save papercodeIN/8e25a6d5bebecaf57d279a0bf8c63ec7 to your computer and use it in GitHub Desktop.

Select an option

Save papercodeIN/8e25a6d5bebecaf57d279a0bf8c63ec7 to your computer and use it in GitHub Desktop.
How to Monitor Windows System Performance and Resources in Node-RED Dashboard

How to Monitor Windows System Performance and Resources in Node-RED Dashboard Using the node-red-contrib-os Package

[
{
"id": "772e6979.67cd08",
"type": "tab",
"label": "System"
},
{
"id": "ed27cae4.70b728",
"type": "inject",
"z": "772e6979.67cd08",
"name": "update",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "2",
"crontab": "",
"once": true,
"onceDelay": "",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 120,
"y": 460,
"wires": [
[
"f25a9b1d.c6fce8",
"c63cb373.ce94f",
"21faa622.8c25da",
"7780c9ca.7581b8",
"7cf01d46.a3cad4"
]
]
},
{
"id": "240a76f3.9953ea",
"type": "function",
"z": "772e6979.67cd08",
"name": "",
"func": "msg.payload = msg.payload.loadavg[0];\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 515,
"y": 96,
"wires": [
[
"51dfac0c.fdc9c4"
]
]
},
{
"id": "5d85387c.957fb8",
"type": "function",
"z": "772e6979.67cd08",
"name": "",
"func": "msg.payload = msg.payload.loadavg[1];\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 516,
"y": 134,
"wires": [
[
"79d3dbc8.390014"
]
]
},
{
"id": "b33d4d45.a6673",
"type": "function",
"z": "772e6979.67cd08",
"name": "",
"func": "msg.payload = msg.payload.loadavg[2];\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 515,
"y": 177,
"wires": [
[
"1ff0080f.4e10c8"
]
]
},
{
"id": "51dfac0c.fdc9c4",
"type": "ui_gauge",
"z": "772e6979.67cd08",
"name": "CPU Load 1",
"group": "7853403.230cdc",
"order": 1,
"width": "4",
"height": "4",
"gtype": "gage",
"title": "1 Minute",
"label": "load",
"format": "{{value | number:2}}",
"min": 0,
"max": "4",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "",
"seg2": "",
"diff": false,
"className": "",
"x": 683,
"y": 96,
"wires": []
},
{
"id": "79d3dbc8.390014",
"type": "ui_gauge",
"z": "772e6979.67cd08",
"name": "CPU Load 2",
"group": "7853403.230cdc",
"order": 2,
"width": "4",
"height": "4",
"gtype": "gage",
"title": "5 Minutes",
"label": "load",
"format": "{{value | number:2}}",
"min": 0,
"max": "4",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "",
"seg2": "",
"diff": false,
"className": "",
"x": 683,
"y": 136,
"wires": []
},
{
"id": "1ff0080f.4e10c8",
"type": "ui_gauge",
"z": "772e6979.67cd08",
"name": "CPU Load 3",
"group": "7853403.230cdc",
"order": 4,
"width": "4",
"height": "4",
"gtype": "gage",
"title": "15 Minutes",
"label": "load",
"format": "{{value | number:2}}",
"min": 0,
"max": "4",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "",
"seg2": "",
"diff": false,
"className": "",
"x": 681,
"y": 178,
"wires": []
},
{
"id": "e6b8a679.aff648",
"type": "function",
"z": "772e6979.67cd08",
"name": "",
"func": "msg.payload = msg.payload.memusage;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 563,
"y": 779,
"wires": [
[
"cc57cdea.f9387"
]
]
},
{
"id": "cc57cdea.f9387",
"type": "ui_gauge",
"z": "772e6979.67cd08",
"name": "Memory Usage",
"group": "1d1da0fc.6ab84f",
"order": 1,
"width": "5",
"height": "5",
"gtype": "gage",
"title": "1 Minute",
"label": "Usage",
"format": "{{value | number:2}}",
"min": 0,
"max": "100",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "",
"seg2": "",
"diff": false,
"className": "",
"x": 747,
"y": 783,
"wires": []
},
{
"id": "dd0cca19.6f90a8",
"type": "function",
"z": "772e6979.67cd08",
"name": "",
"func": "function formatBytes(bytes,decimals) {\n if(bytes === 0) return '0 Byte';\n var k = 1000; // or 1024 for binary\n var dm = decimals + 1 || 3;\n var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n var i = Math.floor(Math.log(bytes) / Math.log(k));\n return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];\n}\n\nmsg.payload = formatBytes(msg.payload.totalmem);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 565,
"y": 822,
"wires": [
[
"4aeaebd1.24f4c4"
]
]
},
{
"id": "308d683f.10ab08",
"type": "function",
"z": "772e6979.67cd08",
"name": "",
"func": "function formatBytes(bytes,decimals) {\n if(bytes === 0) return '0 Byte';\n var k = 1000; // or 1024 for binary\n var dm = decimals + 1 || 3;\n var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n var i = Math.floor(Math.log(bytes) / Math.log(k));\n return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];\n}\n\nmsg.payload = formatBytes(msg.payload.freemem);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 563,
"y": 868,
"wires": [
[
"ef649e9b.dce7d"
]
]
},
{
"id": "4aeaebd1.24f4c4",
"type": "ui_text",
"z": "772e6979.67cd08",
"group": "1d1da0fc.6ab84f",
"order": 2,
"width": "0",
"height": "0",
"name": "",
"label": "Total Memory",
"format": "{{msg.payload}}",
"layout": "row-spread",
"x": 746,
"y": 826,
"wires": []
},
{
"id": "ef649e9b.dce7d",
"type": "ui_text",
"z": "772e6979.67cd08",
"group": "1d1da0fc.6ab84f",
"order": 3,
"width": "0",
"height": "0",
"name": "",
"label": "Free Memory",
"format": "{{msg.payload}}",
"layout": "row-spread",
"x": 750,
"y": 869,
"wires": []
},
{
"id": "20567afa.bd4466",
"type": "function",
"z": "772e6979.67cd08",
"name": "",
"func": "function timeConversion(millisec) {\n\n var seconds = (millisec / 1000).toFixed(1);\n\n var minutes = (millisec / (1000 * 60)).toFixed(1);\n\n var hours = (millisec / (1000 * 60 * 60)).toFixed(1);\n\n var days = (millisec / (1000 * 60 * 60 * 24)).toFixed(1);\n\n if (seconds < 60) {\n return seconds + \" Sec\";\n } else if (minutes < 60) {\n return minutes + \" Min\";\n } else if (hours < 24) {\n return hours + \" Hrs\";\n } else {\n return days + \" Days\"\n }\n}\n\nmsg.payload = timeConversion(msg.payload.uptime * 1000);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 521,
"y": 320,
"wires": [
[
"91bb24ba.6dba48"
]
]
},
{
"id": "91bb24ba.6dba48",
"type": "ui_text",
"z": "772e6979.67cd08",
"group": "a9912d64.97094",
"order": 1,
"width": "0",
"height": "0",
"name": "",
"label": "Uptime",
"format": "{{msg.payload}}",
"layout": "row-spread",
"x": 676,
"y": 319,
"wires": []
},
{
"id": "f745cace.30f2d8",
"type": "function",
"z": "772e6979.67cd08",
"name": "",
"func": "msg.payload = msg.payload.hostname;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 520,
"y": 357,
"wires": [
[
"f9bfd652.4be908"
]
]
},
{
"id": "f9bfd652.4be908",
"type": "ui_text",
"z": "772e6979.67cd08",
"group": "a9912d64.97094",
"order": 1,
"width": "0",
"height": "0",
"name": "",
"label": "Hostname",
"format": "{{msg.payload}}",
"layout": "row-spread",
"x": 688,
"y": 359,
"wires": []
},
{
"id": "3153bd68.82b782",
"type": "function",
"z": "772e6979.67cd08",
"name": "",
"func": "msg.payload = msg.payload.platform;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 522,
"y": 395,
"wires": [
[
"6c7dc269.a0180c"
]
]
},
{
"id": "6c7dc269.a0180c",
"type": "ui_text",
"z": "772e6979.67cd08",
"group": "a9912d64.97094",
"order": 1,
"width": "0",
"height": "0",
"name": "",
"label": "Platform",
"format": "{{msg.payload}}",
"layout": "row-spread",
"x": 684,
"y": 398,
"wires": []
},
{
"id": "7eec4b7e.c15ad4",
"type": "function",
"z": "772e6979.67cd08",
"name": "",
"func": "msg.payload = msg.payload.arch;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 523,
"y": 434,
"wires": [
[
"a6e5bcd3.7c90e"
]
]
},
{
"id": "a6e5bcd3.7c90e",
"type": "ui_text",
"z": "772e6979.67cd08",
"group": "a9912d64.97094",
"order": 1,
"width": "0",
"height": "0",
"name": "",
"label": "Arch",
"format": "{{msg.payload}}",
"layout": "row-spread",
"x": 672,
"y": 438,
"wires": []
},
{
"id": "6b4d7f76.271fb",
"type": "function",
"z": "772e6979.67cd08",
"name": "",
"func": "msg.payload = msg.payload.release;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 524,
"y": 470,
"wires": [
[
"f7e2d4a1.f3acf8"
]
]
},
{
"id": "f7e2d4a1.f3acf8",
"type": "ui_text",
"z": "772e6979.67cd08",
"group": "a9912d64.97094",
"order": 1,
"width": "0",
"height": "0",
"name": "",
"label": "Release",
"format": "{{msg.payload}}",
"layout": "row-spread",
"x": 684,
"y": 476,
"wires": []
},
{
"id": "8a945e71.8626b",
"type": "function",
"z": "772e6979.67cd08",
"name": "",
"func": "msg.payload = msg.payload.cpus[0].model;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 520,
"y": 580,
"wires": [
[
"6ce3fe6a.0088f",
"6ed6930f.dfaa0c",
"2cf68a4b.2caef6",
"6ad00145.d0875"
]
]
},
{
"id": "6ce3fe6a.0088f",
"type": "ui_text",
"z": "772e6979.67cd08",
"group": "a9912d64.97094",
"order": 1,
"width": "0",
"height": "0",
"name": "",
"label": "CPU 1",
"format": "{{msg.payload}}",
"layout": "row-spread",
"x": 675,
"y": 519,
"wires": []
},
{
"id": "6ed6930f.dfaa0c",
"type": "ui_text",
"z": "772e6979.67cd08",
"group": "a9912d64.97094",
"order": 1,
"width": "0",
"height": "0",
"name": "",
"label": "CPU 2",
"format": "{{msg.payload}}",
"layout": "row-spread",
"x": 677,
"y": 558,
"wires": []
},
{
"id": "2cf68a4b.2caef6",
"type": "ui_text",
"z": "772e6979.67cd08",
"group": "a9912d64.97094",
"order": 1,
"width": "0",
"height": "0",
"name": "",
"label": "CPU 3",
"format": "{{msg.payload}}",
"layout": "row-spread",
"x": 679,
"y": 599,
"wires": []
},
{
"id": "6ad00145.d0875",
"type": "ui_text",
"z": "772e6979.67cd08",
"group": "a9912d64.97094",
"order": 1,
"width": "0",
"height": "0",
"name": "",
"label": "CPU 4",
"format": "{{msg.payload}}",
"layout": "row-spread",
"x": 670,
"y": 640,
"wires": []
},
{
"id": "a25b88bc.6ead88",
"type": "function",
"z": "772e6979.67cd08",
"name": "",
"func": "msg.payload = msg.payload.loadavg[0];\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 520,
"y": 220,
"wires": [
[
"a978ef7f.6851a"
]
]
},
{
"id": "a978ef7f.6851a",
"type": "ui_chart",
"z": "772e6979.67cd08",
"name": "CPU Load - Historical",
"group": "7853403.230cdc",
"order": 0,
"width": "0",
"height": "0",
"label": "24 Hours",
"chartType": "line",
"legend": "false",
"xformat": "%H:%M:%S",
"interpolate": "linear",
"nodata": "",
"ymin": "",
"ymax": "",
"removeOlder": 1,
"removeOlderUnit": "86400",
"outputs": 2,
"x": 712,
"y": 220,
"wires": [
[],
[]
]
},
{
"id": "fbd3e7db.8ca558",
"type": "function",
"z": "772e6979.67cd08",
"name": "",
"func": "msg.payload = msg.payload.memusage;\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 560,
"y": 740,
"wires": [
[
"ae72c338.cf1ff"
]
]
},
{
"id": "ae72c338.cf1ff",
"type": "ui_chart",
"z": "772e6979.67cd08",
"name": "Memory - 24 Hours",
"group": "1d1da0fc.6ab84f",
"order": 0,
"width": "0",
"height": "0",
"label": "24 Hours",
"chartType": "line",
"legend": "false",
"xformat": "%H:%M:%S",
"interpolate": "linear",
"nodata": "",
"ymin": "",
"ymax": "",
"removeOlder": 1,
"removeOlderUnit": "86400",
"outputs": 2,
"x": 758,
"y": 743,
"wires": [
[],
[]
]
},
{
"id": "6d8c1a68.736494",
"type": "comment",
"z": "772e6979.67cd08",
"name": "CPU Load",
"info": "",
"x": 353,
"y": 56,
"wires": []
},
{
"id": "c759448a.854258",
"type": "comment",
"z": "772e6979.67cd08",
"name": "Memory Usage",
"info": "",
"x": 380,
"y": 700,
"wires": []
},
{
"id": "ff2b3794.382148",
"type": "comment",
"z": "772e6979.67cd08",
"name": "System Information",
"info": "",
"x": 390,
"y": 280,
"wires": []
},
{
"id": "f25a9b1d.c6fce8",
"type": "OS",
"z": "772e6979.67cd08",
"name": "",
"x": 350,
"y": 400,
"wires": [
[
"f745cace.30f2d8",
"3153bd68.82b782",
"7eec4b7e.c15ad4",
"6b4d7f76.271fb"
]
]
},
{
"id": "c63cb373.ce94f",
"type": "Uptime",
"z": "772e6979.67cd08",
"name": "",
"x": 360,
"y": 320,
"wires": [
[
"20567afa.bd4466"
]
]
},
{
"id": "21faa622.8c25da",
"type": "CPUs",
"z": "772e6979.67cd08",
"name": "",
"x": 350,
"y": 580,
"wires": [
[
"8a945e71.8626b"
]
]
},
{
"id": "7780c9ca.7581b8",
"type": "Loadavg",
"z": "772e6979.67cd08",
"name": "",
"x": 353,
"y": 156,
"wires": [
[
"240a76f3.9953ea",
"5d85387c.957fb8",
"b33d4d45.a6673",
"a25b88bc.6ead88"
]
]
},
{
"id": "7cf01d46.a3cad4",
"type": "Memory",
"z": "772e6979.67cd08",
"name": "",
"x": 360,
"y": 800,
"wires": [
[
"e6b8a679.aff648",
"dd0cca19.6f90a8",
"308d683f.10ab08",
"fbd3e7db.8ca558"
]
]
},
{
"id": "7853403.230cdc",
"type": "ui_group",
"name": "CPU Load",
"tab": "e6013c6f.69328",
"order": 2,
"disp": true,
"width": "12",
"collapse": false,
"className": ""
},
{
"id": "1d1da0fc.6ab84f",
"type": "ui_group",
"name": "Memory",
"tab": "e6013c6f.69328",
"order": 3,
"disp": true,
"width": "6"
},
{
"id": "a9912d64.97094",
"type": "ui_group",
"name": "System Information",
"tab": "e6013c6f.69328",
"order": 1,
"disp": true,
"width": "6"
},
{
"id": "e6013c6f.69328",
"type": "ui_tab",
"name": "System",
"icon": "computer"
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment