Is there a way to include the result ofcheck_nagiosin the subject line of an e-mail?
Hatten, Ken
khatten at ti.com
Wed Jul 5 22:38:48 CEST 2006
Marc -
Not sure this is what you are looking for, but... I often exec a call
to mailx with an embedded exec in the subject space with a command
string like this (note the backtick (grave) characters ` around the
commands):
cat <some file> | mailx -s "`uname -n` at `date +%H%M%S`" <email alias>
and I get an email with the subject: "Hostname at 153211" (for example)
.
I tried this one:
echo | mailx -s "`cat <some file>`" emailalias
and the first line of the file was the subject, the rest of the file
made up the body. So, if you command delivered more than 1 line, only
the first would be in the subject; the rest in the body.
Regards,
Ken Hatten
CM Ops Admin
-----Original Message-----
From: nagios-users-bounces at lists.sourceforge.net
[mailto:nagios-users-bounces at lists.sourceforge.net] On Behalf Of Marc
Powell
Sent: Wednesday, July 05, 2006 8:35 AM
To: nagios-users at lists.sourceforge.net
Subject: Re: [Nagios-users] Is there a way to include the result
ofcheck_nagiosin the subject line of an e-mail?
> -----Original Message-----
> From: nagios-users-bounces at lists.sourceforge.net [mailto:nagios-users-
> bounces at lists.sourceforge.net] On Behalf Of Rimbert Rivera
> Sent: Wednesday, July 05, 2006 8:25 AM
> To: nagios-users at lists.sourceforge.net
> Subject: [Nagios-users] Is there a way to include the result of
> check_nagiosin the subject line of an e-mail?
>
> I have a Cron job running every two hours that runs check_nagios and
e-
> mails us the result. Here's the command I'm using:
>
> /usr/local/nagios/libexec/check_nagios -F
/usr/local/nagios/var/status.log
> -e 5 -C /usr/local/nagios/bin/nagios | mail -s"Nagios Status check
> (heartbeat)" email at domain.com
>
> The command e-mails the check_nagios output as the e-mail body. Is
there
> a way to put it in the subject line instead? I cannot figure it out.
I
> don't think mail will let me do what I want. Is there something else
I
> can use? I'm using RedHat 9.
echo '' | mail -s "`/usr/local/nagios/libexec/check_nagios -F
/usr/local/nagios/var/status.log -e 5 -C /usr/local/nagios/bin/nagios`"
email at domain.com
--
Marc
Using Tomcat but need to do more? Need to support web services,
security?
Get stuff done quickly with pre-integrated technology to make your job
easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when
reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list