Help - Search - Members - Calendar
Full Version: MRTG for monitoring system load/etc
The Planet Forums > Control Panels > Plesk
Swamper
Hi

I've gone all over the net looking for scripts/mrtg config directives to do this sorta stuff... It seems to me there is a lot more confusion then there needs to be..

Anyone know of a reliable way to setup mrtg to monitor system load? I've tried scripts that just parse the 'uptime' and then use that data but I must be missing something here.. anyone set it up successfully? I have it running to monitor network traffic already, now the system load is my road block icon_sad.gif

thanks
Swamper
Problem solved.

My mrtg-load.cfg:

CODE
Workdir: /usr/local/psa/home/vhosts/yourdomain/httpdocs/mrtg

Target[load]: `perl /etc/mrtg/mrtg-load.pl`

Title[load]: Processor stats at home

PageTop[load]: <H1>Processor stats</H1>

MaxBytes[load]: 500

Unscaled[load]: ymwd

Options[load]: growright, gauge, nopercent

YLegend[load]: System Load (%)

ShortLegend[load]: Load

Legend1[load]: System load during the last 1 min

Legend2[load]: System load during the last 5 min

LegendI[load]: 1 min

LegendO[load]: 5 min


Here's the perl script (mrtg-load.pl) that mrtg-load.cfg calls:

CODE
!/usr/bin/perl

#

# Perl script to gather load average information for MRTG

# Copyright (C) 2000 Chris Gushue <seymour@lazygenes.net>  

#

# Put something like this in your /etc/mrtg.cfg

#

# Title[load]: System Load for krypton.lazygenes.net

# PageTop[load]: <H1>486 DX4-100, 12MB RAM</H1><BR><H2>Debian 2.1 (slink) GNU/Linux</H2>

# Target[load]: `/usr/local/bin/load.pl`

# MaxBytes[load]: 100

# Options[load]: growright, gauge

# YLegend[load]: System Load (%)

# ShortLegend[load]: Load

# Legend1[load]: System load during the last 1 min

# Legend2[load]: System load during the last 5 min

# LegendI[load]: 1 min

# LegendO[load]: 5 min



# Edit this variable for your host

$hostname = "yourdomain.com";



# Open /proc/loadavg and load into @loadavg

open(LOADAVG, '/proc/loadavg') or die "Can't open /proc/loadavg? That's probably not goodn";

while(<LOADAVG>) {

       @loadavg = split(/s/, $_);

}

close(LOADAVG);



# Get load averages, multiply each by 100 for MRTG

$load1 = $loadavg[0]*100;

$load2 = $loadavg[1]*100;

$load3 = $loadavg[2]*100;



# Get a nice uptime string

open(UPTIME, '/proc/uptime') or die "Can't open /proc/uptime? That's probably not goodn";

while(<UPTIME>) {

       @uptime = split(/s/, $_);

}

close(UPTIME);



# This section based on Freddie's C source for mrtguptime

$days  = int($uptime[0] / 86400);

$secs  = int($uptime[0] % 86400);

$hours = int($secs / 3600);

$secs  = int($secs % 3600);

$mins  = int($secs / 60);

$secs  = int($secs % 60);



if ($days >= 1) {

       if ($hours >= 1) {

               if ($mins >= 1) { $uptime = "$days days, $hours hours, $mins mins"; }

               else { $uptime = "$days days, $hours hours"; }

       }

       else {

               if ($mins >= 1) { $uptime = "$days days, $mins mins"; }

               else { $uptime = "$days days"; }

       }

}

else {

       if ($hours >= 1) {

               if ($mins >= 1) { $uptime = "$hours hours, $mins mins"; }

               else { $uptime = "$hours hours"; }

       }

       else {

               if ($mins >= 1) { $uptime = "$mins mins"; }

               else { $uptime = "0 mins"; }

       }

}



# Output stuff for MRTG

print "$load1n";

print "$load2n";

print "$uptimen";

print "$hostnamen";



exit 0;


...to access your stats visit http://yourdomain.com/mrtg/load.html

my /etc/crontab entry looks like this:

0-59/5 * * * * root /usr/local/mrtg-2/bin/mrtg /etc/mrtg/mrtg-load.cfg

(I installed mrtg 2.9.17 from source tarball)
mmoncur
After I tried to figure out how to do everything I wanted using MRTG and my brain exploded, I stumbled across this:

http://www.bernisys.prima.de/linux/hotsanic/

HotSaNIC uses RRDTOOL (from the author of MRTG) to graph a bunch of system parameters. It took a bit of tweaking to configure, but the system monitoring stuff is exactly what I wanted. Here's an example from the developer's page:

http://www.bernisys.prima.de/linux/hotsani...mple/index.html
projectandrew
Have you got HotSaNIC fully installed and working ok? I think it's woking for me, but the thumbnails don't seem to be updating :confused:
madsere
QUOTE
Originally posted by mmoncur
Here's an example from the developer's page:

http://www.bernisys.prima.de/linux/hotsani...mple/index.html

Sexy! Particularly the CPU temperature thingy ... that outta come in handy on the AMD and Raq boxes who're both infamous for running a little hot sometimes.

I wonder when somebody comes up with an ENSIM HOWTO for installing this!
projectandrew
Well, when I am happy that I've got it fully working, then I'll probably write one to stick on my site... I have started to document all changes I make to my servers, and it's just takes a little time to turn these into HOW-TOs.
mmoncur
HotsaNIC was pretty easy to set up for me. It does take a while to update the thumbnails - I think they update every 24 hours by default since they're coming from the weekly graphs.

Also, you need to have ImageMagick installed and enter the correct path for the `convert' command in the settings file.

I haven't got CPU temperature monitoring working yet. The system, partition, ping, and traffic modules are working fine though.
Mike2522
Do you guys have any how-to on Hostsanic?
jiXo
This is a question for the people that are using HotSaNIC:
Did you do anything especial to use the ping module? All the modules i need from HotSaNIC run without problems, excepts that... the graphs are not created icon_sad.gif
These are the settings i use (example):

INTERVAL=60
TYPE=classic
HOST=64.246.69.69, myhost.com
boing
how-to:


http://www.unofficial-support.com/modules....rticles&secid=1


-boing?
boing
omg, i just realized i was under the plesk section, not ensim... that how-to was written for ensim i believe!!

sorry bout that! maybe it can help anyways?

-boing?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.