Skip to content

Instantly share code, notes, and snippets.

@papercodeIN
Last active June 23, 2024 15:51
Show Gist options
  • Save papercodeIN/b7289a6d5b6a187481667b9c1a77d9ff to your computer and use it in GitHub Desktop.
Save papercodeIN/b7289a6d5b6a187481667b9c1a77d9ff to your computer and use it in GitHub Desktop.
How to Monitor Raspberry Pi System Performance and Resources in Node-RED Dashboard

How to Monitor Raspberry Pi System Performance and Resources in Node-RED Dashboard

[
{
"id": "9cf3a6d.1104258",
"type": "tab",
"label": "Raspberry monitoring",
"disabled": false,
"info": ""
},
{
"id": "d4feb199.b898b",
"type": "ui_gauge",
"z": "9cf3a6d.1104258",
"name": "",
"group": "9cb4bc4d.96552",
"order": 1,
"width": "4",
"height": "4",
"gtype": "gage",
"title": "CPU Temperature",
"label": "C",
"format": "{{value}}",
"min": 0,
"max": "100",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "35",
"seg2": "60",
"diff": false,
"className": "",
"x": 683,
"y": 33,
"wires": []
},
{
"id": "c0682e5c.a4fc",
"type": "exec",
"z": "9cf3a6d.1104258",
"command": "vcgencmd measure_temp",
"addpay": false,
"append": "",
"useSpawn": "",
"timer": "",
"winHide": false,
"name": "RPi Temp.",
"x": 325.2221908569336,
"y": 46.33333683013916,
"wires": [
[
"95ae4c48.9f606"
],
[],
[]
]
},
{
"id": "2be04c82.d0af74",
"type": "inject",
"z": "9cf3a6d.1104258",
"name": "",
"repeat": "3",
"crontab": "",
"once": true,
"onceDelay": "",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 120,
"wires": [
[
"c0682e5c.a4fc",
"92285ea6.f97a7",
"c0ffe68.afd6e18"
]
]
},
{
"id": "95ae4c48.9f606",
"type": "function",
"z": "9cf3a6d.1104258",
"name": "",
"func": "str = msg.payload\nmsg.payload = str.substring(5,9);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 480,
"y": 40,
"wires": [
[
"d4feb199.b898b",
"4bae8072.e81c2"
]
]
},
{
"id": "f4592b30.2f0528",
"type": "ui_button",
"z": "9cf3a6d.1104258",
"name": "",
"group": "dd70abe0.14cb38",
"order": 1,
"width": 0,
"height": 0,
"passthru": false,
"label": "Reboot",
"tooltip": "",
"color": "",
"bgcolor": "",
"icon": "",
"payload": "",
"payloadType": "str",
"topic": "",
"x": 121.77785110473633,
"y": 371.7778253555298,
"wires": [
[
"cf3854e6.653878"
]
]
},
{
"id": "cf3854e6.653878",
"type": "exec",
"z": "9cf3a6d.1104258",
"command": "sudo reboot",
"addpay": false,
"append": "",
"useSpawn": "",
"timer": "",
"name": "Reboot",
"x": 322.00007247924805,
"y": 371.7778015136719,
"wires": [
[],
[],
[]
]
},
{
"id": "4b4a0861.092b28",
"type": "ui_button",
"z": "9cf3a6d.1104258",
"name": "",
"group": "dd70abe0.14cb38",
"order": 2,
"width": 0,
"height": 0,
"passthru": false,
"label": "Shutdown",
"tooltip": "",
"color": "",
"bgcolor": "red",
"icon": "",
"payload": "",
"payloadType": "str",
"topic": "",
"x": 111.3889274597168,
"y": 428.25005435943604,
"wires": [
[
"4de9dba1.ed7854"
]
]
},
{
"id": "4de9dba1.ed7854",
"type": "exec",
"z": "9cf3a6d.1104258",
"command": "sudo shutdown -h now",
"addpay": false,
"append": "",
"useSpawn": "",
"timer": "",
"name": "Shutdown",
"x": 331.2778129577637,
"y": 428.4722480773926,
"wires": [
[],
[],
[]
]
},
{
"id": "4bae8072.e81c2",
"type": "ui_chart",
"z": "9cf3a6d.1104258",
"name": "",
"group": "9cb4bc4d.96552",
"order": 5,
"width": "8",
"height": "6",
"label": "CPU Temperature",
"chartType": "line",
"legend": "false",
"xformat": "HH:mm:ss",
"interpolate": "linear",
"nodata": "",
"dot": false,
"ymin": "",
"ymax": "",
"removeOlder": "30",
"removeOlderPoints": "",
"removeOlderUnit": "60",
"cutout": 0,
"useOneColor": false,
"useUTC": false,
"colors": [
"#1f77b4",
"#aec7e8",
"#ff7f0e",
"#2ca02c",
"#98df8a",
"#d62728",
"#ff9896",
"#9467bd",
"#c5b0d5"
],
"outputs": 1,
"useDifferentColor": false,
"className": "",
"x": 683.9999389648438,
"y": 72.66667175292969,
"wires": [
[]
]
},
{
"id": "92285ea6.f97a7",
"type": "exec",
"z": "9cf3a6d.1104258",
"command": "top -d 0.5 -b -n2 | grep \"Cpu(s)\"|tail -n 1 | awk '{print $2 + $4}'",
"addpay": false,
"append": "",
"useSpawn": "",
"timer": "",
"winHide": false,
"name": "CPU Load",
"x": 325.2221908569336,
"y": 126.33333683013916,
"wires": [
[
"404f06.1e77b0fc",
"fe6303f14bfa5e20"
],
[],
[]
]
},
{
"id": "c0ffe68.afd6e18",
"type": "exec",
"z": "9cf3a6d.1104258",
"command": "free | awk 'NR==2 {printf \"%.2f\\n\", ($7 / $2) * 100}'",
"addpay": false,
"append": "",
"useSpawn": "",
"timer": "",
"winHide": false,
"name": "Free Memory",
"x": 330,
"y": 220,
"wires": [
[
"8cf70ed5.e49ec"
],
[],
[]
]
},
{
"id": "404f06.1e77b0fc",
"type": "ui_gauge",
"z": "9cf3a6d.1104258",
"name": "",
"group": "9cb4bc4d.96552",
"order": 4,
"width": "4",
"height": "4",
"gtype": "gage",
"title": "CPU",
"label": "CPU%",
"format": "{{value}}",
"min": 0,
"max": "100",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "",
"seg2": "",
"diff": false,
"className": "",
"x": 510,
"y": 120,
"wires": []
},
{
"id": "8cf70ed5.e49ec",
"type": "ui_gauge",
"z": "9cf3a6d.1104258",
"name": "",
"group": "9cb4bc4d.96552",
"order": 2,
"width": "4",
"height": "4",
"gtype": "gage",
"title": "Memory free",
"label": "%",
"format": "{{parseInt(value)}}",
"min": 0,
"max": "100",
"colors": [
"#ca3838",
"#e6e600",
"#00b500"
],
"seg1": "",
"seg2": "",
"diff": false,
"className": "",
"x": 530,
"y": 220,
"wires": []
},
{
"id": "a508a5b7.89a128",
"type": "exec",
"z": "9cf3a6d.1104258",
"command": "df -h",
"addpay": false,
"append": "",
"useSpawn": "",
"timer": "",
"winHide": false,
"name": "Disk Usage",
"x": 330,
"y": 300,
"wires": [
[
"a8dc2f34.5e32b"
],
[],
[]
]
},
{
"id": "ad4498e0.e7c278",
"type": "ui_gauge",
"z": "9cf3a6d.1104258",
"name": "",
"group": "9cb4bc4d.96552",
"order": 3,
"width": "4",
"height": "4",
"gtype": "gage",
"title": "Disk Space",
"label": "%",
"format": "{{value}}",
"min": 0,
"max": "100",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "",
"seg2": "",
"diff": false,
"className": "",
"x": 630,
"y": 300,
"wires": []
},
{
"id": "a8dc2f34.5e32b",
"type": "function",
"z": "9cf3a6d.1104258",
"name": "",
"func": "var re = /([0-9]{2})%/\nvar idx = msg.payload.search(re);\nvar str = msg.payload;\nif (idx >=0) {\n str = msg.payload.substring(idx, idx + 2);\n}\nmsg.payload = str;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 480,
"y": 300,
"wires": [
[
"ad4498e0.e7c278"
]
]
},
{
"id": "5e6e69bb.0e1d38",
"type": "inject",
"z": "9cf3a6d.1104258",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "60",
"crontab": "",
"once": true,
"onceDelay": "",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 300,
"wires": [
[
"a508a5b7.89a128"
]
]
},
{
"id": "620c2ccf.7c7584",
"type": "ui_text",
"z": "9cf3a6d.1104258",
"group": "dd70abe0.14cb38",
"order": 2,
"width": "6",
"height": "2",
"name": "",
"label": "IP Address",
"format": "{{value.substring(0, value.indexOf(\" \"))}}",
"layout": "col-center",
"x": 597.111156463623,
"y": 501.7777557373047,
"wires": []
},
{
"id": "19fadb42.3d0c25",
"type": "inject",
"z": "9cf3a6d.1104258",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "10",
"crontab": "",
"once": true,
"onceDelay": "",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 126.01936721801758,
"y": 487.3448371887207,
"wires": [
[
"9cce8e0f.766f7"
]
]
},
{
"id": "9cce8e0f.766f7",
"type": "exec",
"z": "9cf3a6d.1104258",
"command": "hostname",
"addpay": false,
"append": "-I",
"useSpawn": "",
"timer": "",
"name": "Get Local IP",
"x": 330.5749206542969,
"y": 487.84485054016113,
"wires": [
[
"620c2ccf.7c7584",
"b1e5e669.f1fd48"
],
[],
[]
]
},
{
"id": "fe6303f14bfa5e20",
"type": "ui_chart",
"z": "9cf3a6d.1104258",
"name": "",
"group": "9cb4bc4d.96552",
"order": 5,
"width": "8",
"height": "6",
"label": "CPU Load%",
"chartType": "line",
"legend": "false",
"xformat": "HH:mm:ss",
"interpolate": "linear",
"nodata": "",
"dot": false,
"ymin": "",
"ymax": "",
"removeOlder": "30",
"removeOlderPoints": "",
"removeOlderUnit": "60",
"cutout": 0,
"useOneColor": false,
"useUTC": false,
"colors": [
"#1f77b4",
"#aec7e8",
"#ff7f0e",
"#2ca02c",
"#98df8a",
"#d62728",
"#ff9896",
"#9467bd",
"#c5b0d5"
],
"outputs": 1,
"useDifferentColor": false,
"className": "",
"x": 530,
"y": 160,
"wires": [
[]
]
},
{
"id": "b1e5e669.f1fd48",
"type": "mqtt out",
"z": "9cf3a6d.1104258",
"d": true,
"name": "Send IP thru MQTT",
"topic": "raspberrypi3_ip_gama",
"qos": "0",
"retain": "true",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "14bc5267.4d798e",
"x": 617.111156463623,
"y": 441.7777557373047,
"wires": []
},
{
"id": "9cb4bc4d.96552",
"type": "ui_group",
"name": "System",
"tab": "ad4a1223.94ae8",
"order": 1,
"disp": true,
"width": "16",
"collapse": false,
"className": ""
},
{
"id": "dd70abe0.14cb38",
"type": "ui_group",
"name": "OS",
"tab": "ad4a1223.94ae8",
"order": 5,
"disp": true,
"width": "6",
"collapse": false
},
{
"id": "14bc5267.4d798e",
"type": "mqtt-broker",
"name": "",
"broker": "test.mosquitto.org",
"port": "1883",
"clientid": "",
"usetls": false,
"compatmode": true,
"keepalive": "60",
"cleansession": true,
"birthTopic": "raspberry_do_gama_alive",
"birthQos": "0",
"birthRetain": "true",
"birthPayload": "Raspberry ativo",
"closeTopic": "",
"closePayload": "",
"willTopic": "",
"willQos": "0",
"willPayload": ""
},
{
"id": "ad4a1223.94ae8",
"type": "ui_tab",
"z": "9cf3a6d.1104258",
"name": "Raspbery PI (Control Panel)",
"icon": "dashboard",
"order": 1,
"disabled": false,
"hidden": false
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment