Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
first of all my apologies due to my poor English, is not lenguage
I have a little problem with a script that i use to send email messages regarding service status.
all process to sent and receive is ok, but the body of the message is not complete, below theres an example
Notificacion de tipo: PROBLEM
Equipo: Server (CPU)
Servicio: CRITICAL
Estado actual: busy <<<<<<<<<<<<<<<
in the line with "busy" must be show also a percentaje for the critical message and another stuff that the plugin shows as result
but i just receive only one word
My question is, is there some command line or instruccion on the perl script who is limiting the characters ???
I am not an Expert on perl or linux, so is difficult to me try to understand the code of the sript
Just off the top of my head... if the $status argument being passed in contains for example: "%90", it may get interpreted as a hash that doesn't exist, you may need to validate the input.
#******************************************************************************
#
# Function : send_email
#
# Description : Send an email warning for errors
#
# Params : $_[0] error msg
#
# Returns : none
#
#******************************************************************************
sub send_email
{
my (
$error_msg, # input error msg
$hostname, # name of this box for sending
$prog_full_name, # prog path + name
$contact_email, # contact email address
$mailer, # mailer object
$sender, # sender of email as specified in cfg file
$subject, # subject line in email
$body_text # actual email msg text
);
# Assign input params
$error_msg = $_[0];
# Get hostname anyway we can using Sys::Hostname;
# tries syscall(SYS_gethostname), `hostname`, `uname -n`
$hostname = Sys::Hostname::hostname();
# Get program full path name
$prog_full_name = cwd()."/${0}";
# Set the fields required by Mailer...
$contact_email = $cfg::params{'ADMIN_EMAIL'};
$sender = "$prog_full_name";
$subject = "$prog_full_name: Error trapped";
$body_text = "This is an automated message:\n\n".
"$error_msg\n\n".
"Regards,\n$prog_full_name at $hostname\n\n";
# ... and send it
$mailer = Mail::Mailer->new("sendmail");
$mailer->open({ From => $sender,
To => $contact_email,
Subject => $subject,
}) or print "Can't open Mailer for sendmail: $!\n";
print $mailer $body_text;
close($mailer) or die "Can't close mailer: $!";
}
Maybe you can adjust it for your use; I've used it many times.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.