Hi,
Are there previous threads on perl scripts that check the cpu usage and send email whenever this exceeded a certain threshold?
Thanks.
Hi,
Are there previous threads on perl scripts that check the cpu usage and send email whenever this exceeded a certain threshold?
Thanks.
If there are no threads related to this,
Does anyone know a way for this?
Thanks
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.
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");
}
thanks nua7