LinHES Forums
http://forums.linhes.org/

mbmon not available for rrdtool - my solution.
http://forums.linhes.org/viewtopic.php?f=6&t=16546
Page 1 of 2

Author:  Heem [ Sat Sep 15, 2007 11:43 pm ]
Post subject:  mbmon not available for rrdtool - my solution.

perhaps this has been covered. If so.. well.. I tried.

I love the RRDtool system graphs, but mbmon did not work with my hardware. after running sensors-detect, the system did find a suitable driver to monitor my hardware.

So I ran sensors-detect, allowed the config to modify the modules file, and rebooted to load the modules.

Then I made the following changes to /etc/rrd.config
(near the bottom of the file)
Code:
 $MBT_prog = 'sensors'; 

$MBF_prog = 'sensors'; 

then the following changes to /usr/local/bin/rrd_MBtemp.pl
Code:
$mbt1 = `$MBT_prog|grep -i "sys temp" |cut -c 15-17`;
    $mbt2 = `$MBT_prog|grep -i "cpu temp" |cut -c 13-17`;
    $mbt3 = `$MBT_prog|grep -i "aux temp" |cut -c 13-17`;


then these changes to /usr/local/bin/rrd_MBfan.pl
Code:
    $mbf1 = `$MBF_prog |grep -i "aux fan"|cut -c 11-15`;  # Motherboard fan
    $mbf2 = `$MBF_prog |grep -i "cpu fan"|cut -c 11-15`;  # CPU fan
    $mbf3 = `$MBF_prog |grep -i "case fan"|cut -c 11-15`;  # Case fan


Worked for me. Your results may vary.

Edit: sensors-detect not sensors-config. whoops.

Author:  graysky [ Sun Sep 16, 2007 3:30 am ]
Post subject: 

What are your hardware details?

Author:  Heem [ Sun Sep 16, 2007 8:04 am ]
Post subject: 

This is an MSI K9NBPM2-FID board, AM2 socket with AMD Ath 64 X2 4000+ 2.1G

Author:  marc.aronson [ Sun Sep 16, 2007 10:08 am ]
Post subject: 

graysky wrote:
What are your hardware details?

My motherboard is an ASUS P5P800-SE and mbmon doesn't work on it either. I took a slightly different approach than Heem did, but at the core we both are using sensors instead of mbmon to obtain CPU & MOBO temp and fan info.

When I run mbmon on my system I get the following:
Code:
root@mythhd:/# mbmon
eNo Hardware Monitor found!!
InitMBInfo: Success
root@mythhd:/# echo $?
1


So one could revise the rrd script to automatically decide weather to use mbmon or sensors, but you also need to run sensors_detect as a 1-time configuration setup.

Before I made the change to use sensors instead of mbmon I would periodically find mbmon stuck in a loop using 100% of one of my cores...

Marc

Author:  graysky [ Wed Sep 19, 2007 1:24 pm ]
Post subject: 

Using mbmon, my CPU temp is always 255. I configured sensors, loaded-up the correct modules (it87) and sensors works just fine now:

Code:
$ sensors
it8712-isa-0d00
Adapter: ISA adapter
VCore 1:   +1.74 V  (min =  +4.08 V, max =  +4.08 V)   ALARM
VCore 2:   +4.08 V  (min =  +4.08 V, max =  +4.08 V)   ALARM
+3.3V:     +3.36 V  (min =  +4.08 V, max =  +4.08 V)   ALARM
+5V:       +4.95 V  (min =  +6.85 V, max =  +6.85 V)   ALARM
+12V:     +12.35 V  (min = +16.32 V, max = +16.32 V)   ALARM
-12V:      +3.93 V  (min =  +3.93 V, max =  +3.93 V)   ALARM
-5V:       +4.03 V  (min =  +4.03 V, max =  +4.03 V)   ALARM
Stdby:     +6.85 V  (min =  +6.85 V, max =  +6.85 V)   ALARM
VBat:      +4.08 V
fan1:     3245 RPM  (min =    0 RPM, div = 2)
fan2:     2537 RPM  (min =    0 RPM, div = 4)
fan3:        0 RPM  (min =    0 RPM, div = 2)
M/B Temp:    +38 C  (low  =    -1 C, high =    -1 C)   sensor = diode
CPU Temp:    +39 C  (low  =    -1 C, high =    -1 C)   sensor = thermistor
Temp3:        -1 C  (low  =    -1 C, high =    -1 C)   sensor = disabled   ALARM


I modified my /etc/rrd.config as you suggested and as well my /usr/local/bin/rrd_MBtemp.pl relevant info below:

Code:
$mbt1 = `$MBT_prog | grep "M/B Temp" | cut -c 15-17';
$mbt2 = `$MBT_prog | grep "CPU Temp" | cut -c 15-17';


I skipped the /usr/local/bin/rrd_MBfan.pl for the moment. The output in the webpage hasn't changed to reflect these modifications even after a reboot:
Image

I will admit to being totally new to these .pl files... is it obvious what I did wrong from the info I posted here?

Author:  Heem [ Wed Sep 19, 2007 1:33 pm ]
Post subject: 

make sure you have the correct single quote at the end of that statement:

Quote:
$mbt1 = `$MBT_prog | grep "M/B Temp" | cut -c 15-17'


should be

$mbt1 = `$MBT_prog | grep "M/B Temp" | cut -c 15-17`

also, try running that command directly from the command line, make sure you get just the number:

sensors |grep "M/B Temp"| cut -c 15-17

you might have to change 15-17 to match the output it creates.
you want just a number here.

Author:  graysky [ Wed Sep 19, 2007 1:47 pm ]
Post subject: 

Wow... I didn't see the difference between the ' that I used and the ` that it's supposed to be! I corrected it so it now reads:
Code:
$mbt1 = `$MBT_prog | grep "M/B Temp" | cut -c 15-17`;
$mbt2 = `$MBT_prog | grep "CPU Temp" | cut -c 15-17`;


I did test the cut command and it indeed yields only a number"
Code:
$ sensors | grep "M/B Temp" | cut -c 15-17
40
$ sensors | grep "CPU Temp" | cut -c 15-17
41


Is there something I need to restart to get the changes to commit or is it "live" everything I hit the webpage? I ask because even after these changes, the output is still incorrect.

Thanks again!

Author:  Heem [ Wed Sep 19, 2007 1:54 pm ]
Post subject: 

it takes 5 minutes to update. they are cron jobs that run. you could manually run the /usr/local/bin/rrd_MBtemp.pl file - but by the time you get this it's probably already been 5 minutes ;)

Author:  graysky [ Wed Sep 19, 2007 3:05 pm ]
Post subject: 

Cool... it's been over an hour and the displayed CPU temps are unchanged:
Image

Come to think of it, the data isn't getting updated at all in the mb page.

Author:  Heem [ Wed Sep 19, 2007 4:20 pm ]
Post subject: 

looks like "mb temp" is working, no? look more closely at cpu temp.

matter of fact, paste your rrd.config and your rrd_MBtemp.pl file

Author:  graysky [ Thu Sep 20, 2007 12:47 pm ]
Post subject: 

Heem wrote:
looks like "mb temp" is working, no? look more closely at cpu temp.


I don't think either one is working; that screenshot was taken yesterday (Wed) but there is only data in it for Tue. All the other rrd modules are giving data for the current day except cpu temp/mb temp so I'm sure I messed up something.

Quote:
matter of fact, paste your rrd.config and your rrd_MBtemp.pl file


Cool, here they are after I modified them as-per this thread:

Code:
$ cat /etc/rrd.config
#!/usr/bin/perl
#
#  Configuration file for the KnoppMyth rrd data collection routines.
#
########################################################################
# Global Configuration - config used by all the rrd_XXX.pl scripts:
#=======================================================================
$log = '/myth/rrd/log';         # location of the database (log) files
$png = '/myth/rrd/png';         # location of graph (png) files
#-----------------------------------------------------------------------
$color = '#EAE9EE';             # background color used in the graphs
$Gwd = 600;                     # graph width in pixels
$Ght = 100;                     # graph height in pixels
########################################################################
# Individual Configuration for each collection type:
#=======================================================================
#  rrd_CPU.pl configuration:    # cpu utilization
#-----------------------------------------------------------------------
$color_cpuS = '#FF0000';        # color of 'System' area of the graph
$color_cpuU = '#0000FF';        # color of 'User' area of the graph
$color_cpuN = '#00FF00';        # color of 'Nice' area of the graph
$color_cpuI = '#EEEE00';        # color of 'Idle' area of the graph
#=======================================================================
#  rrd_Mem.pl configuration:    # memory utilization
#-----------------------------------------------------------------------
$color_memU = '#0000FF';        # color of 'Used' area of the graph
$color_memB = '#FF00FF';        # color of 'Buffered' area of the graph
$color_memC = '#FFFF00';        # color of 'Cached' area of the graph
$color_memF = '#00FF00';        # color of 'Free' area of the graph
#=======================================================================
#  rrd_Swap.pl configuration:   # swap utilization
#-----------------------------------------------------------------------
$color_swpU = '#0000FF';        # color of 'Used' area of the graph
$color_swpF = '#00FF00';        # color of 'Free' area of the graph
#=======================================================================
#  rrd_Net.pl configuration:    # network utilization
#-----------------------------------------------------------------------
$color_netO = '#FFFF00';        # color of 'Outgoing' area of the graph
$color_netT = '#888800';        # color of 'Outgoing' border
$color_netI = '#00FF00';        # color of 'Incoming' area of the graph
$color_netB = '#008800';        # color of 'Incoming' border
#=======================================================================
#  rrd_Disk.pl configuration:   # disk reads/writes
#-----------------------------------------------------------------------
$color_dskR = '#0000FF';        # color of 'Read' line of the graph
$color_dskW = '#FF0000';        # color of 'Write' line of the graph
#=======================================================================
#  rrd_MythFS.pl configuration: # mount point space/inodes utilization
#-----------------------------------------------------------------------
$mnt_dir = '/myth';             # mount point to check
$color_mntS = '#0000FF';        # color of 'Space' line of the graph
$color_mntI = '#008800';        # color of 'Inodes' line of the graph
#=======================================================================
#  rrd_Count.pl configuration:  # count of files in a directory
#-----------------------------------------------------------------------
$CNT_dir = '/myth/tv';          # directory in which to count
$CNT_ex1 = '*.mpg';             # glob expression for first count
$CNT_ex2 = '*.nuv';             # glob expression for second count
$color_cnt1 = '#0000FF';        # color of 'First' count graph line
$color_cnt2 = '#008800';        # color of 'Second' count graph line
$CNT_prog = 'rrd_file_count';   # program to do the actual counting
#=======================================================================
#  rrd_Load.pl configuration:   # 1, 5, 15 minute load averages
#-----------------------------------------------------------------------
$color_avg1 = '#FF0000';        # color of '1' minute graph line
$color_avg2 = '#00FF00';        # color of '5' minute graph line
$color_avg3 = '#0000FF';        # color of '15' minute graph line
#=======================================================================
#  rrd_HDtemp.pl config:        # hard disk temperature
#-----------------------------------------------------------------------
$dev = 'hda';                   # device to measure
$color_hdt1 = '#0000FF';        # color of temperature graph line
#=======================================================================
#  rrd_MBtemp.pl configuration: # Motherboard / CPU temperature
#-----------------------------------------------------------------------
$color_mbt1 = '#00FF00';        # color of 'motherboard' graph line
$color_mbt2 = '#FF0000';        # color of 'CPU' graph line
$color_mbt3 = '#0000FF';        # color of case 'Ambient' graph line
$MBT_prog = 'sensors';   # added by me
#$MBT_prog = 'mbmon -c 1 -T';   # program & args to gather the data
#=======================================================================
#  rrd_MBtemp.pl configuration: # Motherboard / CPU temperature
#-----------------------------------------------------------------------
$color_mbf1 = '#00FF00';        # color of 'motherboard' graph line
$color_mbf2 = '#FF0000';        # color of 'CPU' graph line
$color_mbf3 = '#0000FF';        # color of case 'Ambient' graph line
#$MBF_prog = 'mbmon -c 1 -F';   # program & args to gather the data
$MBF_prog = 'sensors';   # added by me
########################################################################
# vim: sw=4 ts=8
# End


...and...

Code:
$ cat /usr/local/bin/rrd_MBtemp.pl
#!/usr/bin/perl
#
#  rrd_MBtemp.pl
#       Motherboard Temperature data collection routine for KnoppMyth
#
########################################################################
# Configuration:
my $dbf = 'MBtemp';
my $configfile = '/etc/rrd.config';
########################################################################
use RRDs;

if (! -d "/myth") { $configfile = "./D_rrd.config"; }   # DEBUG
do $configfile;

sub create {
    #   $_[0] = filename
    if (! -e "$log/$_[0].rrd") {
        print "Create db for $_[0] => $log/$_[0].rrd\n";
        RRDs::create( "$log/$_[0].rrd", "-s 300",
            "DS:mbt1:GAUGE:600:0:U",
            "DS:mbt2:GAUGE:600:0:U",
            "DS:mbt3:GAUGE:600:0:U",
            "RRA:AVERAGE:0.5:1:576",
            "RRA:AVERAGE:0.5:6:672",
            "RRA:AVERAGE:0.5:24:732",
            "RRA:AVERAGE:0.5:144:1460");
        $ERROR = RRDs::error;
        print "Error: RRDs::create failed for '$_[0]' : $ERROR\n" if $ERROR;
    }
}

my ($mbt1, $mbt2);

sub gather {
    $mbt1 = `$MBT_prog | grep "M/B Temp" | cut -c 15-17`;
    $mbt2 = `$MBT_prog | grep "CPU Temp" | cut -c 15-17`;
    $mbt3 = `$MBT_prog 3`;
    $mbt1 =~ s/[\n ]//g;
    $mbt2 =~ s/[\n ]//g;
    $mbt3 =~ s/[\n ]//g;
    print "$dbf: motherboard $mbt1, CPU $mbt2, case $mbt3, °C\n";
    # The motherboard sensor occasionally returns nonsense values.
    # This should keep the spurious peaks from roaching the graph...
    if ($mbt1 > 100.0) { $mbt1 = $mbt2 }
    print "$dbf: motherboard $mbt1, CPU $mbt2, case $mbt3, °C\n";
}

sub update {
    #   $_[0] = filename
    RRDs::update( "$log/$_[0].rrd", "-t",
        "mbt1:mbt2:mbt3",
        "N:$mbt1:$mbt2:$mbt3");
    $ERROR = RRDs::error;
    print "Error: RRDs::update for '$_[0]' : $ERROR\n" if $ERROR;
}

#°
sub graph {
    #   $_[0] = time interval (ie: day...)
    #   $_[1] = filename suffix.
    RRDs::graph( "$png/$dbf-$_[1].png", "-s -1$_[0]", "-aPNG",
        "-w $Gwd", "-h $Ght", "-E", "-l 20", "-M",
        "--color", "SHADEA$color",
        "--color", "SHADEB$color",
        "--color", "BACK$color",
        "-t Motherboard & CPU temperature degrees C :: $_[0]",
        "DEF:mbt1=$log/$dbf.rrd:mbt1:AVERAGE",
        "DEF:mbt2=$log/$dbf.rrd:mbt2:AVERAGE",
        "LINE1:mbt1$color_mbt1: MB temp\\:",
        "GPRINT:mbt1:MIN:Minimum\\: % 5.1lf",
        "GPRINT:mbt1:MAX:Maximum\\: % 5.1lf",
        "GPRINT:mbt1:AVERAGE:Average\\: % 5.1lf",
        "GPRINT:mbt1:LAST:Current\\: % 5.1lf °C\\j",
        "LINE1:mbt2$color_mbt2:CPU temp\\:",
        "GPRINT:mbt2:MIN:Minimum\\: % 5.1lf",
        "GPRINT:mbt2:MAX:Maximum\\: % 5.1lf",
        "GPRINT:mbt2:AVERAGE:Average\\: % 5.1lf",
        "GPRINT:mbt2:LAST:Current\\: % 5.1lf °C\\j");
    $ERROR = RRDs::error;
    print "Error: RRDs::graph failed for '$_[0]' : $ERROR\n" if $ERROR;
}
########################################################################
create "$dbf";
gather;
update "$dbf";
graph 'day',   'Daily';
graph 'week',  'Weekly';
graph 'month', 'Monthly';
graph 'year',  'Yearly';
########################################################################
# vim: sw=4 ts=8
# End

Author:  Heem [ Thu Sep 20, 2007 12:59 pm ]
Post subject: 

yours looks just like mine.

Try running the rrd_MBtemp.pl manually - a few times. see what you get.

Author:  graysky [ Thu Sep 20, 2007 3:41 pm ]
Post subject: 

Interesting idea:

Code:
$ rrd_MBtemp.pl
Parse error in chip name `3'
MBtemp: motherboard 40, CPU 41, case Try`sensors-h'formoreinformation, °C
MBtemp: motherboard 40, CPU 41, case Try`sensors-h'formoreinformation, °C
Error: RRDs::update for 'MBtemp' : opening '/myth/rrd/log/MBtemp.rrd': Permission denied
Error: RRDs::graph failed for 'day' : Opening '/myth/rrd/png/MBtemp-Daily.png' for write: Permission denied
Error: RRDs::graph failed for 'week' : Opening '/myth/rrd/png/MBtemp-Weekly.png' for write: Permission denied
Error: RRDs::graph failed for 'month' : Opening '/myth/rrd/png/MBtemp-Monthly.png' for write: Permission denied
Error: RRDs::graph failed for 'year' : Opening '/myth/rrd/png/MBtemp-Yearly.png' for write: Permission denied

Author:  Heem [ Thu Sep 20, 2007 3:51 pm ]
Post subject: 

the cron jobs run as root. try to su to root first.

Author:  graysky [ Thu Sep 20, 2007 4:36 pm ]
Post subject: 

Code:
# rrd_MBtemp.pl
Parse error in chip name `3'
MBtemp: motherboard 40, CPU 40, case Try`sensors-h'formoreinformation, °C
MBtemp: motherboard 40, CPU 40, case Try`sensors-h'formoreinformation, °C

Page 1 of 2 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/