Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    RRD CPU Graphs from MBMON (not Coretemp) on a X700

    Scheduled Pinned Locked Moved Hardware
    12 Posts 4 Posters 3.4k Views
    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.
    • D
      davothegreat
      last edited by

      I've made a bit of progress. The RRD temperature graphs now display in the web GUI without throwing errors everywhere but there's still no data being written to them.

      rrd.inc is now looking like this…  (this is where I think I still have something wrong)

      
       /* Cpu Temp, create CPU Temperature database */
            if(! file_exists("$rrddbpath$ifname$cputemp")) {
               $rrdcreate = "$rrdtool create $rrddbpath$ifname$cputemp --step $rrdcputempinterval ";
               $rrdcreate .= "DS:cputemp:GAUGE:$cputempvalid:-273:5000 ";
               $rrdcreate .= "RRA:MIN:0.5:1:1000 ";
               $rrdcreate .= "RRA:AVERAGE:0.5:1:1000 ";
               $rrdcreate .= "RRA:MAX:0.5:1:1000 ";
               $rrdcreate .= "RRA:LAST:0.5:1:1000 ";
      
               create_new_rrd($rrdcreate);
            }
      
            /* enter UNKNOWN values in the RRD so it knows we rebooted. */
            if($g['booting']) {
               mwexec("$rrdtool update $rrddbpath$ifname$cputemp N:U:U:U:U:U");
            }
      
            /* the CPU Temperature gathering function */
            $rrdupdatesh .= "CPUTEMP=`$mbmon -I -c1 -T 1 | ";
            $rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$cputemp N:\${CPUTEMP}\n";
      
            /* end CPU Temp gathering */
      
      

      And status_rrd_graph_img.php now looks like this…

      
      elseif((strstr($curdatabase, "-temperature.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
         /* define graphcmd for memory usage stats */
         $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
         $graphcmd .= "--start $start --end $end ";
         $graphcmd .= "--vertical-label \"degrees, celcius\" ";
         $graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
         $graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} LAST\" ";
         $graphcmd .= "--height 200 --width 620 ";
         $graphcmd .= "DEF:\"cputemp=$rrddbpath$curdatabase:cputemp:LAST\" ";
         $graphcmd .= "LINE2:\"cputemp#{$colormemory[0]}:cputemp\" ";
         $graphcmd .= "COMMENT:\"\\n\" ";
         $graphcmd .= "COMMENT:\"\t\t      minimum        average        maximum        current\\n\" ";
         $graphcmd .= "COMMENT:\"Cputemp.      \" ";
         $graphcmd .= "GPRINT:\"cputemp:MIN:%7.2lf %s    \" ";
         $graphcmd .= "GPRINT:\"cputemp:AVERAGE:%7.2lf %s    \" ";
         $graphcmd .= "GPRINT:\"cputemp:MAX:%7.2lf %s    \" ";
         $graphcmd .= "GPRINT:\"cputemp:LAST:%7.2lf %S    \" ";
         $graphcmd .= "COMMENT:\"\\n\" ";
         $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
      }
      
      

      Any suggestions?

      Cheers,
      Dave

      1 Reply Last reply Reply Quote 0
      • O
        Ocean7
        last edited by

        davothegreat, got it working? My RRD Graph show 0C :(

        1 Reply Last reply Reply Quote 0
        • D
          davothegreat
          last edited by

          No, I never got it to work properly. Kind of hoped someone here could provide a bit more assistance but I understand the Firebox hardware is very old and probably not included under any modern development paths.

          If anyone out there has gotten this to work, please shed some light. I'm happy to poke around in the configs if it's of any help since my Firebox runs my home network and not a business.

          The CPU temperature does appear to report ok on the system homepage but of course this only provides the current temperature.

          Cheers,
          Dave

          1 Reply Last reply Reply Quote 0
          • stephenw10S
            stephenw10 Netgate Administrator
            last edited by

            This has got to be simple syntax problem. The fact that the X700 is quite old is not a valid excuse.  ;)

            It must be possible to feed the output of mbmon into RRDtool.

            Steve

            1 Reply Last reply Reply Quote 0
            • stephenw10S
              stephenw10 Netgate Administrator
              last edited by

              Looks like your code is trying to pipe the output of mbmon to rrdtool update but that's not how it works as far as I can see.
              Compare it with the CPUstats code:

              
              /* the CPU stats gathering function. */
              		$rrdupdatesh .= "CPU=`$cpustats | cut -f1-4 -d':'`\n";
              		/* Using ps uxaH will count all processes including system threads. Top was undercounting. */
              		$rrdupdatesh .= "PROCS=`ps uxaH | wc -l | awk '{print \$1;}'`\n";
              		$rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$proc N:\${CPU}:\${PROCS}\n";
              

              Looks like the CPU temp function should be more like:

              
              /* the CPU Temperature gathering function */
                    $rrdupdatesh .= "CPUTEMP=`$mbmon -I -c1 -T1 `\n";
                    $rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$cputemp N:\${CPUTEMP}\n";
              /* end CPU Temp gathering */
              
              

              Have you setup the required variables at the start of rrd.inc?

              I'm no expert at this though.  ::)

              Steve

              1 Reply Last reply Reply Quote 0
              • D
                davothegreat
                last edited by

                Umm I've completely forgotten what I'd done now. The code came from another thread that did this with the other temp monitoring tool which I tried (and failed) to modify to suit mbmon. I do recall though that mbmon was producing values and writing them to the graphing file but that the graph displayed no information, suggesting its formatting was incorrect.

                I'll spend a bit of time tonight and reinstate what I had before and work from there.

                Cheers,
                Dave

                1 Reply Last reply Reply Quote 0
                • D
                  davothegreat
                  last edited by

                  Solved at last!

                  I forgot about getting this to work until I updated to 2.1 yesterday and decided to have another crack at it and now it works like a bought one.

                  To get it working, install the mbmon package and then edit /etc/inc/rrd.inc with the following changes:

                  After $mem = "-memory.rrd"; paste in the following text…

                  
                  $cputemp = "-temperature.rrd";
                  $rrdcputempinterval = 60;
                  $cputempvalid = $rrdcputempinterval * 2;
                  
                  

                  After /* End Memory statistics */ paste in the following text…

                  
                  /* CPU Temperature */
                  
                          /* Cpu Temp, create CPU Temperature database */
                        if(! file_exists("$rrddbpath$ifname$cputemp")) {
                           $rrdcreate = "$rrdtool create $rrddbpath$ifname$cputemp --step $rrdcputempinterval ";
                           $rrdcreate .= "DS:Temperature:GAUGE:$cputempvalid:0:100 ";
                           $rrdcreate .= "RRA:MIN:0.5:1:1000 ";
                           $rrdcreate .= "RRA:MIN:0.5:5:1000 ";
                           $rrdcreate .= "RRA:MIN:0.5:60:1000 ";
                           $rrdcreate .= "RRA:MIN:0.5:720:3000 ";
                           $rrdcreate .= "RRA:AVERAGE:0.5:1:1000 ";
                           $rrdcreate .= "RRA:AVERAGE:0.5:5:1000 ";
                           $rrdcreate .= "RRA:AVERAGE:0.5:60:1000 ";
                           $rrdcreate .= "RRA:AVERAGE:0.5:720:3000 ";
                           $rrdcreate .= "RRA:MAX:0.5:1:1000 ";
                           $rrdcreate .= "RRA:MAX:0.5:5:1000 ";
                           $rrdcreate .= "RRA:MAX:0.5:60:1000 ";
                           $rrdcreate .= "RRA:MAX:0.5:720:3000 ";
                           $rrdcreate .= "RRA:LAST:0.5:1:1000 ";
                           $rrdcreate .= "RRA:LAST:0.5:5:1000 ";
                           $rrdcreate .= "RRA:LAST:0.5:60:1000 ";
                           $rrdcreate .= "RRA:LAST:0.5:720:3000 ";
                  
                           create_new_rrd($rrdcreate);
                        }
                  
                        /* enter UNKNOWN values in the RRD so it knows we rebooted. */
                        if($g['booting']) {
                           mwexec("$rrdtool update $rrddbpath$ifname$cputemp N:U:U:U:U:U");
                        }
                  
                        /* the CPU Temperature gathering function */
                  
                        $rrdupdatesh .= "CPUTEMP=`/usr/local/bin/mbmon -i -T 1 -c 1`\n";
                        $rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$cputemp N:\${CPUTEMP}\n";
                  
                        /* end CPU Temp gathering */
                  
                  

                  Note: the characters surrounding```
                  /usr/local/bin/mbmon -I -T 1 -c 1

                  
                  Save rrd.inc and then edit /usr/local/www/status_rrd_graph_img.php
                  
                  After the block of text containing /* define graphcmd for memory usage stats */ paste in the following text…
                  
                  

                  elseif((strstr($curdatabase, "-temperature.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
                    /* define graphcmd for cpu temperature stats */
                    $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
                    $graphcmd .= "--start $start --end $end ";
                    $graphcmd .= "--vertical-label "degrees, celcius" ";
                    $graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
                    $graphcmd .= "--title "hostname - {$prettydb} - {$hperiod} - {$havg} LAST" ";
                    $graphcmd .= "--height 200 --width 620 ";
                    $graphcmd .= "DEF:"Temperature=$rrddbpath$curdatabase:Temperature:LAST" ";
                    $graphcmd .= "LINE2:"Temperature#{$colormemory[0]}:Temperature" ";
                    $graphcmd .= "COMMENT:"\n" ";
                    $graphcmd .= "COMMENT:"\t\t      minimum        average        maximum        current\n" ";
                    $graphcmd .= "COMMENT:"Temperature.      " ";
                    $graphcmd .= "GPRINT:"Temperature:MIN:%7.2lf %s    " ";
                    $graphcmd .= "GPRINT:"Temperature:AVERAGE:%7.2lf %s    " ";
                    $graphcmd .= "GPRINT:"Temperature:MAX:%7.2lf %s    " ";
                    $graphcmd .= "GPRINT:"Temperature:LAST:%7.2lf %S    " ";
                    $graphcmd .= "COMMENT:"\n" ";
                    $graphcmd .= "COMMENT:"\t\t\t\t\t\t\t\t\t\t\t\t\tdate +\"%b %d %H\:%M\:%S %Y\"" ";

                  
                  Save status_rrd_graph_img.php then SSH into the Firebox and restart the web configurator (menu option 11). Wait a couple of minutes and you should start seeing temperature data being graphed under Status -> RRD Graphs -> System -> Temperature.
                  
                  Thanks to all who posted before me with related ideas and responses to this thread. I should have figured this out ages ago, I just got lazy.
                  
                  Hope this helps someone.
                  
                  Cheers,
                  Dave
                  1 Reply Last reply Reply Quote 0
                  • stephenw10S
                    stephenw10 Netgate Administrator
                    last edited by

                    Nice! I'll have to give this a try.

                    Steve

                    1 Reply Last reply Reply Quote 0
                    • D
                      daimlermg
                      last edited by

                      Steve Did you get it working ?.

                      I had a go at it on a mini ITX single core and a dual core with HT but the data is not showing up in the graphs , at least the Graphs are now there.
                      I was not able to install the  mbmon package as they are not in the package download area but I have the Thermal sensors showing in the dashboard so I guess it is part of the 2.1 CD install now.

                      Any thoughts are most welcome

                      1 Reply Last reply Reply Quote 0
                      • D
                        davothegreat
                        last edited by

                        Daimler,

                        Your hardware sounds a lot newer than mine and I'm pretty sure folks on newer hardware use coretemp instead of mbmon. The hardware in these fireboxes is geriatric so we've got no choice but to use mbmon. Give coretemp a try.

                        Cheers,
                        Dave

                        1 Reply Last reply Reply Quote 0
                        • stephenw10S
                          stephenw10 Netgate Administrator
                          last edited by

                          Yep. ^ exactly.
                          If it's showing in the dash it's probably already using coretemp (or the amd equivalent).
                          If you can't load mbmon then the above code definitely won't work. There's another thread that covers using coretemp for a similar purpose I think.

                          Steve

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post
                          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.