[Orca-users] Re: plot ambient and cpu temperature on E450

Adam Levin alevin at audible.com
Thu Feb 1 11:32:13 PST 2001


On Tue, 30 Jan 2001, Julian R C Briggs wrote:
> Dear Blair,
> Thanks.
> I searched the SE includes without success.  I ran truss prtdiag -v but
> don't see how to use the output.
> I'll stick with my MRTG plotting.
> Thanks again for the suggestions.

I'm sure there's some way of getting SE to do it, but until I find it,
here's a perl script that'll create separate logs for plotting the
temp.  It drops the files in /var/adm/sa/temp-percol-YYYY-MM-DD.  Run
it with a -d flag (or any argument, really) and it'll spit the output
to the screen instead, for debugging.  I run it every five minutes
from cron.

While I'm posting, though, I've got a problem, because for some reason
I'm not seeing the graphs show up.  I've restarted orca, but it's not
picking up the new files.

I'm using orca 0.25, not .26, because everything else has been working
and I'm worried about upgrading and causing problems (if anyone has
any advice, I'll hear it).

My config file has the following three groups defined:
group orcallator {
find_files /usr/local/orca/var/orca/orcallator/(.*)/percol-\d{4}-\d{2}-\d{2}
column_description      first_line
date_source             column_name timestamp
date_format             %s
interval                300
reopen                  1
}

group temp {
find_files              /usr/local/orca/var/orca/orcallator/(.*)/temp-percol-\d{
4}-\d{2}-\d{2}
column_description      first_line
date_source             column_name timestamp
date_format             %s
interval                300
reopen                  1
}

group im {
find_files              /usr/local/orca/var/orca/orcallator/(im-prod.)/bvstatlog
-\d{4}-\d{2}-\d{2}
column_description      first_line
date_source             column_name timestamp
date_format             %s
interval                300
reopen                  1
}

And the last graph definition is this:
plot {
title                   %g Ambient and CPU Temperature
source                  temp
data                    (ambient*(9/5))+32
data                    (cpu0*(9/5))+32
data                    (cpu1*(9/5))+32
data                    (cpu2*(9/5))+32
data                    (cpu3*(9/5))+32
legend                  Ambient
legend                  CPU0
legend                  CPU1
legend                  CPU2
legend                  CPU3
y_legend                Temperature (F)
href                    orcallator.html#temperature
}

I'm not seeing any error messages from orca, but the graphs just aren't 
showing up.  Is there a problem with the data expressions, maybe?

---SCRIPT orcatemp.pl BELOW---

#!/usr/local/bin/perl -w
use strict;
use sigtrap;
use Time::Local;

my ($sec,$min,$hour,$day,$mon,$year,$wday,$yday,$isdst)=localtime(time);
($sec<10) && ($sec="0".$sec);
($min<10) && ($min="0".$min);
($hour<10) && ($hour="0".$hour);
($day<10) && ($day="0".$day);
$mon++;
($mon<10) && ($mon="0".$mon);
$year+=1900;
chomp(my $hostname=`/bin/hostname`);

my $orcafile="/var/adm/sa/temp-percol-$year-$mon-$day";
my $localtime="$hour:$min:$sec";

open(I,"/usr/platform/sun4u/sbin/prtdiag -v|") || die "Can't open prtdiag.\n";

my $numcpu;
chomp($numcpu=<I>);
$numcpu=~s/.*\((\d).*/$1/;

if (defined($ARGV[0])) {
  open(ORCA,">&STDOUT");
}
else {
  open(ORCA,">>$orcafile") || die "Can't open $orcafile: $!\n";
}
if (-z $orcafile) {
  print ORCA "timestamp localtime ambient ";
  for (my $i=0;$i<$numcpu;$i++) {
    print ORCA "cpu$i ";
  }
  print ORCA "\n";
}

my $line;
while (<I>) {
  if (!/^System Temperatures \(Celsius\):$/) {
    next;
  }
  $line=<I>; # get rid of the line of hyphens
  print ORCA time()," $localtime ";
  chomp($line=<I>); # this is the first temp line
  while ($line!~/=/) {
    $line=~/[^ ]*  +(.*)/;
    print ORCA "$1 ";
    chomp($line=<I>);
  }
  print ORCA "\n";
}
close(I);
close(ORCA);
exit 0;



More information about the Orca-users mailing list