View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 2 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Wed Jun 16, 2010 10:48 pm 
Offline
Joined: Wed Jun 06, 2007 3:29 am
Posts: 38
Location: Australia
Have been fiddling around attempting to add my nVidia gpu temperature to the RRD charts provided in R6, and against all odds......it seems to work :D

Image

If anyone else is interested, I made a few little mods to rrd_hdtemp.pl and just saved it as rrd_gputemp.pl

I imagine it should work with any nvidia gpu that displays a temperature in nvidia-settings??

Code:
#!/usr/bin/perl
#
# copyright Martin Pot 2003
# http://martybugs.net/linux/hddtemp.cgi
#
# rrd_hddtemp.pl

use RRDs;

# define location of rrdtool databases

my $rrd = '/var/lib/rrd';
# define location of images
my $img = '/data/srv/httpd/htdocs/rrd';

# process data for each specified HDD (add/delete as required)
&ProcessHDD("gpu", "nVidia 8300 IGP");
#&ProcessHDD("sdb", "slave");
#&ProcessHDD("hdc", "40GB Seagate");
#&ProcessHDD("hdd", "secondary slave");

sub ProcessHDD
{
# process HDD
# inputs: $_[0]: hdd (ie, hda, etc)
#         $_[1]: hdd description

        # get hdd temp for master drive on secondary IDE channel
        my $temp=`nvidia-settings -c :0 -q gpucoretemp -t`;
        # remove eol chars and white space
        $temp =~ s/[\n ]//g;

        print "$_[1] ($_[0]) temp: $temp degrees C\n";

        # if rrdtool database doesn't exist, create it
        if (! -e "$rrd/$_[0].rrd")
        {
                print "creating rrd database for $_[0]...\n";
                RRDs::create "$rrd/$_[0].rrd",
                        "-s 300",
                        "DS:temp:GAUGE:600:0:100",
                        "RRA:AVERAGE:0.5:1:576",
                        "RRA:AVERAGE:0.5:6:672",
                        "RRA:AVERAGE:0.5:24:732",
                        "RRA:AVERAGE:0.5:144:1460";
        }

        # insert value into rrd
        RRDs::update "$rrd/$_[0].rrd",
                "-t", "temp",
                "N:$temp";

        # create graphs
        &CreateGraph($_[0], "day", $_[1]);
        &CreateGraph($_[0], "week", $_[1]);
        &CreateGraph($_[0], "month", $_[1]);
        &CreateGraph($_[0], "year", $_[1]);
}

sub CreateGraph
{
# creates graph
# inputs: $_[0]: hdd name (ie, hda, etc)
#         $_[1]: interval (ie, day, week, month, year)
#         $_[2]: hdd description

        RRDs::graph "$img/$_[0]-$_[1].png",
                "--lazy",
                "-s -1$_[1]",
                "--color", "SHADEA#EAE9EE",
                "--color", "SHADEB#EAE9EE",
                "--color", "BACK#EAE9EE",
                "-t Temperature of $_[2] ($_[0]) - $_[1]",
                "-h", "100", "-w", "600",
                "-a", "PNG",
                "-v degrees C",
                "DEF:temp=$rrd/$_[0].rrd:temp:AVERAGE",

                # This CDEF section defines a variable for every 5 degree increment of temperature
                # between 5 and 130 degrees. Undefined/unknown variables are set to zero.
                "CDEF:tempz=temp,130,LT,temp,130,IF",
                "CDEF:tempzNoUnk=temp,UN,0,tempz,IF",
                "CDEF:tempy=temp,125,LT,temp,125,IF",
                "CDEF:tempyNoUnk=temp,UN,0,tempy,IF",
                "CDEF:tempx=temp,120,LT,temp,120,IF",
                "CDEF:tempxNoUnk=temp,UN,0,tempx,IF",
                "CDEF:tempw=temp,115,LT,temp,115,IF",
                "CDEF:tempwNoUnk=temp,UN,0,tempw,IF",
                "CDEF:tempv=temp,110,LT,temp,110,IF",
                "CDEF:tempvNoUnk=temp,UN,0,tempv,IF",
                "CDEF:tempu=temp,105,LT,temp,105,IF",
                "CDEF:tempuNoUnk=temp,UN,0,tempu,IF",
                "CDEF:tempt=temp,100,LT,temp,100,IF",
                "CDEF:temptNoUnk=temp,UN,0,tempt,IF",
                "CDEF:temps=temp,95,LT,temp,95,IF",
                "CDEF:tempsNoUnk=temp,UN,0,temps,IF",
                "CDEF:tempr=temp,90,LT,temp,90,IF",
                "CDEF:temprNoUnk=temp,UN,0,tempr,IF",
                "CDEF:tempq=temp,85,LT,temp,85,IF",
                "CDEF:tempqNoUnk=temp,UN,0,tempq,IF",
                "CDEF:tempp=temp,80,LT,temp,80,IF",
                "CDEF:temppNoUnk=temp,UN,0,tempp,IF",
                "CDEF:tempo=temp,75,LT,temp,75,IF",
                "CDEF:tempoNoUnk=temp,UN,0,tempo,IF",
                "CDEF:tempn=temp,70,LT,temp,70,IF",
                "CDEF:tempnNoUnk=temp,UN,0,tempn,IF",
                "CDEF:tempm=temp,65,LT,temp,65,IF",
                "CDEF:tempmNoUnk=temp,UN,0,tempm,IF",
                "CDEF:templ=temp,60,LT,temp,60,IF",
                "CDEF:templNoUnk=temp,UN,0,templ,IF",
                "CDEF:tempk=temp,55,LT,temp,55,IF",
                "CDEF:tempkNoUnk=temp,UN,0,tempk,IF",
                "CDEF:tempj=temp,50,LT,temp,50,IF",
                "CDEF:tempjNoUnk=temp,UN,0,tempj,IF",
                "CDEF:tempi=temp,45,LT,temp,45,IF",
                "CDEF:tempiNoUnk=temp,UN,0,tempi,IF",
                "CDEF:temph=temp,40,LT,temp,40,IF",
                "CDEF:temphNoUnk=temp,UN,0,temph,IF",
                "CDEF:tempg=temp,35,LT,temp,35,IF",
                "CDEF:tempgNoUnk=temp,UN,0,tempg,IF",
                "CDEF:tempf=temp,30,LT,temp,30,IF",
                "CDEF:tempfNoUnk=temp,UN,0,tempf,IF",
                "CDEF:tempe=temp,25,LT,temp,25,IF",
                "CDEF:tempeNoUnk=temp,UN,0,tempe,IF",
                "CDEF:tempd=temp,20,LT,temp,20,IF",
                "CDEF:tempdNoUnk=temp,UN,0,tempd,IF",
                "CDEF:tempc=temp,15,LT,temp,15,IF",
                "CDEF:tempcNoUnk=temp,UN,0,tempc,IF",
                "CDEF:tempb=temp,10,LT,temp,10,IF",
                "CDEF:tempbNoUnk=temp,UN,0,tempb,IF",
                "CDEF:tempa=temp,5,LT,temp,5,IF",
                "CDEF:tempaNoUnk=temp,UN,0,tempa,IF",

                # This section defines a color gradient for displaying the temperature data
                "AREA:tempzNoUnk#ff0000",
                "AREA:tempyNoUnk#ff0000",
                "AREA:tempxNoUnk#ff0000",
                "AREA:tempwNoUnk#ff0000",
                "AREA:tempvNoUnk#ff1b00",
                "AREA:tempuNoUnk#ff4100",
                "AREA:temptNoUnk#ff6600",
                "AREA:tempsNoUnk#ff8e00",
                "AREA:temprNoUnk#ffb500",
                "AREA:tempqNoUnk#ffdb00",
                "AREA:temppNoUnk#fdff00",
                "AREA:tempoNoUnk#d7ff00",
                "AREA:tempnNoUnk#b0ff00",
                "AREA:tempmNoUnk#8aff00",
                "AREA:templNoUnk#65ff00",
                "AREA:tempkNoUnk#3eff00",
                "AREA:tempjNoUnk#17ff00",
                "AREA:tempiNoUnk#00ff10",
                "AREA:temphNoUnk#00ff36",
                "AREA:tempgNoUnk#00ff5c",
                "AREA:tempfNoUnk#00ff83",
                "AREA:tempeNoUnk#00ffa8",
                "AREA:tempdNoUnk#00ffd0",
                "AREA:tempcNoUnk#00fff4",
                "AREA:tempbNoUnk#00e4ff",
                "AREA:tempaNoUnk#00beff",

                # Line along the top of the gradient graph
                "LINE2:temp#0000FF:$_[2] ($_[0])",

                "GPRINT:temp:MIN:  Min\\: %2.lf",
                "GPRINT:temp:MAX: Max\\: %2.lf",
                "GPRINT:temp:AVERAGE: Avg\\: %4.1lf",
                "GPRINT:temp:LAST: Current\\: %2.lf degrees C\\n";
        if ($ERROR = RRDs::error) { print "$0: unable to generate $_[0] graph: $ERROR\n"; }
}


If you follow rsay's instructions (mostly 6. and 7.) here: http://mysettopbox.tv/phpBB2/viewtopic.php?t=20619&sid=beb5802af56fc3713a51f90eb57d6961, it isn't too hard to add.

HTD.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 15, 2010 8:42 pm 
Offline
Joined: Fri Nov 04, 2005 7:11 am
Posts: 61
Thanks,

Its working great for me.

_________________
BE: R8.4, HVR2250, MCE media center remote, GigaByte GA-EP43-UD3L, 2gb ram

FE: Linhes 8.4, Mythbuntu, Linux Mint DE


Top
 Profile  
 

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


All times are UTC - 6 hours




Who is online

Users browsing this forum: Google [Bot] and 2 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