1835348 Members
2882 Online
110078 Solutions
New Discussion

Mrtg setup

 
David_246
Trusted Contributor

Mrtg setup

Hi,

I have setup MRTG the way Sridhar Bhaskarla descibed it in thread http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xd7a2afe90f1cd71190050090279cd0f9,00.html
And this works terrific, although :)
Why does he add two zeros at the end of the file ? I read quiet some docu, but couldn't find it.

He does a get_sar and uses only number system and user and than add two zeros to the input file. Anyone an explanation. I try to make a graph using four lines; user, system, wio and idle. Does anyone have some good (web) documentation about it ?(the way Sridhar uses it is not described in the main Oetker page, so any other than the main Oetker page is very apreciated)





-------------------------------------------------
My modifications :

# cat get_sar.pl
#!/usr/local/bin/perl

use strict;

our @servers=("nlhpunx1n1", "nlhpunx1n2", "nlhpunx2n1", "nlhpunx2n2", "nlhpunx2n3");
our $mrtg="/usr/local/bin/mrtg";

foreach my $server(@servers) {
my @output;
my $LOG="/home/mrtg/log/cpu_${server}.log";
my $CFG="/home/mrtg/cfg/mrtg_${server}.cfg";
my $input = `ssh $server "sar -u 2 5 | tail -1"`;
my @input = split( /\s+/, $input);
push(@output, $input[1]);
push(@output, $input[2]);
push(@output, 0);
push(@output, 0);

open(FH, "> $LOG");

foreach my $number(@output) {
print FH "$number\n";
}

close(FH);
`$mrtg $CFG`;
}

--------------------------

# cat mrtg_nlhpunx1n1.cfg
WorkDir: /home/mrtg/html
Target[cpu.nlhpunx1n1]:`cat /home/mrtg/log/cpu_nlhpunx1n1.log`
MaxBytes[cpu.nlhpunx1n1]: 150
Options[cpu.nlhpunx1n1]: gauge, nopercent
Title[cpu.nlhpunx1n1]: nlhpunx1n1 CPU Usage
PageTop[cpu.nlhpunx1n1]:

nlhpunx1n1 CPU (SYSTEM Vs USER)



WithPeak[cpu.nlhpunx1n1]: dwm
YLegend[cpu.nlhpunx1n1]: CPU (USR vs SYS)
LegendI[cpu.nlhpunx1n1]: User
LegendO[cpu.nlhpunx1n1]: Sys
@yourservice