07/07/2018, 21:49
(Questo messaggio è stato modificato l'ultima volta il: 08/02/2019, 22:40 da Enrico Sartori.)
Non è una vera guida ma una dashboard già pronta che ho preparto da copiare ed importare nel vostro node-red per iniziare ad imparare ad usarlo e poterne discutere
nodi da aggiungere
https://flows.nodered.org/node/node-red-contrib-os
https://flows.nodered.org/node/node-red-contrib-cpu
nodi da aggiungere
https://flows.nodered.org/node/node-red-contrib-os
https://flows.nodered.org/node/node-red-contrib-cpu
Codice:
[{"id":"5978a128.299bc","type":"ui_button","z":"2433fb75.0f7e64","name":"Riavvia RPI","group":"2ff73ece.8889a2","order":1,"width":0,"height":0,"passthru":false,"label":"Riavvia RPI","color":"red","bgcolor":"yellow","icon":"fa-power-off","payload":"echo sudo reboot","payloadType":"str","topic":"","x":170,"y":100,"wires":[["2f688c77.b88844"]]},{"id":"2ad912c0.6bb0ce","type":"ui_toast","z":"2433fb75.0f7e64","position":"top right","displayTime":"30","highlight":"green","outputs":0,"ok":"sudo","cancel":"Annulla","topic":"","name":"Standard Output","x":720,"y":240,"wires":[]},{"id":"2f688c77.b88844","type":"exec","z":"2433fb75.0f7e64","command":"","addpay":true,"append":"","useSpawn":"false","timer":"0","oldrc":false,"name":"Comando","x":420,"y":280,"wires":[["2ad912c0.6bb0ce","316f303e.6f9fa","4cb3a53c.0e623c"],["94c5dc77.a3d57","4cb3a53c.0e623c"],["4cb3a53c.0e623c"]]},{"id":"94c5dc77.a3d57","type":"ui_toast","z":"2433fb75.0f7e64","position":"bottom left","displayTime":"30","highlight":"red","outputs":0,"ok":"OK","cancel":"","topic":"Errore","name":"Stardard Error","x":720,"y":280,"wires":[]},{"id":"316f303e.6f9fa","type":"ui_audio","z":"2433fb75.0f7e64","name":"TTS","group":"2ff73ece.8889a2","voice":"it-IT","always":true,"x":690,"y":200,"wires":[]},{"id":"d413bc7d.6a2d3","type":"ui_button","z":"2433fb75.0f7e64","name":"Spegni RPI","group":"2ff73ece.8889a2","order":3,"width":0,"height":0,"passthru":false,"label":"Spegni RPI","color":"yellow","bgcolor":"red","icon":"fa-plug","payload":"echo sudo shutdown","payloadType":"str","topic":"","x":170,"y":140,"wires":[["2f688c77.b88844"]]},{"id":"1936eb81.258354","type":"ui_button","z":"2433fb75.0f7e64","name":"Test DNS","group":"2ff73ece.8889a2","order":4,"width":0,"height":0,"passthru":false,"label":"Test DNS","color":"green","bgcolor":"white","icon":"fa-signal","payload":"ping -qc1 google.com 2>&1 | awk -F'/' 'END{ print (/^rtt/? \"OK \"$5\" ms\":\"FAIL\") }'","payloadType":"str","topic":"","x":180,"y":180,"wires":[["2f688c77.b88844"]]},{"id":"4b0c42de.597a8c","type":"ui_button","z":"2433fb75.0f7e64","name":"Test DNS","group":"2ff73ece.8889a2","order":5,"width":0,"height":0,"passthru":false,"label":"Test Internet","color":"green","bgcolor":"white","icon":"fa-signal","payload":"ping -qc1 8.8.8.8 2>&1 | awk -F'/' 'END{ print (/^rtt/? \"OK \"$5\" ms\":\"FAIL\") }'","payloadType":"str","topic":"","x":180,"y":220,"wires":[["2f688c77.b88844"]]},{"id":"4cb3a53c.0e623c","type":"debug","z":"2433fb75.0f7e64","name":"Debugger","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":700,"y":320,"wires":[]},{"id":"ea56fdc0.1b6cd","type":"ui_button","z":"2433fb75.0f7e64","name":"","group":"a601d645.259bf8","order":1,"width":0,"height":0,"passthru":false,"label":"Info RaspberryPi","color":"light-white","bgcolor":"#3366b7","icon":"fa-microchip","payload":"echo versione; head -n 1 /etc/os-release | cut -d'\"' -f2; echo nome; hostname; echo ip; hostname -I ","payloadType":"str","topic":"","x":150,"y":260,"wires":[["2f688c77.b88844"]]},{"id":"dd8a6a9a.1a0ed8","type":"inject","z":"2433fb75.0f7e64","name":"Timer","topic":"","payload":"","payloadType":"str","repeat":"1","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":520,"wires":[["9fd60c76.2f582","f7b6a331.f878a"]]},{"id":"9fd60c76.2f582","type":"Memory","z":"2433fb75.0f7e64","name":"RAM","x":330,"y":500,"wires":[["9714789b.70d278"]]},{"id":"9714789b.70d278","type":"ui_gauge","z":"2433fb75.0f7e64","name":"Memoria","group":"a601d645.259bf8","order":2,"width":"2","height":"2","gtype":"gage","title":"Memoria","label":"%","format":"{{msg.payload.memusage | number:0}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"60","seg2":"90","x":460,"y":500,"wires":[]},{"id":"ebcec6ff.bf1a48","type":"ui_button","z":"2433fb75.0f7e64","name":"Aggiorna Rpi","group":"2ff73ece.8889a2","order":0,"width":0,"height":0,"passthru":false,"label":"Aggiorna Rpi","color":"","bgcolor":"","icon":"fa-globe","payload":"sudo apt update; sudo apt upgrade -y","payloadType":"str","topic":"","x":170,"y":300,"wires":[["2f688c77.b88844"]]},{"id":"f7b6a331.f878a","type":"cpu","z":"2433fb75.0f7e64","name":"CPU","msgCore":false,"msgOverall":true,"x":330,"y":540,"wires":[["397c5ef4.d53972","d030c5ba.4d9f38"]]},{"id":"397c5ef4.d53972","type":"ui_chart","z":"2433fb75.0f7e64","name":"Grafico CPU","group":"a601d645.259bf8","order":5,"width":"0","height":"0","label":"Cpu %","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"100","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":470,"y":540,"wires":[[],[]]},{"id":"5cb45761.800038","type":"comment","z":"2433fb75.0f7e64","name":"Comandi Bash","info":"Inserisci un pulsante dashboard col comando che più preferisci","x":180,"y":40,"wires":[]},{"id":"f7eb814f.4a1c2","type":"comment","z":"2433fb75.0f7e64","name":"Esegui il comando nel payload","info":"","x":440,"y":200,"wires":[]},{"id":"a1eb2019.47f92","type":"comment","z":"2433fb75.0f7e64","name":"Interpreta l'output","info":"","x":720,"y":160,"wires":[]},{"id":"766f3981.45b998","type":"comment","z":"2433fb75.0f7e64","name":"Enrico Sartori per RaspberryItaly","info":"","x":490,"y":20,"wires":[]},{"id":"8495b4c2.274108","type":"comment","z":"2433fb75.0f7e64","name":"Ogni tot secondi...","info":"","x":150,"y":440,"wires":[]},{"id":"58882a33.2de954","type":"comment","z":"2433fb75.0f7e64","name":"...legge e visualizza i dati","info":"","x":410,"y":440,"wires":[]},{"id":"d030c5ba.4d9f38","type":"ui_gauge","z":"2433fb75.0f7e64","name":"CPU","group":"a601d645.259bf8","order":3,"width":"2","height":"2","gtype":"gage","title":"CPU","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"60","seg2":"90","x":450,"y":580,"wires":[]},{"id":"93439fc.d8b706","type":"exec","z":"2433fb75.0f7e64","command":"df -h --type=ext4 --output=pcent | grep -o '[0-9]\\+'","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"Disco Usato","x":310,"y":640,"wires":[["7b69f8cf.e97518"],[],[]]},{"id":"17eccdc5.c250f2","type":"inject","z":"2433fb75.0f7e64","name":"","topic":"","payload":"","payloadType":"str","repeat":"1800","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":640,"wires":[["93439fc.d8b706"]]},{"id":"7b69f8cf.e97518","type":"ui_gauge","z":"2433fb75.0f7e64","name":"","group":"a601d645.259bf8","order":4,"width":"2","height":"2","gtype":"donut","title":"Disco","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":450,"y":640,"wires":[]},{"id":"2ff73ece.8889a2","type":"ui_group","z":"","name":"Comandi","tab":"88dbc928.195cd8","order":2,"disp":true,"width":"6","collapse":false},{"id":"a601d645.259bf8","type":"ui_group","z":"","name":"Info","tab":"88dbc928.195cd8","order":3,"disp":true,"width":"6","collapse":false},{"id":"88dbc928.195cd8","type":"ui_tab","z":"","name":"RaspberryItaly | Dashboard by Enrico Sartori","icon":"fa-power-off","order":1}]
Libro | Blog EnricoSartori.it | YouTube
Se un utente ti è stato utile, aumenta la sua reputazione! premi il Pollicione!
Se un utente ti è stato utile, aumenta la sua reputazione! premi il Pollicione!