Re: [Nagios-users] FW: Not sending e-mails

2009-10-01 Thread Martin Melin
Try simply copying the command_line for notify-service-by-email and running
it in a shell yourself. Or just do:
# echo Hello world | /bin/mail -s Test Email r...@localhost

On Thu, Oct 1, 2009 at 8:28 PM, Scott Miller srmil...@interbel.net wrote:


 Scott Miller wrote:
  I know this has been hit over and over, and I've read literally
 everything I
  could find, but to no avail.  I have a newly install of Nagios 3.2.0 on
 a
  Fedora Core 8 with Postfix/Dovecot.  I have a modified script (postfix
 mail
  queue monitor I shared a week or so ago).  The only thing Nagios is
 doing
 on
  this box is looking at local services.  When I change any threshold so I
  will go into alarm, it does, but no e-mails get sent out.
 
  I can see in my logs the following when something comes into alarm:
 
  [1254408621] SERVICE ALERT: localhost;Postfix Mail
  Queue;CRITICAL;SOFT;1;CRITICAL: Postfix mailq has 14 messages queued for
 a
  total of 12492 Kbytes.
  [1254408651] SERVICE ALERT: localhost;Current Load;OK;SOFT;2;OK - load
  average: 4.87, 2.73, 1.43
  [1254408681] SERVICE ALERT: localhost;Postfix Mail
  Queue;CRITICAL;SOFT;2;CRITICAL: Postfix mailq has 16 messages queued for
 a
  total of 12497 Kbytes.
  [1254408741] SERVICE ALERT: localhost;Postfix Mail
  Queue;CRITICAL;SOFT;3;CRITICAL: Postfix mailq has 16 messages queued for
 a
  total of 12689 Kbytes.
  [1254408801] SERVICE ALERT: localhost;Postfix Mail
  Queue;CRITICAL;HARD;4;CRITICAL: Postfix mailq has 15 messages queued for
 a
  total of 12494 Kbytes.
  [1254408801] SERVICE NOTIFICATION: nagiosadmin2;localhost;Postfix Mail
  Queue;CRITICAL;notify-service-by-email;CRITICAL: Postfix mailq has 15
  messages queued for a total of 12494 Kbytes.
  [1254408801] SERVICE NOTIFICATION: nagiosadmin;localhost;Postfix Mail
  Queue;CRITICAL;notify-service-by-email;CRITICAL: Postfix mailq has 15
  messages queued for a total of 12494 Kbytes.
 
  Wondering if anyone could double check the pertinent parts of my config?
 
  Thanks in advance.
 
  Scott Miller
 
  What's in your mail log?  Nagios is trying to send notifications using
  the command you've defined, according to the logs. You haven't provided
  the definition for that command (notify-service-by-email), but I assume
  it's trying to send an email.
 
  If you're using anything like the example commands that come with
  Nagios, it is probably using something like /bin/mail to send the
  message, and your mail log would be a good place to look for why it's
  not being delivered.

 Sorry - didn't include that from the commands.cfg - Here's what I have.

 commands.cfg
 
 # 'notify-host-by-email' command definition
 define command{
command_namenotify-host-by-email
command_line/usr/bin/printf %b * Nagios
 *\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState:
 $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time:
 $LONGDATETIME$\n | /bin/mail -s ** $NOTIFICATIONTYPE$ Host Alert:
 $HOSTNAME$ is $HOSTSTATE$ ** $CONTACTEMAIL$
}

 # 'notify-service-by-email' command definition
 define command{
command_namenotify-service-by-email
command_line/usr/bin/printf %b * Nagios
 *\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService:
 $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState:
 $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional
 Info:\n\n$SERVICEOUTPUT$ | /bin/mail -s ** $NOTIFICATIONTYPE$ Service
 Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ ** $CONTACTEMAIL$
}

 This is the exact same way I have it on another machine running checks for
 multiple boxes and devices.  The only difference, is this server is running
 Postfix, the other (working) is running Sendmail.

 In my logs:
 /var/log/maillog - grep for nagios - there's nothing
 /var/log/messages shows
 Oct  1 10:53:20 mail4 nagios: SERVICE NOTIFICATION:
 nagiosadmin2;localhost;Postfix Mail
 Queue;CRITICAL;notify-service-by-email;CRITICAL: Postfix mailq has 13
 messages queued for a total of 3326 Kbytes.
 Oct  1 10:53:20 mail4 nagios: SERVICE NOTIFICATION:
 nagiosadmin;localhost;Postfix Mail
 Queue;CRITICAL;notify-service-by-email;CRITICAL: Postfix mailq has 13
 messages queued for a total of 3326 Kbytes.

 Looks like it's trying - maybe something in Postfix stoping it?  I'll have
 to do a bit more digging and testing.

 Scott Miller




 --
 Come build with us! The BlackBerryreg; Developer Conference in SF, CA
 is the only developer event you need to attend this year. Jumpstart your
 developing skills, take BlackBerry mobile applications to market and stay
 ahead of the curve. Join us from November 9#45;12, 2009. Register now#33;
 http://p.sf.net/sfu/devconf
 ___
 Nagios-users mailing list
 Nagios-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/nagios-users
 ::: Please include Nagios 

Re: [Nagios-users] FW: Not sending e-mails

2009-10-01 Thread Michael Saldivar
On Thu, Oct 1, 2009 at 12:28 PM, Scott Miller srmil...@interbel.net wrote:


 Scott Miller wrote:

 commands.cfg
 
 # 'notify-host-by-email' command definition
 define command{
command_namenotify-host-by-email
command_line/usr/bin/printf %b * Nagios
 *\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState:
 $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time:
 $LONGDATETIME$\n | /bin/mail -s ** $NOTIFICATIONTYPE$ Host Alert:
 $HOSTNAME$ is $HOSTSTATE$ ** $CONTACTEMAIL$
}

 # 'notify-service-by-email' command definition
 define command{
command_namenotify-service-by-email
command_line/usr/bin/printf %b * Nagios
 *\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService:
 $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState:
 $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional
 Info:\n\n$SERVICEOUTPUT$ | /bin/mail -s ** $NOTIFICATIONTYPE$ Service
 Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ ** $CONTACTEMAIL$
}



My Postfix e-mail commands look like this, with slightly different syntax:

# NEW 'notify-host-by-email' command definition
define command{
command_namenotify-host-by-email
command_line/usr/bin/printf %b Subject:** $NOTIFICATIONTYPE$
Host Alert: $HOSTNAME$ is $HOSTSTATE$ **\n* Nagios *\n\nNotification
Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress:
$HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n |
/usr/sbin/sendmail $CONTACTEMAIL$
}

# NEW 'notify-service-by-email' command definition
define command{
command_namenotify-service-by-email
command_line/usr/bin/printf %b Subject:** $NOTIFICATIONTYPE$
Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **\n* Nagios
*\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService:
$SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState:
$SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional
Info:\n\n$SERVICEOUTPUT$ | /usr/sbin/sendmail $CONTACTEMAIL$
}


-- 
Mike Saldivar
Direct Financial Solutions
Information Systems Manager
Desk: 435-774-8252
Cell: 435-881-3778
--
Come build with us! The BlackBerryreg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9#45;12, 2009. Register now#33;
http://p.sf.net/sfu/devconf___
Nagios-users mailing list
Nagios-users@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

Re: [Nagios-users] FW: Not sending e-mails

2009-10-01 Thread Morris, Patrick
Scott Miller wrote:
 Scott Miller wrote:
   
 I know this has been hit over and over, and I've read literally
   
 everything I
   
 could find, but to no avail.  I have a newly install of Nagios 3.2.0 on a
 Fedora Core 8 with Postfix/Dovecot.  I have a modified script (postfix
   
 mail
   
 queue monitor I shared a week or so ago).  The only thing Nagios is doing
   
 on
   
 this box is looking at local services.  When I change any threshold so I
 will go into alarm, it does, but no e-mails get sent out.

 I can see in my logs the following when something comes into alarm:

 [1254408621] SERVICE ALERT: localhost;Postfix Mail
 Queue;CRITICAL;SOFT;1;CRITICAL: Postfix mailq has 14 messages queued for
   
 a
   
 total of 12492 Kbytes.
 [1254408651] SERVICE ALERT: localhost;Current Load;OK;SOFT;2;OK - load
 average: 4.87, 2.73, 1.43
 [1254408681] SERVICE ALERT: localhost;Postfix Mail
 Queue;CRITICAL;SOFT;2;CRITICAL: Postfix mailq has 16 messages queued for
   
 a
   
 total of 12497 Kbytes.
 [1254408741] SERVICE ALERT: localhost;Postfix Mail
 Queue;CRITICAL;SOFT;3;CRITICAL: Postfix mailq has 16 messages queued for
   
 a
   
 total of 12689 Kbytes.
 [1254408801] SERVICE ALERT: localhost;Postfix Mail
 Queue;CRITICAL;HARD;4;CRITICAL: Postfix mailq has 15 messages queued for
   
 a
   
 total of 12494 Kbytes.
 [1254408801] SERVICE NOTIFICATION: nagiosadmin2;localhost;Postfix Mail
 Queue;CRITICAL;notify-service-by-email;CRITICAL: Postfix mailq has 15
 messages queued for a total of 12494 Kbytes.
 [1254408801] SERVICE NOTIFICATION: nagiosadmin;localhost;Postfix Mail
 Queue;CRITICAL;notify-service-by-email;CRITICAL: Postfix mailq has 15
 messages queued for a total of 12494 Kbytes.

 Wondering if anyone could double check the pertinent parts of my config?

 Thanks in advance.

 Scott Miller
   
 What's in your mail log?  Nagios is trying to send notifications using 
 the command you've defined, according to the logs. You haven't provided 
 the definition for that command (notify-service-by-email), but I assume 
 it's trying to send an email.

 If you're using anything like the example commands that come with 
 Nagios, it is probably using something like /bin/mail to send the 
 message, and your mail log would be a good place to look for why it's 
 not being delivered.
 

 Sorry - didn't include that from the commands.cfg - Here's what I have.

 commands.cfg
 
 # 'notify-host-by-email' command definition
 define command{
   command_namenotify-host-by-email
   command_line/usr/bin/printf %b * Nagios
 *\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState:
 $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time:
 $LONGDATETIME$\n | /bin/mail -s ** $NOTIFICATIONTYPE$ Host Alert:
 $HOSTNAME$ is $HOSTSTATE$ ** $CONTACTEMAIL$
   }

 # 'notify-service-by-email' command definition
 define command{
   command_namenotify-service-by-email
   command_line/usr/bin/printf %b * Nagios
 *\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService:
 $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState:
 $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional
 Info:\n\n$SERVICEOUTPUT$ | /bin/mail -s ** $NOTIFICATIONTYPE$ Service
 Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ ** $CONTACTEMAIL$
   }

 This is the exact same way I have it on another machine running checks for
 multiple boxes and devices.  The only difference, is this server is running
 Postfix, the other (working) is running Sendmail.

 In my logs:
 /var/log/maillog - grep for nagios - there's nothing
 /var/log/messages shows
 Oct  1 10:53:20 mail4 nagios: SERVICE NOTIFICATION:
 nagiosadmin2;localhost;Postfix Mail
 Queue;CRITICAL;notify-service-by-email;CRITICAL: Postfix mailq has 13
 messages queued for a total of 3326 Kbytes.
 Oct  1 10:53:20 mail4 nagios: SERVICE NOTIFICATION:
 nagiosadmin;localhost;Postfix Mail
 Queue;CRITICAL;notify-service-by-email;CRITICAL: Postfix mailq has 13
 messages queued for a total of 3326 Kbytes.

 Looks like it's trying - maybe something in Postfix stoping it?  I'll have
 to do a bit more digging and testing.
   
Look fine. Check your mail logs.

--
Come build with us! The BlackBerryreg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9#45;12, 2009. Register now#33;
http://p.sf.net/sfu/devconf
___
Nagios-users mailing list
Nagios-users@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


Re: [Nagios-users] FW: Not sending e-mails

2009-10-01 Thread Scott Miller
[r...@mail4 ~]# echo Hello world | /bin/mail -s Test Email
r...@localhost

[r...@mail4 ~]# /etc/mail/sendmail.cf: line 0: cannot open: No such file or
directory

[r...@mail4 ~]#

 

I'm running postfix - not sure why it's looking for sendmail.

 

 

From: Martin Melin [mailto:mme...@gmail.com] 
Sent: Thursday, October 01, 2009 11:01 AM
To: nagios-users@lists.sourceforge.net
Subject: Re: [Nagios-users] FW: Not sending e-mails

 

Try simply copying the command_line for notify-service-by-email and running
it in a shell yourself. Or just do:
# echo Hello world | /bin/mail -s Test Email r...@localhost

On Thu, Oct 1, 2009 at 8:28 PM, Scott Miller srmil...@interbel.net wrote:


Scott Miller wrote:
 I know this has been hit over and over, and I've read literally
everything I
 could find, but to no avail.  I have a newly install of Nagios 3.2.0 on a
 Fedora Core 8 with Postfix/Dovecot.  I have a modified script (postfix
mail
 queue monitor I shared a week or so ago).  The only thing Nagios is doing
on
 this box is looking at local services.  When I change any threshold so I
 will go into alarm, it does, but no e-mails get sent out.

 I can see in my logs the following when something comes into alarm:

 [1254408621] SERVICE ALERT: localhost;Postfix Mail
 Queue;CRITICAL;SOFT;1;CRITICAL: Postfix mailq has 14 messages queued for
a
 total of 12492 Kbytes.
 [1254408651] SERVICE ALERT: localhost;Current Load;OK;SOFT;2;OK - load
 average: 4.87, 2.73, 1.43
 [1254408681] SERVICE ALERT: localhost;Postfix Mail
 Queue;CRITICAL;SOFT;2;CRITICAL: Postfix mailq has 16 messages queued for
a
 total of 12497 Kbytes.
 [1254408741] SERVICE ALERT: localhost;Postfix Mail
 Queue;CRITICAL;SOFT;3;CRITICAL: Postfix mailq has 16 messages queued for
a
 total of 12689 Kbytes.
 [1254408801] SERVICE ALERT: localhost;Postfix Mail
 Queue;CRITICAL;HARD;4;CRITICAL: Postfix mailq has 15 messages queued for
a
 total of 12494 Kbytes.
 [1254408801] SERVICE NOTIFICATION: nagiosadmin2;localhost;Postfix Mail
 Queue;CRITICAL;notify-service-by-email;CRITICAL: Postfix mailq has 15
 messages queued for a total of 12494 Kbytes.
 [1254408801] SERVICE NOTIFICATION: nagiosadmin;localhost;Postfix Mail
 Queue;CRITICAL;notify-service-by-email;CRITICAL: Postfix mailq has 15
 messages queued for a total of 12494 Kbytes.

 Wondering if anyone could double check the pertinent parts of my config?

 Thanks in advance.

 Scott Miller

 What's in your mail log?  Nagios is trying to send notifications using
 the command you've defined, according to the logs. You haven't provided
 the definition for that command (notify-service-by-email), but I assume
 it's trying to send an email.

 If you're using anything like the example commands that come with
 Nagios, it is probably using something like /bin/mail to send the
 message, and your mail log would be a good place to look for why it's
 not being delivered.

Sorry - didn't include that from the commands.cfg - Here's what I have.

commands.cfg

# 'notify-host-by-email' command definition
define command{
   command_namenotify-host-by-email
   command_line/usr/bin/printf %b * Nagios
*\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState:
$HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time:
$LONGDATETIME$\n | /bin/mail -s ** $NOTIFICATIONTYPE$ Host Alert:
$HOSTNAME$ is $HOSTSTATE$ ** $CONTACTEMAIL$
   }

# 'notify-service-by-email' command definition
define command{
   command_namenotify-service-by-email
   command_line/usr/bin/printf %b * Nagios
*\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService:
$SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState:
$SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional
Info:\n\n$SERVICEOUTPUT$ | /bin/mail -s ** $NOTIFICATIONTYPE$ Service
Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ ** $CONTACTEMAIL$
   }

This is the exact same way I have it on another machine running checks for
multiple boxes and devices.  The only difference, is this server is running
Postfix, the other (working) is running Sendmail.

In my logs:
/var/log/maillog - grep for nagios - there's nothing
/var/log/messages shows
Oct  1 10:53:20 mail4 nagios: SERVICE NOTIFICATION:
nagiosadmin2;localhost;Postfix Mail
Queue;CRITICAL;notify-service-by-email;CRITICAL: Postfix mailq has 13
messages queued for a total of 3326 Kbytes.
Oct  1 10:53:20 mail4 nagios: SERVICE NOTIFICATION:
nagiosadmin;localhost;Postfix Mail
Queue;CRITICAL;notify-service-by-email;CRITICAL: Postfix mailq has 13
messages queued for a total of 3326 Kbytes.

Looks like it's trying - maybe something in Postfix stoping it?  I'll have
to do a bit more digging and testing.

Scott Miller





--
Come build with us! The BlackBerryreg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile

Re: [Nagios-users] FW: Not sending e-mails

2009-10-01 Thread Marc Powell

On Oct 1, 2009, at 3:23 PM, Scott Miller wrote:

 [r...@mail4 ~]# echo Hello world | /bin/mail -s Test Email  
 r...@localhost
 [r...@mail4 ~]# /etc/mail/sendmail.cf: line 0: cannot open: No such  
 file or directory
 [r...@mail4 ~]#

 I’m running postfix – not sure why it’s looking for sendmail.

If this is Redhat/clone, it's because /usr/lib/sendmail ends up being  
pointed to sendmail.

$ ls -al /usr/lib/sendmail
lrwxrwxrwx 1 root root 30 Nov  7  2008 /usr/lib/sendmail - /etc/ 
alternatives/mta-sendmail

$ ls -l /etc/alternatives/mta-sendmail
lrwxrwxrwx 1 root root 26 Nov  7  2008 /etc/alternatives/mta-sendmail - 
  /usr/lib/sendmail.sendmail

$ ls -l /usr/lib/sendmail*
lrwxrwxrwx 1 root root 30 Nov  7  2008 /usr/lib/sendmail - /etc/ 
alternatives/mta-sendmail
lrwxrwxrwx 1 root root 24 Nov  7  2008 /usr/lib/sendmail.postfix - ../ 
sbin/sendmail.postfix
lrwxrwxrwx 1 root root 16 Nov  7  2008 /usr/lib/sendmail.sendmail - 
  ../sbin/sendmail

You can use the 'alternatives' command to view and change this  
configuration --

# alternatives --display mta
mta - status is auto.
  link currently points to /usr/sbin/sendmail.sendmail
/usr/sbin/sendmail.sendmail - priority 90
  slave mta-pam: /etc/pam.d/smtp.sendmail
  slave mta-mailq: /usr/bin/mailq.sendmail
  slave mta-newaliases: /usr/bin/newaliases.sendmail
  slave mta-rmail: /usr/bin/rmail.sendmail
  slave mta-sendmail: /usr/lib/sendmail.sendmail
  slave mta-mailqman: /usr/share/man/man1/mailq.sendmail.1.gz
  slave mta-newaliasesman: /usr/share/man/man1/newaliases.sendmail.1.gz
  slave mta-aliasesman: /usr/share/man/man5/aliases.sendmail.5.gz
  slave mta-sendmailman: /usr/share/man/man8/sendmail.sendmail.8.gz
/usr/sbin/sendmail.postfix - priority 30
  slave mta-pam: /etc/pam.d/smtp.postfix
  slave mta-mailq: /usr/bin/mailq.postfix
  slave mta-newaliases: /usr/bin/newaliases.postfix
  slave mta-rmail: /usr/bin/rmail.postfix
  slave mta-sendmail: /usr/lib/sendmail.postfix
  slave mta-mailqman: /usr/share/man/man1/mailq.postfix.1.gz
  slave mta-newaliasesman: /usr/share/man/man1/newaliases.postfix.1.gz
  slave mta-aliasesman: /usr/share/man/man5/aliases.postfix.5.gz
  slave mta-sendmailman: /usr/share/man/man1/sendmail.postfix.1.gz
Current `best' version is /usr/sbin/sendmail.sendmail.

I believe that all you need to do is run 'alternatives --config mta'  
and choose postfix but I haven't researched this extensively.

--
Marc


--
Come build with us! The BlackBerryreg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9#45;12, 2009. Register now#33;
http://p.sf.net/sfu/devconf
___
Nagios-users mailing list
Nagios-users@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


Re: [Nagios-users] FW: Not sending e-mails

2009-10-01 Thread Scott Miller
I agree - I've found a few other oddities while messing around with Postfix.
Gotta fix those first.

 

Thanks,

Scott

 

 

From: Martin Melin [mailto:mme...@gmail.com] 
Sent: Thursday, October 01, 2009 12:58 PM
To: nagios-users@lists.sourceforge.net
Subject: Re: [Nagios-users] FW: Not sending e-mails

 

Looks like your postfix installation isn't really complete since /bin/mail
still thinks it's supposed to send using sendmail. On a complete postfix
setup you should have a command sendmail - Postfix to Sendmail
compatibility interface which I believe /bin/mail will use. So the issue
here isn't really Nagios-specific, since you're unable to send mail with
/bin/mail outside of Nagios as well. If you fix the email setup, Nagios
notifications will be delivered just fine, and Postfix setup is too off
topic for this list :-) Good luck!

On Thu, Oct 1, 2009 at 10:23 PM, Scott Miller srmil...@interbel.net wrote:

[r...@mail4 ~]# echo Hello world | /bin/mail -s Test Email
r...@localhost

[r...@mail4 ~]# /etc/mail/sendmail.cf: line 0: cannot open: No such file or
directory

[r...@mail4 ~]#

 

I'm running postfix - not sure why it's looking for sendmail.

 

 

From: Martin Melin [mailto:mme...@gmail.com] 
Sent: Thursday, October 01, 2009 11:01 AM
To: nagios-users@lists.sourceforge.net
Subject: Re: [Nagios-users] FW: Not sending e-mails

 

Try simply copying the command_line for notify-service-by-email and running
it in a shell yourself. Or just do:
# echo Hello world | /bin/mail -s Test Email r...@localhost

On Thu, Oct 1, 2009 at 8:28 PM, Scott Miller srmil...@interbel.net wrote:


Scott Miller wrote:
 I know this has been hit over and over, and I've read literally
everything I
 could find, but to no avail.  I have a newly install of Nagios 3.2.0 on a
 Fedora Core 8 with Postfix/Dovecot.  I have a modified script (postfix
mail
 queue monitor I shared a week or so ago).  The only thing Nagios is doing
on
 this box is looking at local services.  When I change any threshold so I
 will go into alarm, it does, but no e-mails get sent out.

 I can see in my logs the following when something comes into alarm:

 [1254408621] SERVICE ALERT: localhost;Postfix Mail
 Queue;CRITICAL;SOFT;1;CRITICAL: Postfix mailq has 14 messages queued for
a
 total of 12492 Kbytes.
 [1254408651] SERVICE ALERT: localhost;Current Load;OK;SOFT;2;OK - load
 average: 4.87, 2.73, 1.43
 [1254408681] SERVICE ALERT: localhost;Postfix Mail
 Queue;CRITICAL;SOFT;2;CRITICAL: Postfix mailq has 16 messages queued for
a
 total of 12497 Kbytes.
 [1254408741] SERVICE ALERT: localhost;Postfix Mail
 Queue;CRITICAL;SOFT;3;CRITICAL: Postfix mailq has 16 messages queued for
a
 total of 12689 Kbytes.
 [1254408801] SERVICE ALERT: localhost;Postfix Mail
 Queue;CRITICAL;HARD;4;CRITICAL: Postfix mailq has 15 messages queued for
a
 total of 12494 Kbytes.
 [1254408801] SERVICE NOTIFICATION: nagiosadmin2;localhost;Postfix Mail
 Queue;CRITICAL;notify-service-by-email;CRITICAL: Postfix mailq has 15
 messages queued for a total of 12494 Kbytes.
 [1254408801] SERVICE NOTIFICATION: nagiosadmin;localhost;Postfix Mail
 Queue;CRITICAL;notify-service-by-email;CRITICAL: Postfix mailq has 15
 messages queued for a total of 12494 Kbytes.

 Wondering if anyone could double check the pertinent parts of my config?

 Thanks in advance.

 Scott Miller

 What's in your mail log?  Nagios is trying to send notifications using
 the command you've defined, according to the logs. You haven't provided
 the definition for that command (notify-service-by-email), but I assume
 it's trying to send an email.

 If you're using anything like the example commands that come with
 Nagios, it is probably using something like /bin/mail to send the
 message, and your mail log would be a good place to look for why it's
 not being delivered.

Sorry - didn't include that from the commands.cfg - Here's what I have.

commands.cfg

# 'notify-host-by-email' command definition
define command{
   command_namenotify-host-by-email
   command_line/usr/bin/printf %b * Nagios
*\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState:
$HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time:
$LONGDATETIME$\n | /bin/mail -s ** $NOTIFICATIONTYPE$ Host Alert:
$HOSTNAME$ is $HOSTSTATE$ ** $CONTACTEMAIL$
   }

# 'notify-service-by-email' command definition
define command{
   command_namenotify-service-by-email
   command_line/usr/bin/printf %b * Nagios
*\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService:
$SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState:
$SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional
Info:\n\n$SERVICEOUTPUT$ | /bin/mail -s ** $NOTIFICATIONTYPE$ Service
Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ ** $CONTACTEMAIL$
   }

This is the exact same way I have it on another machine running checks for
multiple boxes and devices.  The only difference, is this server is running
Postfix, the other

Re: [Nagios-users] FW: Not sending e-mails

2009-10-01 Thread Michael Saldivar
Did you try the two notification mail commands I sent over?  Postfix uses
different syntax than what comes in the default Nagios config, and the ones
I'm using are from a functional Ubuntu/Postfix setup.  It uses Postfix's
alias to sendmail instead of the mail command, which doesn't work with
Postfix.

-Mike



On Thu, Oct 1, 2009 at 3:53 PM, Scott Miller srmil...@interbel.net wrote:

  I agree – I’ve found a few other oddities while messing around with
 Postfix.  Gotta fix those first.



 Thanks,

 Scott





--
Come build with us! The BlackBerryreg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9#45;12, 2009. Register now#33;
http://p.sf.net/sfu/devconf___
Nagios-users mailing list
Nagios-users@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

Re: [Nagios-users] FW: Not sending e-mails

2009-10-01 Thread Scott Miller
I actually go it to work using your suggestion - I double checked it, and
misspelled one word - fixed it, lowered the threshold to alarm, and
restarted - got a notification within about 5 min.

 

# NEW 'notify-host-by-email' command definition

define command{

command_namenotify-host-by-email

command_line/usr/bin/printf %b Subject:** $NOTIFICATIONTYPE$
Host Alert: $HOSTNAME$ is $HOSTSTATE$ **\n* Nagios *\n\nNotification
Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress:
$HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n |
/usr/sbin/sendmail.postfix $CONTACTEMAIL$

}

 

# NEW 'notify-service-by-email' command definition

define command{

command_namenotify-service-by-email

command_line/usr/bin/printf %b Subject:** $NOTIFICATIONTYPE$
Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **\n* Nagios
*\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService:
$SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState:
$SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional
Info:\n\n$SERVICEOUTPUT$ | /usr/sbin/sendmail.postfix $CONTACTEMAIL$

 

Awesome - thanks!

 

http://65.19.234.227:1

 

Scott Miller

 

 

From: mike.saldi...@directfinancialsolutions.com
[mailto:mike.saldi...@directfinancialsolutions.com] On Behalf Of Michael
Saldivar
Sent: Thursday, October 01, 2009 2:04 PM
To: Scott Miller
Cc: nagios-users@lists.sourceforge.net
Subject: Re: [Nagios-users] FW: Not sending e-mails

 

Did you try the two notification mail commands I sent over?  Postfix uses
different syntax than what comes in the default Nagios config, and the ones
I'm using are from a functional Ubuntu/Postfix setup.  It uses Postfix's
alias to sendmail instead of the mail command, which doesn't work with
Postfix.

-Mike




On Thu, Oct 1, 2009 at 3:53 PM, Scott Miller srmil...@interbel.net wrote:

I agree - I've found a few other oddities while messing around with Postfix.
Gotta fix those first.

 

Thanks,

Scott

 

 

 

--
Come build with us! The BlackBerryreg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9#45;12, 2009. Register now#33;
http://p.sf.net/sfu/devconf___
Nagios-users mailing list
Nagios-users@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