Page 1 of 1

Getting Email Alerts working

Posted: Wed Oct 02, 2019 2:31 pm
by Alan
I have been trying to get Nagios to send out an email when a server is off or down. I thought I had all the .cfg files configured correctly. I am using PostFix and I am able to send a test email from the terminal and it works I get the email. This is what I use to test with:

Code: Select all

[root@mpnagios objects]# mail [email protected]
Subject: This is a test from Nagios
This is testing the Nagios server can send 
Emails. Thanks
.
EOT
But when I turn off a server for testing I never get the emial from Nagios. This is how my config files are setup:

1. /usr/local/nagios/etc/objects/contacts.cfg

Code: Select all

define contact {
		contact_name                            Alan
		use                                     generic-contact
		alias                                   Alan
		email                                   myemailhere
		service_notification_period             24x7
		service_notification_options            w,u,c,r,f,s
		service_notification_commands           notify-service-by-email
		host_notification_period                24x7
		host_notification_options               d,u,r,f,s
		host_notification_commands              notify-host-by-email
}
I also added this entry in the contacts.cfg file;

Code: Select all

define contact{
        contact_name                    nagiosadmin             ; Short name of user
        use                             generic-contact         ; Inherit default values from generic-contact template (defined above)
        alias                           Nagios Admin            ; Full name of user

        email                           myemailhere       ; Add email here
        }
2. /usr/local/nagios/etc/objects/templates.cfg

Code: Select all

define host{
        name                    svr-ome         ; The name of this host template
        use                     generic-host    ; Inherit default values from the generic-host template
        check_period            24x7            ; By default, Windows servers are monitored round the clock
        check_interval          5               ; Actively check the server every 5 minutes
        retry_interval          1               ; Schedule host check retries at 1 minute intervals
        max_check_attempts      10              ; Check each server 10 times (max)
        check_command           check-host-alive        ; Default command to check if servers are "alive"
        notification_period     24x7            ; Send notification out at any time - day or night
        notification_interval   30              ; Resend notifications every 30 minutes
        notification_options    d,r             ; Only send notifications for specific host states
        contact_groups          admins          ; Notifications get sent to the admins by default
        hostgroups              windows-servers ; Host groups that Windows servers should be a member of
        register                0               ; DONT REGISTER THIS - ITS JUST A TEMPLATE
        }
3. /usr/local/nagios/etc/objects/commands.cfg. In this commands file I tired setting this both ways like /bin/mail/postfix and /bin/mail -s which was the default.

Code: Select all

'notify-host-by-email' command definition
define command{
        command_name    notify-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/postfix "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
        }
There was a # mark in the front of 'notify-host-by-email' command definition I have added it and removed it. I also just tried to adding this to the windows.cfg file
4. /usr/local/nagios/etc/objects/windows.cfg

Code: Select all

define host{
        use             windows-server  ; Inherit default values from a template
        host_name       svr-ome         ; The name we're giving to this host
        alias           My Windows Server       ; A longer name associated with the host
        address         172.17.20.8     ; IP address of the host
        }
Is there another file I need to configure? Also in the commands.cfg I changed /bin/mail/postfix then i changed it back to /bin/mail -s. This is the output of the nagios.log:

Code: Select all

SERVICE ALERT: Svr-ome;Disk Usage;UNKNOWN;HARD;5;UNKNOWN: Error occurred while running the plugin. Use the verbose flag for more details.
[1570042422] SERVICE NOTIFICATION: nagiosadmin;Svr-ome;Disk Usage;UNKNOWN;notify-service-by-email;UNKNOWN: Error occurred while running the plugin. Use the verbose flag for more details.
[1570042425] HOST ALERT: Svr-ome;DOWN;SOFT;1;UNKNOWN: Error occurred while running the plugin. Use the verbose flag for more details.
[1570042472] SERVICE ALERT: Svr-ome;CPU Usage;UNKNOWN;HARD;5;UNKNOWN: Error occurred while running the plugin. Use the verbose flag for more details.
[1570042475] HOST ALERT: Svr-ome;DOWN;SOFT;2;UNKNOWN: Error occurred while running the plugin. Use the verbose flag for more details.
[1570042487] SERVICE ALERT: Svr-ome;Process Count;UNKNOWN;HARD;5;UNKNOWN: Error occurred while running the plugin. Use the verbose flag for more details.
[1570042490] HOST ALERT: Svr-ome;DOWN;SOFT;3;UNKNOWN: Error occurred while running the plugin. Use the verbose flag for more details.
[1570042553] HOST ALERT: Svr-ome;DOWN;SOFT;4;UNKNOWN: Error occurred while running the plugin. Use the verbose flag for more details.
[1570042593] SERVICE ALERT: Svr-ome;Memory Usage;UNKNOWN;SOFT;1;UNKNOWN: Error occurred while running the plugin. Use the verbose flag for more details.
[1570042596] HOST ALERT: Svr-ome;DOWN;HARD;5;UNKNOWN: Error occurred while running the plugin. Use the verbose flag for more details.
[1570042596] HOST NOTIFICATION: nagiosadmin;Svr-ome;DOWN;notify-host-by-email;UNKNOWN: Error occurred while running the plugin. Use the verbose flag for more details.
[1570042596] wproc: NOTIFY job 313 from worker Core Worker 11435 is a non-check helper but exited with return code 126
[1570042596] wproc:   host=Svr-ome; service=(none); contact=nagiosadmin
[1570042596] wproc:   early_timeout=0; exited_ok=1; wait_status=32256; error_code=0;
[1570042596] wproc:   stderr line 01: /bin/sh: /bin/mail/postfix: Not a directory
[1570042596] wproc:   stderr line 02: /usr/bin/printf: write error: Broken pipe
Any help to get this to work will be greatly appreciated, and also any guidance on configuration on getting an email sent out on specific things like disk space to high for a server or CPU too high for too long thinks like that.

Re: Getting Email Alerts working

Posted: Thu Oct 03, 2019 9:39 am
by scottwilkerson

Code: Select all

[1570042596] wproc:   stderr line 01: /bin/sh: /bin/mail/postfix: Not a directory
[1570042596] wproc:   stderr line 02: /usr/bin/printf: write error: Broken pipe
This is showing your command isn't working with /bin/mail/postfix in there

Can you show the output of

Code: Select all

which mail
and replace /bin/mail/postfix with that in both of the notification commands

Then perform your test again and show the nagios log if you do not get the message, along with the output of

Code: Select all

tail -50 /var/log/maillog

Re: Getting Email Alerts working

Posted: Thu Oct 03, 2019 2:09 pm
by Alan
Thanks for getting back to me. So I did the command "which mail" and got back = /usr/bin/mail So I changed both entires in the commands.cfg file to this. I am not really doing the service yet so I left the # mark. Do I need to take that # away for it to work?:

Code: Select all

'notify-host-by-email' command definition
define command{
        command_name    notify-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" | /usr/bin/mail "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
        }

# 'notify-service-by-email' command definition
define command{
        command_name    notify-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$\n" | /usr/bin/mail "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
        }
Here is the output from the tail -50 /var/log/maillog

Code: Select all

Oct  3 10:01:08 Svr-Monitor postfix/pickup[8649]: 9C79F2029208: uid=1001 from=<nagios>
Oct  3 10:01:08 Svr-Monitor postfix/cleanup[9525]: 9C79F2029208: message-id=<[email protected]>
Oct  3 10:01:08 Svr-Monitor postfix/qmgr[11908]: 9C79F2029208: from=<nagios@[email protected]>, size=731, nrcpt=1 (queue active)
Oct  3 10:01:08 Svr-Monitor postfix/smtp[9527]: 9C79F2029208: to=<[email protected]>, orig_to=<nagiosadmin@something>, relay=mail.mydomain.com[172.16.10.83]:25, delay=33, delays=33/0.01/0/0.07, dsn=2.6.0, status=sent (250 2.6.0  <[email protected]> Queued mail for delivery)
Oct  3 10:01:08 Svr-Monitor postfix/qmgr[11908]: 9C79F2029208: removed
Oct  3 10:11:09 Svr-Monitor postfix/pickup[8649]: 368E32029208: uid=1001 from=<nagios>
Oct  3 10:11:09 Svr-Monitor postfix/cleanup[9636]: 368E32029208: message-id=<[email protected]>
Oct  3 10:11:09 Svr-Monitor postfix/qmgr[11908]: 368E32029208: from=<nagios@[email protected]>, size=718, nrcpt=1 (queue active)
Oct  3 10:11:09 Svr-Monitor postfix/smtp[9638]: 368E32029208: to=<[email protected]>, orig_to=<nagiosadmin@something>, relay=mail.mydomain.com[172.16.10.83]:25, delay=34, delays=34/0.01/0/0.06, dsn=2.6.0, status=sent (250 2.6.0  <[email protected]> Queued mail for delivery)
Oct  3 10:11:09 Svr-Monitor postfix/qmgr[11908]: 368E32029208: removed
Oct  3 10:35:10 Svr-Monitor postfix/pickup[8649]: 637972029208: uid=1001 from=<nagios>
Oct  3 10:35:10 Svr-Monitor postfix/cleanup[10159]: 637972029208: message-id=<[email protected]>
Oct  3 10:35:10 Svr-Monitor postfix/qmgr[11908]: 637972029208: from=<nagios@[email protected]>, size=731, nrcpt=1 (queue active)
Oct  3 10:35:10 Svr-Monitor postfix/smtp[10161]: 637972029208: to=<[email protected]>, orig_to=<nagiosadmin@something>, relay=mail.mydomain.com[172.16.10.83]:25, delay=36, delays=35/0.01/0/0.07, dsn=2.6.0, status=sent (250 2.6.0  <[email protected]> Queued mail for delivery)
Oct  3 10:35:10 Svr-Monitor postfix/qmgr[11908]: 637972029208: removed
Oct  3 10:44:11 Svr-Monitor postfix/pickup[10203]: 006A92029208: uid=1001 from=<nagios>
Oct  3 10:44:11 Svr-Monitor postfix/cleanup[10298]: 006A92029208: message-id=<[email protected]>
Oct  3 10:44:11 Svr-Monitor postfix/qmgr[11908]: 006A92029208: from=<nagios@[email protected]>, size=807, nrcpt=1 (queue active)
Oct  3 10:44:11 Svr-Monitor postfix/smtp[10300]: 006A92029208: to=<[email protected]>, orig_to=<nagiosadmin@something>, relay=mail.mydomain.com[172.16.10.83]:25, delay=46, delays=46/0.01/0/0.05, dsn=2.6.0, status=sent (250 2.6.0  <[email protected]> Queued mail for delivery)
Oct  3 10:44:11 Svr-Monitor postfix/qmgr[11908]: 006A92029208: removed
Oct  3 10:45:10 Svr-Monitor postfix/pickup[10203]: 255092029204: uid=1001 from=<nagios>
Oct  3 10:45:10 Svr-Monitor postfix/cleanup[10298]: 255092029204: message-id=<[email protected]>
Oct  3 10:45:10 Svr-Monitor postfix/qmgr[11908]: 255092029204: from=<nagios@[email protected]>, size=748, nrcpt=1 (queue active)
Oct  3 10:45:10 Svr-Monitor postfix/smtp[10300]: 255092029204: to=<[email protected]>, orig_to=<nagiosadmin@something>, relay=mail.mydomain.com[172.16.10.83]:25, delay=35, delays=35/0/0/0.07, dsn=2.6.0, status=sent (250 2.6.0  <[email protected]> Queued mail for delivery)
Oct  3 10:45:10 Svr-Monitor postfix/qmgr[11908]: 255092029204: removed
Oct  3 10:49:10 Svr-Monitor postfix/pickup[10203]: 7A9582029208: uid=1001 from=<nagios>
Oct  3 10:49:10 Svr-Monitor postfix/cleanup[10388]: 7A9582029208: message-id=<[email protected]>
Oct  3 10:49:10 Svr-Monitor postfix/qmgr[11908]: 7A9582029208: from=<nagios@[email protected]>, size=815, nrcpt=1 (queue active)
Oct  3 10:49:10 Svr-Monitor postfix/smtp[10390]: 7A9582029208: to=<[email protected]>, orig_to=<nagiosadmin@something>, relay=mail.mydomain.com[172.16.10.83]:25, delay=47, delays=47/0.01/0/0.08, dsn=2.6.0, status=sent (250 2.6.0  <[email protected]> Queued mail for delivery)
Oct  3 10:49:10 Svr-Monitor postfix/qmgr[11908]: 7A9582029208: removed
Oct  3 11:04:11 Svr-Monitor postfix/pickup[10203]: 831BE2029208: uid=1001 from=<nagios>
Oct  3 11:04:11 Svr-Monitor postfix/cleanup[10651]: 831BE2029208: message-id=<[email protected]>
Oct  3 11:04:11 Svr-Monitor postfix/qmgr[11908]: 831BE2029208: from=<nagios@[email protected]>, size=760, nrcpt=1 (queue active)
Oct  3 11:04:11 Svr-Monitor postfix/pickup[10203]: 8814922565A9: uid=1001 from=<nagios>
Oct  3 11:04:11 Svr-Monitor postfix/cleanup[10651]: 8814922565A9: message-id=<[email protected]>
Oct  3 11:04:11 Svr-Monitor postfix/qmgr[11908]: 8814922565A9: from=<nagios@[email protected]>, size=758, nrcpt=1 (queue active)
Oct  3 11:04:11 Svr-Monitor postfix/pickup[10203]: 8C80022565AB: uid=1001 from=<nagios>
Oct  3 11:04:11 Svr-Monitor postfix/cleanup[10651]: 8C80022565AB: message-id=<[email protected]>
Oct  3 11:04:11 Svr-Monitor postfix/qmgr[11908]: 8C80022565AB: from=<nagios@[email protected]>, size=766, nrcpt=1 (queue active)
Oct  3 11:04:11 Svr-Monitor postfix/smtp[10653]: 831BE2029208: to=<[email protected]>, orig_to=<nagiosadmin@something>, relay=mail.mydomain.com[172.16.10.83]:25, delay=53, delays=53/0.01/0/0.08, dsn=2.6.0, status=sent (250 2.6.0  <[email protected]> Queued mail for delivery)
Oct  3 11:04:11 Svr-Monitor postfix/qmgr[11908]: 831BE2029208: removed
Oct  3 11:04:11 Svr-Monitor postfix/smtp[10654]: 8814922565A9: to=<[email protected]>, orig_to=<nagiosadmin@something>, relay=mail.mydomain.com[172.16.10.83]:25, delay=46, delays=46/0.01/0/0.11, dsn=2.6.0, status=sent (250 2.6.0  <[email protected]> Queued mail for delivery)
Oct  3 11:04:11 Svr-Monitor postfix/qmgr[11908]: 8814922565A9: removed
Oct  3 11:04:11 Svr-Monitor postfix/smtp[10655]: 8C80022565AB: to=<[email protected]>, orig_to=<nagiosadmin@something>, relay=mail.mydomain.com[172.16.10.83]:25, delay=27, delays=27/0.01/0/0.1, dsn=2.6.0, status=sent (250 2.6.0  <[email protected]> Queued mail for delivery)
Oct  3 11:04:11 Svr-Monitor postfix/qmgr[11908]: 8C80022565AB: removed
Oct  3 11:41:57 Svr-Monitor postfix/pickup[10203]: E82A92029205: uid=1000 from=<alan>
Oct  3 11:41:57 Svr-Monitor postfix/cleanup[11203]: E82A92029205: message-id=<[email protected]>
Oct  3 11:41:57 Svr-Monitor postfix/qmgr[11908]: E82A92029205: from=<alan@[email protected]>, size=468, nrcpt=1 (queue active)
Oct  3 11:41:58 Svr-Monitor postfix/smtp[11205]: E82A92029205: to=<[email protected]>, relay=mail.mydomain.com[172.16.10.83]:25, delay=0.11, delays=0.04/0.01/0/0.05, dsn=2.6.0, status=sent (250 2.6.0  <[email protected]> Queued mail for delivery)
Oct  3 11:41:58 Svr-Monitor postfix/qmgr[11908]: E82A92029205: removed
I am kind of assuming this "to" field is the problem = "to=<[email protected]>, orig_to=<nagiosadmin@something>" I cannot find where to change this. When i just test sending an emial from the terminal I get this in the log and it works:

Code: Select all

Oct  3 11:04:11 Svr-Monitor postfix/qmgr[11908]: 8C80022565AB: removed
Oct  3 11:41:57 Svr-Monitor postfix/pickup[10203]: E82A92029205: uid=1000 from=<alan>
Oct  3 11:41:57 Svr-Monitor postfix/cleanup[11203]: E82A92029205: message-id=<[email protected]>
Oct  3 11:41:57 Svr-Monitor postfix/qmgr[11908]: E82A92029205: from=<alan@[email protected]>, size=468, nrcpt=1 (queue active)
Oct  3 11:41:58 Svr-Monitor postfix/smtp[11205]: E82A92029205: to=<[email protected]>, relay=mail.mydomain.com[172.16.10.83]:25, delay=0.11, delays=0.04/0.01/0/0.05, dsn=2.6.0, status=sent (250 2.6.0  <[email protected]> Queued mail for delivery)
Oct  3 11:41:58 Svr-Monitor postfix/qmgr[11908]: E82A92029205: removed
Please let me know if you need anymore info.

Re: Getting Email Alerts working

Posted: Thu Oct 03, 2019 2:45 pm
by scottwilkerson
Change the commands to this (missing the -s):

Code: Select all

'notify-host-by-email' command definition
define command{
        command_name    notify-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" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
        }

# 'notify-service-by-email' command definition
define command{
        command_name    notify-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$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$

Re: Getting Email Alerts working

Posted: Thu Oct 03, 2019 4:36 pm
by Alan
So I added the -s in the commands.cfg file. So it now looks like this:

Code: Select all

################################################################################
#
# SAMPLE NOTIFICATION COMMANDS
#
# These are some example notification commands.  They may or may not work on
# your system without modification.  As an example, some systems will require 
# you to use "/usr/bin/mailx" instead of "/usr/bin/mail" in the commands below.
#
################################################################################


'notify-host-by-email' command definition
define command{
        command_name    notify-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" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
        }

# 'notify-service-by-email' command definition
define command{
        command_name    notify-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$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
        }

define command {
    command_name    check_ncpa
    command_line    $USER1$/check_ncpa.py -H $HOSTADDRESS$ $ARG1$
}
This is what I added to the templates.cfg file. Is this correct. This is all that I added to this file?

Code: Select all

# Windows host definition template - This is NOT a real host, just a template!

define host{
        name                    svr-ome         ; The name of this host template
        use                     generic-host    ; Inherit default values from the generic-host template
        check_period            24x7            ; By default, Windows servers are monitored round the clock
        check_interval          5               ; Actively check the server every 5 minutes
        retry_interval          1               ; Schedule host check retries at 1 minute intervals
        max_check_attempts      10              ; Check each server 10 times (max)
        check_command           check-host-alive        ; Default command to check if servers are "alive"
        notification_period     24x7            ; Send notification out at any time - day or night
        notification_interval   30              ; Resend notifications every 30 minutes
        notification_options    d,r             ; Only send notifications for specific host states
        contact_groups          admins          ; Notifications get sent to the admins by default
        hostgroups              windows-servers ; Host groups that Windows servers should be a member of
        register                0               ; DONT REGISTER THIS - ITS JUST A TEMPLATE
        }
I see there is a section for contact template. Do I need to add anything in this?

Code: Select all

###############################################################################
###############################################################################
#
# CONTACT TEMPLATES
#
###############################################################################
###############################################################################

# Generic contact definition template - This is NOT a real contact, just a template!

define contact{
        name                            generic-contact         ; The name of this contact template
        service_notification_period     24x7                    ; service notifications can be sent anytime
        host_notification_period        24x7                    ; host notifications can be sent anytime
        service_notification_options    w,u,c,r,f,s             ; send notifications for all service states, flapping events, and scheduled downtime events
        host_notification_options       d,u,r,f,s               ; send notifications for all host states, flapping events, and scheduled downtime events
        service_notification_commands   notify-service-by-email ; send service notifications via email
        host_notification_commands      notify-host-by-email    ; send host notifications via email
        register                        0                       ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL CONTACT, JUST A TEMPLATE!
        }
Here is the log out put after adding -s:

Code: Select all

2.6.0  <[email protected]> Queued mail for delivery)
Oct  3 11:49:13 Svr-Monitor postfix/qmgr[11908]: 67D3B2029205: removed
Oct  3 12:49:16 Svr-Monitor postfix/pickup[11652]: 9046B2029205: uid=1001 from=<nagios>
Oct  3 12:49:16 Svr-Monitor postfix/cleanup[11972]: 9046B2029205: message-id=<[email protected]>
Oct  3 12:49:16 Svr-Monitor postfix/qmgr[11908]: 9046B2029205: from=<nagios@[email protected]>, size=815, nrcpt=1 (queue active)
Oct  3 12:49:16 Svr-Monitor postfix/smtp[11974]: 9046B2029205: to=<[email protected]>, orig_to=<nagiosadmin@something>, relay=mail.mydomain.com[172.16.10.83]:25, delay=53, delays=53/0.01/0/0.05, dsn=2.6.0, status=sent (250 2.6.0  <[email protected]> Queued mail for delivery)
Oct  3 12:49:16 Svr-Monitor postfix/qmgr[11908]: 9046B2029205: removed
Oct  3 13:13:17 Svr-Monitor postfix/pickup[11652]: DD8252029208: uid=1001 from=<nagios>
Oct  3 13:13:17 Svr-Monitor postfix/cleanup[12257]: DD8252029208: message-id=<[email protected]>
Oct  3 13:13:17 Svr-Monitor postfix/qmgr[11908]: DD8252029208: from=<nagios@[email protected]>, size=802, nrcpt=1 (queue active)
Oct  3 13:13:17 Svr-Monitor postfix/smtp[12259]: DD8252029208: to=<[email protected]>, orig_to=<nagiosadmin@something>, relay=mail.mydomain.com[172.16.10.83]:25, delay=56, delays=56/0.01/0/0.05, dsn=2.6.0, status=sent (250 2.6.0  <[email protected]> Queued mail for delivery)
Oct  3 13:13:17 Svr-Monitor postfix/qmgr[11908]: DD8252029208: removed
Oct  3 13:13:17 Svr-Monitor postfix/qmgr[11908]: DD8252029208: removed
Oct  3 13:42:18 Svr-Monitor postfix/pickup[11652]: 787012029204: uid=1001 from=<nagios>
Oct  3 13:42:18 Svr-Monitor postfix/cleanup[12756]: 787012029204: message-id=<[email protected]>
Oct  3 13:42:18 Svr-Monitor postfix/qmgr[11908]: 787012029204: from=<nagios@[email protected]>, size=804, nrcpt=1 (queue active)
Oct  3 13:42:18 Svr-Monitor postfix/smtp[12758]: 787012029204: to=<[email protected]>, orig_to=<nagiosadmin@something>, relay=mail.mydomain.com[172.16.10.83]:25, delay=56, delays=56/0.01/0/0.05, dsn=2.6.0, status=sent (250 2.6.0  <[email protected]> Queued mail for delivery)
Oct  3 13:42:18 Svr-Monitor postfix/qmgr[11908]: 787012029204: removed
2.6.0  <[email protected]> Queued mail for delivery)
Oct  3 13:42:18 Svr-Monitor postfix/qmgr[11908]: 787012029204: removed
Oct  3 13:54:19 Svr-Monitor postfix/pickup[11652]: 3ABBC2029204: uid=1001 from=<nagios>
Oct  3 13:54:19 Svr-Monitor postfix/cleanup[12956]: 3ABBC2029204: message-id=<[email protected]>
Oct  3 13:54:19 Svr-Monitor postfix/qmgr[11908]: 3ABBC2029204: from=<nagios@[email protected]>, size=815, nrcpt=1 (queue active)
Oct  3 13:54:19 Svr-Monitor postfix/smtp[12958]: 3ABBC2029204: to=<[email protected]>, orig_to=<nagiosadmin@something>, relay=mail.mydomain.com[172.16.10.83]:25, delay=56, delays=56/0.01/0/0.05, dsn=2.6.0, status=sent (250 2.6.0  <[email protected]> Queued mail for delivery)
Oct  3 13:54:19 Svr-Monitor postfix/qmgr[11908]: 3ABBC2029204: removed
Oct  3 14:03:19 Svr-Monitor postfix/pickup[12989]: D5CFA2029208: uid=1001 from=<nagios>
Oct  3 14:03:19 Svr-Monitor postfix/cleanup[13091]: D5CFA2029208: message-id=<[email protected]>
Oct  3 14:03:19 Svr-Monitor postfix/qmgr[11908]: D5CFA2029208: from=<nagios@[email protected]>, size=726, nrcpt=1 (queue active)
Oct  3 14:03:19 Svr-Monitor postfix/smtp[13093]: D5CFA2029208: to=<[email protected]>, orig_to=<nagiosadmin@something>, relay=mail.mydomain.com[172.16.10.83]:25, delay=48, delays=48/0.01/0/0.05, dsn=2.6.0, status=sent (250 2.6.0  <[email protected]> Queued mail for delivery)
Oct  3 14:03:19 Svr-Monitor postfix/qmgr[11908]: D5CFA2029208: removed

Re: Getting Email Alerts working

Posted: Thu Oct 03, 2019 4:45 pm
by scottwilkerson
Generally this looks good, it looks like you are relaying mail through mail.mydomain.com[172.16.10.83]:25

From here if you are not getting messages it is either your postfix configuration or mail is dropping at 172.16.10.83

Re: Getting Email Alerts working

Posted: Thu Oct 03, 2019 5:15 pm
by Alan
One thing I was not doing was re-starting the Nagios service. So I tired to do that and I am having issues getting it started. These are the ways that I have tried to stop, start, and restart it:

Code: Select all

- Starting it   - /etc/rc.d/init.d/nagios start
- Stopping it   - /etc/rc.d/init.d/nagios stop
- Restarting it - /etc/rc.d/init.d/nagios reload
- Restarting it - service nagios restart

Re: Getting Email Alerts working

Posted: Fri Oct 04, 2019 6:24 am
by scottwilkerson
That is definitely required when making changes

What OS is this? Did you verify the nagios.cfg before trying to restart the service?

Re: Getting Email Alerts working

Posted: Fri Oct 04, 2019 10:54 am
by Alan
Morning Scott So there was in issue in the contacts.cfg and the commands.cfg file. When I got those fixed I started the Nagios service and it is now working. I am getting emails for CPU, Memory Usage, and a server being down. Thanks for all your help on this.

Re: Getting Email Alerts working

Posted: Fri Oct 04, 2019 10:58 am
by scottwilkerson
Alan wrote:Morning Scott So there was in issue in the contacts.cfg and the commands.cfg file. When I got those fixed I started the Nagios service and it is now working. I am getting emails for CPU, Memory Usage, and a server being down. Thanks for all your help on this.
Great!

Locking thread