[mrtg] Re: monitor of the t emperature

kikaku1 kikaku1 at cniri.go.jp
Fri Sep 10 16:31:53 MEST 1999


Thank you so so so much!! Everything is OK.

> Let's try that again:
> 
> > > > I want to monitor the temperature of the machine by using mrtg_2
.5.1.
> > > > But I failed to do it.
> > > > I have a perl script "temp.pl" which gives us the output of the 
temperat
> > > > ure as 
> > > > the format of "(temperature)\n\n\n\n".
> > > 
> > > I'm not sure if you should have two numbers. First try the stuff m
entioned
> > > below, if it still fails try "(temp)\n0\n\n\n"
> > > When run from the command line your output should show up as the f
ollowing
> > > lines, however without quotes:
> > > "/usr1/people/yamada$ ./temp.pl"
> 
> This means: From the command prompt on your machine, go into the direc
tory
> where your script is placed (i guessed it is /usr1/people/yamada) and 
execute
> the script as follows (without the quotes): "./temp.pl" .

I get it.

> It should return the following lines (again: without the quotes):
> > > "42"
> > > "0"
> > > ""
> > > ""
> 
> > > > My Mrtg.cfg is as follows.
> > > >   
> > > > Target[temp]: '/usr1/people/yamada/temp.pl'
> 
> This should be back ticks, not "normal" quotes.
> At your command prompt, enter the following line (again: leave out the
 double
> quotes):   "echo `./temp.pl`"
> If this returns two numbers (probably without a newline) then you have
 the
> right quotes.

You are right. 
I got as follows.

"42""42"""""(without a newline)

> 
> > > > MaxBytes[temp]: 
> > > 
> > > Provide a number for maxbytes or leave the line out.
> > > 
> You should put a number after "MaxBytes[temp]:" so that it reads, for 
instance
> something like "MaxBytes[temp]: 100" however the number is dependant o
n what you
> actually could get as a maximum.

I set 50 in MaxBytes.

> 
> > > Add a line "Options[temp]: gauge
> > > 
> > > Try
> > > Target[temp]: `/usr1/people/yamada/temp.pl`
> > > 
> > > Those are backticks (on the same key as the ~)
> > > 
> This answer was provided by someone else (brian IIRC).
> 
> Most keyboards I know do have the backtick and tilde on the same key, 
this does
> not have to be true for your config. Look for a quote that looks like 
a small
> line from upper-left to lower right.
> 
> 
> 
> 1) Clean up your configuration file and modify as stated above
> 2) remove any logfiles and/or other files that were made by mrtg
> 3) run mrtg and make sure that you see its output
> 3b) Expect to get a failure message about the logfile and the backup l
og

The failure message about it:

Rateup WARNING: /usr/local/src/mrtg-2.5.1//rateup could not read the pri
mary log
 file for temp
Rateup WARNING: /usr/local/src/mrtg-2.5.1//rateup The backup log file fo
r temp was invalid as well
Rateup WARNING: /usr/local/src/mrtg-2.5.1//rateup Can't remove temp.old 
updating log file
Rateup WARNING: /usr/local/src/mrtg-2.5.1//rateup Can't rename temp.log 
to temp.old updating log file

> 4) look in the directory, there should be new files, named "temp.log" 
and
>    "temp-day.gif", "temp-week.gif" etcetera.
> 5) run mrtg again
> 5b) Expect another failure message about the backup log, not the norma
l log

The failure message about it:

Rateup WARNING: /usr/local/src/mrtg-2.5.1//rateup Can't remove temp.old 
up
dating log file

> 6) There should be "temp.log" and "temp.old" + the other files
> 7) Without much delay, run your script by hand. Remember the numbers.
>    View the first line of "temp.log" and compare the second and third 
number
>    with the output of your script. They should be the same or very clo
se.
> 8) wait 15 minutes
> 9) repeat step 5,6 and 7 (not step 5b)
> 10) If all is okay, view the first few lines of "temp.log". They shoul
d show
>     expected values in the second column.

the first few lines of temp.log is
----------------------
36972356 30 30
936972356 30 30 30 30
936972039 40 40 40 40
936972000 34 34 40 40
936971700 7 7 30 30
936971400 0 0 0 0
936971100 0 0 0 0
936970800 0 0 0 0
936970500 0 0 0 0
936970200 0 0 0 0
------------------------

> 
> Try above list and stop when a step fails. If nothing fails, well done
. If
> something fails try to describe what fails and if you cant figure it o
ut, do
> post again.
> 
> Regards,
> Alex
> 
> --
> * To unsubscribe from the mrtg mailing list, send a message with the
>   subject: unsubscribe to mrtg-request at list.ee.ethz.ch
> * The mailing list archive is at http://www.ee.ethz.ch/~slist/mrtg
> 
> 
> 

I'll write my condition.

I have the NBASE-Xyplex machine: Giga switch GFS3016/BU. 

My Mrtg.cfg is 
--------------------------------------------------------------------
Target[temp]: `/usr/local/src/mrtg-2.5.1/temp.pl ******.cniri.go.jp`
MaxBytes[temp]: 50
Title[temp]:  (): Temp_******
Options[temp]: gauge
PageTop[temp]: <H1>Temperature check for NBASE
 </H1>
 <TABLE>
   <TR><TD>System:</TD><TD> NBASE </TD></TR>
   <TR><TD>Maintainer:</TD><TD></TD></TR>
   <TR><TD>Interface:</TD><TD>NBASE</TD></TR>
   <TR><TD>IP:</TD><TD> ()</TD></TR>
   <TR><TD>Max Temp:</TD>
       <TD>45</TD></TR>
  </TABLE>
---------------------------------------------------------------------


My temp.pl is 
---------------------------------------------------------------------
#!/usr/sbin/perl

use Net::Telnet ();

$count = 1;
$t = new Net::Telnet (Timeout => 3);
$t->open($ARGV[0]);
$t->login("(username)", "(password)");  #---leave out ()
while ($count >= 1) {
        @lines = $t->cmd("get-sysctl-temp");
        $y = substr("@lines", 22, 2);
        if ($y < 0) {
                $count++;
                if ($count > 3) {
                        last;
                }
                redo;
        }
        print "$y\n$y\n\n\n";
        last;
}
$t->close;
---------------------------------------------------------------------

And I used Net::Telnet.


Sincerely yours,

T. Yamada


****************************************************
Chugoku National Industrial Research Institute
2-2-2 Hiro-Suehiro, Kure, Hiroshima 737-0197, JAPAN
Tel: +81-823-72-1902   Fax: +81-823-70-0023
E-mail:kikaku1 at cniri.go.jp
****************************************************

--
* To unsubscribe from the mrtg mailing list, send a message with the
  subject: unsubscribe to mrtg-request at list.ee.ethz.ch
* The mailing list archive is at http://www.ee.ethz.ch/~slist/mrtg


More information about the mrtg mailing list