[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] [RaQ4] CPU Usage ?



At 01:16 PM 23/11/02 +0000, you wrote:
>Anyway of checking this afterwards ??
>I don't wanne stare at the active monitor all day long

I've been wanting to do a similar thing lately (there seems an occasional lag in opening files on a windows machine via samba, and i wondered if the server was busy at the time.. another time for that one), so I created my first little bash script and added it to Cron. It seems to work really well :-)))))))) <enormous grin for my personal achievement in linux!>

First, [well, after spending several hours trawling the internet] I created a file called uptime_log (I found that entering "touch uptime_log" did the trick).

Then created two text files using pico

<SNIP>

This all works to send the results from the command "uptime" to the uptime_log file. the script is called by Cron every 10 minutes in my case. I quickly lost track of which day was which, so the uptimelogscript_date script is run once a day, first thing in the morning. The uptime result goes on a new line every time by itself, which is why I couldn't just use the date>>/home... command in front of every line created.

To read the log file I use "cat uptime_log | more"

I hope this helps,
Steve

Our solution was to create a script in cron.daily:
(/etc/cron.hourly/mem-report.pl)

#!/usr/bin/perl
#$topoutput = `/usr/bin/top -b -n1`;
$topoutput = `cat /proc/meminfo`;
open (MAIL,"|/usr/sbin/sendmail -t");
print MAIL "From: admin\@domain.com\n";
print MAIL "To: admin\@domain.com\n";
print MAIL "Subject: Hourly MEM Report\n\n";
print MAIL "$topoutput\n\n";
close (MAIL);



This gives us an hourly picture of what's happening by email.

- Bill



---------------------------------
William J.A. Brillinger
Precision Design Co.

E-Mail:   mailto:billy@xxxxxxxxxx
Web site: http://www.pdcweb.net