View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 10 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Sun Nov 27, 2011 8:40 pm 
Offline
Joined: Tue Mar 28, 2006 8:26 pm
Posts: 804
Location: Minneapolis, MN
I've got an Asus A8N-VM-CSM motherboard and the mbmon program doesn't work with the Asus motherboard.
The LM sensors program does work with it so I've got to use that to gather data for the RRD graphs.

I just ran sensors-detect, and it found 2 chips:
w83627ehf and k8temp

The 1st one is a voltage sensor for the CPU power supplies (commands: VCORE, AVCC, 3VCC, VSB, VBAT)
The 2nd one is the AMD CPU (commands: Core0 Temp, Core1 Temp).
The program asked if I wanted to add support for these chips to /etc/modules.
I said yes....what the heck. :)

When I type "sensors | grep "Core0 Temp" | cut -c 15-18", I get a temperature of "26.0", which lines up with the current ambient temperature in the case.

When I type "sensors | grep "Core1 Temp" | cut -c 15-18", I get a temperature of "35.0", which lines up with the current CPU temperature.

Thus, I'm thinking that Core0 is actually the motherboard temp sensor, and Core1 is actually the CPU temperature. It doesn't make sense to me for 1 CPU core to be 26C and the other 35C.
Does that sound reasonable?

The original contents of the stock R5.5 /etc/rrd.config file had this:
Code:
#=======================================================================
#  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_mobo   = '1';              #
$MBT_cpu    = '2';              #
$MBT_case   = '';               #
$MBT_prog = 'mbmon -c 1 -T';    # program & args to gather the data


I've edited the /etc/rrd.config file to set the MBT program to be "sensors".
What are those other "MBT variables"? What are they for?
Are they supposed to have numbers or names in the single quotes after the equals sign?
What are they used for in the rrd_MBtemp.pl file?
Code:
#=======================================================================
#  rrd_MBtemp.pl configuration:   # Motherboard / CPU temperature
#-----------------------------------------------------------------------
$color_mbt1 = '#00FF00';   # color of 'motherboard' graph line
$color_mbt2 = '#FF0000';   # color of 'CPU1' graph line
$color_mbt3 = '#0000FF';   # color of 'CPU2' graph line
$MBT_mobo   = 'MB';             #
$MBT_core1   = 'CPU1';          #
$MBT_core2   = 'CPU2';          #
$MBT_prog = 'sensors';      # program & args to gather the data
#=======================================================================


The "gather" section of the original R5.5 rrd_MBtemp.pl file looks like this:
Code:
my ($mbt1, $mbt2, $mbt3);

sub gather {
    $mbt1 = 0;
    $mbt2 = 0;
    $mbt3 = 0;
    if ($MBT_mobo ne "") {
        $mbt1 = `$MBT_prog $MBT_mobo`;
    }
    if ($MBT_cpu ne "") {
        $mbt2 = `$MBT_prog $MBT_cpu`;
    }
    if ($MBT_case ne "") {
        $mbt3 = `$MBT_prog $MBT_case`;
    }
    $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";
}
What are they checking for with the:
if ($MBT_cpu ne "") {

What is: my? Read something?
What is: ne? Not equal?
What is: ""? Blank?
What is: ~ s/[\n ]//g ?

I've also edited the stock R5.5 rrd_MBtemp.pl file to remove the $mbt3 variable and change the $mbt1 variable to be the motherboard temp and $mbt2 to be the CPU temp.

Here's the my current rrd_MBtemp.pl file that I edited.
Code:
#!/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 "Core0 Temp" | cut -c 15-18`;
    $mbt2 = `$MBT_prog | grep "Core1 Temp" | cut -c 15-18`;

    if ($MBT_core0 ne "") {
        $mbt1 = `$MBT_prog $MBT_core0`;
    }
    if ($MBT_core1 ne "") {
        $mbt2 = `$MBT_prog $MBT_core1`;
    }
    $mbt1 =~ s/[\n ]//g;
    $mbt2 =~ s/[\n ]//g;
    print "$dbf: motherboard $mbt1, CPU $mbt2, C\n";
}

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


sub graph {
    #   $_[0] = time interval (ie: day...)
    #   $_[1] = filename suffix.
    undef @args;
    @args = ( "$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]");
    if ($MBT_core0 ne "") {
        push @args, "DEF:mbt1=$log/$dbf.rrd:mbt1: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";
    }
    if ($MBT_core1 ne "") {
        push @args, "DEF:mbt2=$log/$dbf.rrd:mbt2:AVERAGE",
   "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";
    }
    if ($MBT_core2 ne "") {
        push @args, "DEF:mbt3=$log/$dbf.rrd:mbt3:AVERAGE",
   "LINE1:mbt3$color_mbt3:CPU2 temp\\:",
   "GPRINT:mbt3:MIN:Minimum\\: % 5.1lf",
   "GPRINT:mbt3:MAX:Maximum\\: % 5.1lf",
   "GPRINT:mbt3:AVERAGE:Average\\: % 5.1lf",
   "GPRINT:mbt3:LAST:Current\\: % 5.1lf °C\\j";
    }
    RRDs::graph(@args);
    $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


Eric

_________________
KnoppMyth R5.5, Asus A8N-VM CSM (nvidia 6150 onboard video), AMD Athlon 64 dual-core 4200+, two 1GB sticks DDR 400, HD-3000 HDTV card, PVR-150 card, Iguanaworks RS-232 IR receiver/transmitter, Pioneer DVR-110 DVD burner


Last edited by neutron68 on Mon Dec 12, 2011 12:58 pm, edited 8 times in total.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 28, 2011 1:01 pm 
Offline
Joined: Mon Apr 23, 2007 1:45 pm
Posts: 405
Location: Fargo, ND, USA
neutron68
I think I can help you straiten out your LM Sensors program but I have never worked with RRD program. With what I have read of your post your sensing chip-set is supported but your motherboard is not. Why don't you start another post called "Setting up LM Sensors" and we can work on that part there.
TVBox

_________________
TVBox
LinHES R8.6.1


Top
 Profile  
 
 Post subject: need RRD script help
PostPosted: Mon Nov 28, 2011 2:06 pm 
Offline
Joined: Tue Mar 28, 2006 8:26 pm
Posts: 804
Location: Minneapolis, MN
Thanks for the offer TVBox, but I'm getting valid data from the LM sensors command line. I think that indicates that the LM Sensors part of the process is ok.

The current problem is getting the RRD script to use that data, so I need help figuring out the contents of the rrd.config file and the rrd_MBtemp.pl file.

Cheers!
Eric

_________________
KnoppMyth R5.5, Asus A8N-VM CSM (nvidia 6150 onboard video), AMD Athlon 64 dual-core 4200+, two 1GB sticks DDR 400, HD-3000 HDTV card, PVR-150 card, Iguanaworks RS-232 IR receiver/transmitter, Pioneer DVR-110 DVD burner


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 28, 2011 5:06 pm 
Offline
Joined: Wed Dec 10, 2003 8:31 pm
Posts: 1996
Location: /dev/null
Guys - monitorix does this natively. I would recommend asking the devs to update the PKG which is in [extra] to the latest version and enjoy it.

_________________
Retired KM user (R4 - R6.04); friend to LH users.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 28, 2011 5:18 pm 
Offline
Joined: Mon Apr 23, 2007 1:45 pm
Posts: 405
Location: Fargo, ND, USA
neutron68

My limited search I have did on the Asus A8N-VM-CSM is that no one has submitted a configuration file to LM-Sensors for it and the Asus A8N-VM-CSM is not in the sensors3.conf file. Open up the sensors3.conf file in a text editor and look for Asus A8N-VM-CSM. If you don't find it LM-Sensors is dropping back to a default file for the Winbond w83627ehf sensor chip and in my file it was for a Asus P5P800. Each sensor chip is the same as in they have (Voltage, Temp, Fan Speed) sections but what input in that section is connected to what sensor pin is not and varies per motherboard. If your motherboard has two temperature sensors you have a 50% chance you are reading the wrong one. Labels mean nothing if it was not your motherboard used in the configuration file and then it is questionable because someone may have submitted it with out antiquate testing. On one of my Asus backends my system chip (on board video) runs 10 degC warmer than the CPU all the time. It took me a year before I came to the conclusion that my temps where backwards and with some test confirmed it. Voltages can be all over the place. Some measure North-bridge, Memory and battery voltages but some do not use them so the sequence is off. Fan Speed -- The CPU speed can be the first or the last one in the sequence.

Get a paper and pencil and boot into the bios to the section that list all of the output of the sensor chip and write them down word for word in the same order on the screen. These are the only input connected into the sensor chip. Now type "sensors" into a webmin shell or whatever you use.

Here is my Bios, Word For Word

CPU V Core 1.07v
NB Voltage 1.20v
+3.3v 3.34v
+5.0v 4.81v
+12v 12.09v
DDR Voltage 1.92v
HT Voltage 1.16v
5v (SB) 4.8v
Voltage Battery 3.08v
CPU Temperature 25 deg C
CPU Fan Speed 1503 RPM
SYS Fan Speed 0 RPM
Chip Fan Speed 0 RPM

> sensors
it8716-isa-0290
Adapter: ISA adapter
CPU VCore: +1.09 V (min = +0.26 V, max = +0.03 V)
NB (Northbridge) Voltage: +1.20 V (min = +0.00 V, max = +1.09 V)
+ 3.3 V: +3.34 V (min = +0.53 V, max = +1.02 V)
+ 5.0 V: +4.81 V (min = +0.00 V, max = +0.00 V)
+12.0 V: +12.10 V (min = +0.00 V, max = +0.00 V)
DDR Voltage: +1.92 V (min = +0.00 V, max = +0.19 V)
Ht Voltage: +1.17 V (min = +0.00 V, max = +0.00 V)
+5vSB Standby : +4.81 V (min = +0.22 V, max = +0.00 V)
Battery Voltage: +3.10 V
CPU Fan Speed: 946 RPM (min = 337500 RPM)
SYS Fan Speed: 0 RPM (min = 32 RPM)
Chip Fan Speed: 0 RPM (min = -1 RPM)
CPU Temp: +21.0 C (low = +127.0 C, high = +62.0 C) sensor = thermal diode

Mine all match now after I created a file entry for "Biostar TF7050-M2" with the correct text to support the data output. The original default it8716 sensor chip text was about 70% correct.

Over the years I have set up LM-Sensors on about 10 to 15 (most of them Asus) cutting edge machines and none of them had a 100% correct entry in the sensors3.conf file. You would think there would be constancy within a manufacture like Asus but I have never seen it. This is one of the reasons LM-Sensors gets a bad rap. I know you are trying to get RRD and LM-Sensors communicating but if the data that is being sent two RRD is incorrectly labeled it isn't a useful tool.

TVBox

_________________
TVBox
LinHES R8.6.1


Top
 Profile  
 
 Post subject: I see what you mean
PostPosted: Mon Nov 28, 2011 6:01 pm 
Offline
Joined: Tue Mar 28, 2006 8:26 pm
Posts: 804
Location: Minneapolis, MN
Hi TVBox,

I see what you mean - I am missing out on some of the possible data from the w8327ehf.

The sensors command to the Asus A8N-VM-CSM gives:
Code:
root@mythtv:~# sensors
w83627ehf-isa-0290
Adapter: ISA adapter
VCore:       +1.16 V  (min =  +0.00 V, max =  +1.74 V)
in1:        +12.30 V  (min =  +8.61 V, max =  +9.66 V)   ALARM
AVCC:        +3.26 V  (min =  +3.57 V, max =  +3.06 V)   ALARM
3VCC:        +3.26 V  (min =  +4.02 V, max =  +3.01 V)   ALARM
in4:         +2.04 V  (min =  +2.01 V, max =  +1.53 V)   ALARM
in5:         +1.58 V  (min =  +2.04 V, max =  +2.04 V)   ALARM
in6:         +5.09 V  (min =  +4.89 V, max =  +3.25 V)   ALARM
VSB:         +3.26 V  (min =  +4.08 V, max =  +2.98 V)   ALARM
VBAT:        +3.09 V  (min =  +1.89 V, max =  +2.93 V)   ALARM
in9:         +1.54 V  (min =  +1.98 V, max =  +2.03 V)   ALARM
Case Fan:      0 RPM  (min =    0 RPM, div = 128)
CPU Fan:       0 RPM  (min =    0 RPM, div = 128)
Aux Fan:    3214 RPM  (min =    0 RPM, div = 2)
fan5:          0 RPM  (min = 10546 RPM, div = 128)  ALARM
Sys Temp:    +34.0 C  (high = +31.0 C, hyst =  -2.0 C)  ALARM  sensor = thermistor
CPU Temp:    +23.5 C  (high = +80.0 C, hyst = +75.0 C)  sensor = thermistor
AUX Temp:    +23.5 C  (high = +80.0 C, hyst = +75.0 C)  sensor = thermistor

k8temp-pci-00c3
Adapter: PCI adapter
Core0 Temp:  +29.0 C
Core1 Temp:  +30.0 C

root@mythtv:~#

Image

*****

Of equal importance to me, I want to get the RRD script working so that temperature data can be displayed.
Right now, I don't have any MB or CPU temp data:
Image

That empty graph is my motivation for seeking RRD and perl script know-how.
Something is wrong in my rrd_MBtemp.pl script, and I don't know enough about RRD or perl to see the problem.

Eric

_________________
KnoppMyth R5.5, Asus A8N-VM CSM (nvidia 6150 onboard video), AMD Athlon 64 dual-core 4200+, two 1GB sticks DDR 400, HD-3000 HDTV card, PVR-150 card, Iguanaworks RS-232 IR receiver/transmitter, Pioneer DVR-110 DVD burner


Top
 Profile  
 
PostPosted: Tue Nov 29, 2011 10:00 pm 
Offline
Joined: Tue Mar 28, 2006 8:26 pm
Posts: 804
Location: Minneapolis, MN
I just noticed something odd about the single quotes in the rrd_MBtemp.pl script quoted above.

There are several types of single quotes!! :?:

Towards the top, there are straight-up-and-down single quotes.
Then later in the gather section, the single quotes slant from the left down to the right!

I don't know how to control which type of single quotes I get when I press the key. I just typed some single quotes in a TTY window (CTRL-ALT-F1) on the KM box, and I got single quotes that slanted from the right down to the left!!

That makes 3 kinds of single quotes now!
Is this significant? Does Linux see the different single quotes differently?

Eric

_________________
KnoppMyth R5.5, Asus A8N-VM CSM (nvidia 6150 onboard video), AMD Athlon 64 dual-core 4200+, two 1GB sticks DDR 400, HD-3000 HDTV card, PVR-150 card, Iguanaworks RS-232 IR receiver/transmitter, Pioneer DVR-110 DVD burner


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 30, 2011 12:15 am 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
There are only three quote characters in standard ASCII.

0x22 (") - aka "double quote" (usually on the same key with 0x27 near the enter key)
0x27 (') - aka "single quote"
0x60 (`) - aka "back quote" (usually on the same key as tilde in the upper left corner)

Depending on the character set 0x27 may appear more or less slanted. In shell and perl each style of quote has a different meaning.

Double quotes allow expansions or "interpolation" in perl terminology.

Single quotes are the most literal.

Back quotes provide command substitution.


Top
 Profile  
 
 Post subject: it helped!
PostPosted: Wed Nov 30, 2011 10:08 pm 
Offline
Joined: Tue Mar 28, 2006 8:26 pm
Posts: 804
Location: Minneapolis, MN
Thanks for the responses!

Wow! Changing the angle of the dangle of the single quotes helped fix some of the problems with the rrd.MBtemp.pl script!

I changed to the ~ single quotes for the lines in the gather function.
Now when I run the script from a command line I get valid number data, no error messages!
Code:
root@mythtv:~# /usr/local/bin/rrd_MBtemp.pl
MBtemp: Motherboard 34.0, CPU1 28.0, CPU2 29.0, C
root@mythtv:~#


The last part of the fix was looking through the editing the rrd_MBtemp.pl file and getting all the parenthesis to be in the correct places.

Below is a look at the working files I currently have in the KM R5.5 machine.
I removed the $MBtemp_mobo and similar lines from the rrd.config file because I decided that they were only useful for the "mbmon" command and NOT useful for the "sensors" command.
I removed the lines that didn't make sense to me from the rrd_MBtemp.pl file and it now runs without giving error messages.

At this point, the script runs without errors, and even generates the MBtemp graphs!!!Image

relavant section of the rrd.config file as of 10:45pm 11-30-2011
Code:
#=======================================================================
#  rrd_MBtemp.pl configuration:   # Motherboard / CPU temperature
#-----------------------------------------------------------------------
$color_mbt1 = '#00FF00';   # color of 'motherboard' graph line
$color_mbt2 = '#FF0000';   # color of 'CPU1' graph line
$color_mbt3 = '#0000FF';   # color of 'CPU2' graph line
$MBT_prog = 'sensors';      # program & args to gather the data
#=======================================================================

rrd_MBtemp.pl file as of 10:45pm 11-30-2011
Code:
#!/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, $mbt3);

sub gather {
    $mbt1 = `$MBT_prog | grep "Sys Temp" | cut -c 15-18`;
    $mbt2 = `$MBT_prog | grep "Core0 Temp" | cut -c 15-18`;
    $mbt3 = `$MBT_prog | grep "Core1 Temp" | cut -c 15-18`;
    $mbt1 =~ s/[\n ]//g;
    $mbt2 =~ s/[\n ]//g;
    $mbt3 =~ s/[\n ]//g;
    print "$dbf: Motherboard $mbt1, CPU1 $mbt2, CPU2 $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",
   "DEF:mbt3=$log/$dbf.rrd:mbt3: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:CPU1 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",
   "LINE1:mbt3$color_mbt3:CPU2 temp\\:",
   "GPRINT:mbt3:MIN:Minimum\\: % 5.1lf",
   "GPRINT:mbt3:MAX:Maximum\\: % 5.1lf",
   "GPRINT:mbt3:AVERAGE:Average\\: % 5.1lf",
   "GPRINT:mbt3: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
8)

_________________
KnoppMyth R5.5, Asus A8N-VM CSM (nvidia 6150 onboard video), AMD Athlon 64 dual-core 4200+, two 1GB sticks DDR 400, HD-3000 HDTV card, PVR-150 card, Iguanaworks RS-232 IR receiver/transmitter, Pioneer DVR-110 DVD burner


Top
 Profile  
 
 Post subject: Re: it helped!
PostPosted: Sun Dec 04, 2011 10:56 am 
Offline
Joined: Tue Mar 28, 2006 8:26 pm
Posts: 804
Location: Minneapolis, MN
neutron68 wrote:
Thanks for the responses!

Wow! Changing the angle of the dangle of the single quotes helped fix some of the problems with the rrd.MBtemp.pl script!

I changed to the ~ single quotes for the lines in the gather function.
Now when I run the script from a command line I get valid number data, no error messages!
Code:
root@mythtv:~# /usr/local/bin/rrd_MBtemp.pl
MBtemp: Motherboard 34.0, CPU1 28.0, CPU2 29.0, C
root@mythtv:~#


The last part of the fix was looking through the editing the rrd_MBtemp.pl file and getting all the parenthesis to be in the correct places.

Below is a look at the working files I currently have in the KM R5.5 machine.
I removed the $MBtemp_mobo and similar lines from the rrd.config file because I decided that they were only useful for the "mbmon" command and NOT useful for the "sensors" command.
I removed the lines that didn't make sense to me from the rrd_MBtemp.pl file and it now runs without giving error messages.

At this point, the script runs without errors, and even generates the MBtemp graphs!!!
Image

relavant section of the rrd.config file as of 10:45pm 11-30-2011
Code:
#=======================================================================
#  rrd_MBtemp.pl configuration:   # Motherboard / CPU temperature
#-----------------------------------------------------------------------
$color_mbt1 = '#00FF00';   # color of 'motherboard' graph line
$color_mbt2 = '#FF0000';   # color of 'CPU1' graph line
$color_mbt3 = '#0000FF';   # color of 'CPU2' graph line
$MBT_prog = 'sensors';      # program & args to gather the data
#=======================================================================

rrd_MBtemp.pl file as of 10:45pm 11-30-2011
Code:
#!/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, $mbt3);

sub gather {
    $mbt1 = `$MBT_prog | grep "Sys Temp" | cut -c 15-18`;
    $mbt2 = `$MBT_prog | grep "Core0 Temp" | cut -c 15-18`;
    $mbt3 = `$MBT_prog | grep "Core1 Temp" | cut -c 15-18`;
    $mbt1 =~ s/[\n ]//g;
    $mbt2 =~ s/[\n ]//g;
    $mbt3 =~ s/[\n ]//g;
    print "$dbf: Motherboard $mbt1, CPU1 $mbt2, CPU2 $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",
   "DEF:mbt3=$log/$dbf.rrd:mbt3: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:CPU1 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",
   "LINE1:mbt3$color_mbt3:CPU2 temp\\:",
   "GPRINT:mbt3:MIN:Minimum\\: % 5.1lf",
   "GPRINT:mbt3:MAX:Maximum\\: % 5.1lf",
   "GPRINT:mbt3:AVERAGE:Average\\: % 5.1lf",
   "GPRINT:mbt3: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
8)

_________________
KnoppMyth R5.5, Asus A8N-VM CSM (nvidia 6150 onboard video), AMD Athlon 64 dual-core 4200+, two 1GB sticks DDR 400, HD-3000 HDTV card, PVR-150 card, Iguanaworks RS-232 IR receiver/transmitter, Pioneer DVR-110 DVD burner


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 


All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu