Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
kwhogster
Posts: 644 Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:
Post
by kwhogster » Mon Mar 26, 2018 7:01 pm
Nagios 4.3.4
After upgrading to 4.3.4 from 4.1 I am not getting email alerts sent.
My contacts
Code: Select all
define contact{
contact_name nagiosadmin ; Short name of user
alias Nagios Admin ; Full name of user
service_notification_period 24x7
host_notification_period 24x7
service_notification_options c,r
host_notification_options d,r
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
email admin01@tgcsnet.com ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}
define contact{
contact_name support
alias Network Support
service_notification_period 24x7
host_notification_period 24x7
service_notification_options c,r
host_notification_options d,r
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
email systems-alert@tgcsnet.com
}
define contact{
contact_name text305
alias Network Support
service_notification_period 24x7
host_notification_period 24x7
service_notification_options c,r
host_notification_options d,r
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
email 1234561111@vtext.com
}
define contact{
contact_name text551
alias Network Support
service_notification_period 24x7
host_notification_period 24x7
service_notification_options c,r
host_notification_options d,r
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
email 1234561122@vtext.com
}
My groups
Code: Select all
define contactgroup{
contactgroup_name admins
alias Nagios Administrators
members nagiosadmin, support, iosapp
}
define contactgroup{
contactgroup_name textit
alias Nagios Admins
members text305, text551
}
My escalations
Code: Select all
define serviceescalation{
hostgroup_name windows-servers,windows-servers-vm,linux-servers
service_description *
first_notification 24
last_notification 48
notification_interval 360
contact_groups admins,textit
}
define serviceescalation{
hostgroup_name Windows-Desktops,windows-desktops-vm
service_description *
first_notification 24
last_notification 48
notification_interval 360
contact_groups admins,textit
}
define hostescalation{
hostgroup_name windows-servers,windows-servers-vm,linux-servers
first_notification 5
last_notification 8
notification_interval 60
contact_groups admins,textit
}
define hostescalation{
hostgroup_name Windows-Desktops,windows-desktops-vm
first_notification 5
last_notification 8
notification_interval 60
contact_groups admins,textit
}
define hostescalation{
hostgroup_name nas-storage,network-printers,switches
first_notification 5
last_notification 8
notification_interval 60
contact_groups admins,textit
}
Any ideas?
Thanks in advance
Tom
scottwilkerson
DevOps Engineer
Posts: 19396 Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:
Post
by scottwilkerson » Tue Mar 27, 2018 9:00 am
This upgrade shouldn't have any impact on notification sending. Do you seen the messages in your maillog? Do the notifications show up in the Notifications report?
kwhogster
Posts: 644 Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:
Post
by kwhogster » Tue Mar 27, 2018 9:01 pm
Yes I saw 394 emails stuck in the queue
I deleted the all mailx then D* cleared the queue.
then I tried this echo "test text" | mailx -s testtext
1234561111@vtext.com
got this 550 5.7.1 Unable to relay (in reply to RCPT TO command)
Then I tried to send an email to my internal email client and it worked fine.
I have on site an Exchange Server
From my Outlook client on my pc I can send email to my vtext.com no problem
Just not from the Ubuntu server running Nagios.
Thanks
lumirl
Posts: 3 Joined: Tue Mar 27, 2018 3:32 pm
Post
by lumirl » Wed Mar 28, 2018 1:38 am
That is definitelly problem of your mailserver - local mail server where nagios is.
What mailserver did you install?
Steps to do:
1. Remove mailserver if you have one - apt-get force purge sendmail
2. reinstall it apt-get install sendmail
3. define correct hostname in /etc/hostname
scottwilkerson
DevOps Engineer
Posts: 19396 Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:
Post
by scottwilkerson » Wed Mar 28, 2018 8:20 am
lumirl wrote: That is definitelly problem of your mailserver - local mail server where nagios is.
What mailserver did you install?
Steps to do:
1. Remove mailserver if you have one - apt-get force purge sendmail
2. reinstall it apt-get install sendmail
3. define correct hostname in /etc/hostname
I tend to agree with all of this. Additionally make sure the From address is real, you message may be rejected by vtext.com if the email address it is being sent from is not valid or root@localhost type address
kwhogster
Posts: 644 Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:
Post
by kwhogster » Wed Mar 28, 2018 7:59 pm
# ADMINISTRATOR EMAIL/PAGER ADDRESSES
# The email and pager address of a global administrator (likely you).
# Nagios never uses these values itself, but you can access them by
# using the $ADMINEMAIL$ and $ADMINPAGER$ macros in your notification
# commands.
admin_email=nagios@localhost
admin_pager=pagenagios@localhost
from my Nagios.cfg file should I make admin_email a valid email address from my exchange server?
Is this the send email address
Where is
Nagios@nagios.notify located ?
scottwilkerson
DevOps Engineer
Posts: 19396 Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:
Post
by scottwilkerson » Thu Mar 29, 2018 9:05 am
You likely have that somewhere in the config or in the configuration of the mail program on the server.
Every setup is like a snowflake, unique to the individual that configured it.
In Nagios XI, this is all done through the UI,k but in Core it is up the the admin how to configure it. Who configured this system? Can you ask them?
kwhogster
Posts: 644 Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:
Post
by kwhogster » Thu Mar 29, 2018 8:37 pm
Scott
I setup this server and everything although I am a windows guy and a Linux hack LOL
At my work place we run Nagios also and I talked to the guy who works on it and he said they had email issues also and he had to modify the Notification commands he had to leave for vacation and did not have time to show me what he had setup
He said he added a /r or something that allowed him to put the sender email address there.
Here is my code
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/mailx -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/mailx -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
Thanks
scottwilkerson
DevOps Engineer
Posts: 19396 Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:
Post
by scottwilkerson » Fri Mar 30, 2018 8:57 am
yes you should be able to add the -r, like
[user][/user]
full commands would be
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/mailx -r me@example.com -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/mailx -r me@example.com -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
Obviously replacing
me@example.com
me@work55
Posts: 44 Joined: Sun Jan 22, 2017 6:15 pm
Post
by me@work55 » Fri Mar 30, 2018 5:09 pm
Scott
Thanks will test over the weekend.
I had to make some modifications on my exchange server.
The exchange server would only relay smtp internally that is how it is setup. I set up the transport to allow the ip address of my Nagios server
I also modified the anonymous relay settings on my receive connector to add exchange servers in the permissions group and on the authentication panel allow externally secured (for example with IPsec)
Once I did that I was able to send email from my Nagios server externally
I set up a new mailbox
nagios-alerts@mydom.com will test that letter also
Thank for the -r info.
Tom