Is there a way to include the result of check_nagios in the subject line of an e-mail?
Hari Sekhon
harisekhon at gmail.com
Wed Jul 5 16:37:24 CEST 2006
Hari Sekhon wrote:
> Rimbert Rivera wrote:
>> Thanks, Hari, that works great!
>>
>>
>> - Rim
>>
>> Rimbert Rivera
>> Manager, Information Technology
>> COMTEX News Network
>> rrivera at comtex.com
>> (703) 820-2000
>> Discover more about COMTEX at: http://www.comtex.com/
>> This e-mail is intended solely for the person or entity to which it
>> is addressed and may contain confidential and/or privileged
>> information. Any review, dissemination, copying, printing or other
>> use of this e-mail by persons or entities other than the addressee is
>> prohibited. If you have received this e-mail in error, please contact
>> the sender immediately and delete the material from any computer.
>>
>>
>>
>> ------------------------------------------------------------------------
>> *From:* Hari Sekhon [mailto:harisekhon at gmail.com]
>> *Sent:* Wednesday, July 05, 2006 9:37 AM
>> *To:* Rimbert Rivera
>> *Subject:* Re: [Nagios-users] Is there a way to include the result of
>> check_nagios in the subject line of an e-mail?
>>
>> Rimbert Rivera wrote:
>>> It's piping the command to mail.
>>>
>>> This is the check command:
>>> /usr/local/nagios/libexec/check_nagios -F
>>> /usr/local/nagios/var/status.log -e 5 -C /usr/local/nagios/bin/nagios
>>>
>>> This is the mail command:
>>> mail -s"Nagios Status check (heartbeat)" email at domain.com
>>>
>>> So I'm using the pipe command, "|", to redirect the output of the
>>> check to mail
>>>
>>> Full command:
>>> /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
>>>
>>>
>>> - Rim
>>>
>>> Rimbert Rivera
>>> Manager, Information Technology
>>> COMTEX News Network
>>> rrivera at comtex.com
>>> (703) 820-2000
>>> Discover more about COMTEX at: http://www.comtex.com/
>>> This e-mail is intended solely for the person or entity to which it
>>> is addressed and may contain confidential and/or privileged
>>> information. Any review, dissemination, copying, printing or other
>>> use of this e-mail by persons or entities other than the addressee
>>> is prohibited. If you have received this e-mail in error, please
>>> contact the sender immediately and delete the material from any
>>> computer.
>>>
>>>
>>>
>>> ------------------------------------------------------------------------
>>> *From:* Hari Sekhon [mailto:harisekhon at gmail.com]
>>> *Sent:* Wednesday, July 05, 2006 9:25 AM
>>> *To:* Rimbert Rivera
>>> *Subject:* Re: [Nagios-users] Is there a way to include the result
>>> of check_nagios in the subject line of an e-mail?
>>>
>>> Rimbert Rivera wrote:
>>>>
>>>> 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.
>>>>
>>>> - Rim
>>>>
>>>> Rimbert Rivera
>>>> Manager, Information Technology
>>>> COMTEX News Network
>>>> rrivera at comtex.com
>>>> (703) 820-2000
>>>> Discover more about COMTEX at: _http://www.comtex.com/_
>>>> This e-mail is intended solely for the person or entity to which it
>>>> is addressed and may contain confidential and/or privileged
>>>> information. Any review, dissemination, copying, printing or other
>>>> use of this e-mail by persons or entities other than the addressee
>>>> is prohibited. If you have received this e-mail in error, please
>>>> contact the sender immediately and delete the material from any
>>>> computer.
>>>>
>>>> ------------------------------------------------------------------------
>>>>
>>>> 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
>>> how are you sending the emails?
>>>
>>>
>> this works for me:
>>
>> /usr/nagios/libexec/check_nagios -F /var/nagios/status.log -e 5 -C
>> /usr/nagios/bin/nagios > nagtest.txt
>> mail -s "`cat nagtest.txt`" me at mydomain.com < /dev/null
>>
>> -h
>>
>>
> I liked it, so now I've written a shell script to use this and send me
> a heartbeat, thanks for the idea...! I've also modified the heartbeat
> script to make a separate script to send me an email to a different
> alias only if there is a problem so I can filter them easily and be
> notified more clearly if there is a problem..
>
> -h
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20060705/d67f5e6a/attachment.html>
-------------- next part --------------
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
-------------- next part --------------
_______________________________________________
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