MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    CPU-Temperature as a graph with RRDtool

    Scheduled Pinned Locked Moved Utilities
    1 Posts 1 Posters 881 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • thgmirrorT Offline
      thgmirror
      last edited by thgmirror

      I added a graph about the progress of the CPU-temperture of my RPI3 to my MM via RRDtool:
      3b90bc2e-76cd-4e30-a2c4-5434cb843638-image.png
      It looks a little bit nerdy, but the temperature is a nerdy hardware characteristic. OK, it is not so beautiful like grafana…but much easier to use.
      Therefor, it needs only a few steps to realize it:

      sudo apt-get install rrdtool
      

      will install it.
      Only one time create the database in the terminal session:

      rrdtool create cputemp.rrd --step 300 DS:temp:GAUGE:600:-20:90 RRA:AVERAGE:0.5:12:24 RRA:AVERAGE:0.5:288:31
      

      Add two tasks to crontab:

      2-57/5 * * * * rrdtool update cputemp.rrd N:$(vcgencmd measure_temp | cut -c "6-9")
      

      moves every 5 minutes the temperature to the database established above.

      0 * * * * rrdtool graph /home/pi/MagicMirror/modules/cputemp.gif --start -24h --title "CPU-Temperatur" --vertical-label "Grad Celsius" --disable-rrdtool-tag DEF:cputemperatur=cputemp.rrd:temp:AVERAGE LINE1:cputemperatur#ff0000:"CPU-Temperatur" ;
      

      generates once in an hour a graph which will be displayed later. If you like, you can adjust the map legend (“CPU-Temperatur” and “Grad Celsius”) with descriptions in your language.

      Now create a file named cputemp.html in the modules-folder of your MM:

      <HTML>
      <HEAD>
      <TITLE>CPU Temperatur</TITLE>
      </HEAD>
      <body bgcolor=#000000>
      	<img src="cputemp.gif"/>
      </body>
      </HTML>
      

      and use MMM-SmartWebDisplay in your config.js to show it:

      //#################################################################################
      		{
      			disabled: false,
      			module: 'MMM-SmartWebDisplay',
      			position: 'top_center',
      			config: {
      				logDebug: false,
      				height: "180",
      				width:"500",
      				updateInterval: 0,
      				NextURLInterval: 0,
      				displayLastUpdate: false,
      				url: ["/modules/cputemp.html"],
      				}
      		},
      //#################################################################################
      

      Based on these steps, some more modifications of the appearance are possible. Please use your favorite search-engine for more.

      1 Reply Last reply Reply Quote 1
      • thgmirrorT thgmirror referenced this topic on
      • 1 / 1
      • First post
        Last post
      Enjoying MagicMirror? Please consider a donation!
      MagicMirror created by Michael Teeuw.
      Forum managed by Sam, technical setup by Karsten.
      This forum is using NodeBB as its core | Contributors
      Contact | Privacy Policy