![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| System usage check | pushkar.verma | AIX | 3 | 01-25-2008 10:11 AM |
| CPU usage and memory usage | mansoorulhaq | High Level Programming | 1 | 08-09-2007 01:55 PM |
| how to use ioctl to check out memory usage | lanchen | High Level Programming | 2 | 01-31-2006 09:30 AM |
| Check the Disk usage Programmatically | SriSri | High Level Programming | 2 | 09-20-2005 12:15 AM |
| Monitor CPU usage and Memory Usage | Gajanad Bihani | High Level Programming | 2 | 03-09-2005 03:35 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
check cpu usage
Hi,
Are there previous threads on perl scripts that check the cpu usage and send email whenever this exceeded a certain threshold? Thanks. |
| Forum Sponsor | ||
|
|
|
|||
|
Hi!
This might be useful. It would give you procedure to send a mail thru perl.Extracting cpu usage shouldn't be a big deal. Code:
sub _send_email($$$) {
my $recipient = shift;
my $full_name = shift;
my $result_file = shift;
my $res_file = basename($result_file);
my $res_dir = dirname($result_file);
chomp(my $hostname = qx/uname -n/);
my $msg = MIME::Lite->new(
From => '"Manager Usage" <MGR@"Server name">',
To => "\"$full_name\" <$recipient>",
Subject => "Results of usage for $input_dir on $hostname",
Type => 'multipart/mixed',
Data => "The results of your usage run are attached."
);
$msg->attach(
Type => 'TEXT',
Data => "Hello,\n$full_name\n\nPlease DO NOT reply to this email!\n\nIt was generated by a non-user account. Attached is a file\ncontaining the results of your requested deck_check.upl run.\n\nThank You,\nThe HP Issuance Team"
);
$msg->attach(
Type => 'TEXT',
Path => "$result_file",
Filename => "$res_file",
Disposition => 'attachment'
);
$msg->send("sendmail");
}
|