Page 1 of 2

How to send Mail Notification

Posted: Fri Nov 23, 2012 5:46 am
by Dragon
Hi, i'm a new on this forum ;)
I request a configuring Nagios to send a mail these problems CRITICAL and WARNING.
Example:
On the web i read the results of one or multiple commands.
One command resulted a 3 Critical, 5 warning and 10 OK.
The information of the message results and detailed problems should be sent via mail [email protected]
Thanks

Re: How to send Mail Notification

Posted: Fri Nov 23, 2012 10:44 am
by HanzKlotz
Hello,

1. Configure your contacts.cfg file in nagios /etc/objects/ directory
2. Configure your notification options in templates.cfg or host/service definition to set when nagios should send information
3. Configure your notification message in commands.cfg file
3. Install MTA (i.e Postfix) and configure it to send e-mails

that's it. :)

Re: How to send Mail Notification

Posted: Mon Nov 26, 2012 3:49 am
by Dragon
Thank HanzKlotz
I have configured three points, but not the four.
Where can I download the file MTA?
Thank's very much

Re: How to send Mail Notification

Posted: Mon Nov 26, 2012 11:06 am
by HanzKlotz
Dragon wrote: Where can I download the file MTA?
MTA is a mail transport agent. Look at http://en.wikipedia.org/wiki/Mail_transfer_agent
Try to understand before you install it.

Re: How to send Mail Notification

Posted: Wed Nov 28, 2012 5:02 am
by Dragon
I hope to run this application ;)
Thank HanzKlotz

Re: How to send Mail Notification

Posted: Thu Nov 29, 2012 2:52 pm
by agriffin
MTA is a category of programs, not the name of anything specific. Examples of specific tools you could use for this purpose include: postfix, sendmail, exim, and msmtp. Configuring these is outside the scope of this forum, but I think most server Linux distributions come with one preconfigured. So if you correctly did steps 1-3 that HanzKlotz mentioned, you should probably be getting email alerts already.

Getting so little information from you, though, makes it hard to know what to suggest to you. Since you seem new to Nagios I'd recommend finding a good book to guide you through setting it up, like Learning Nagios 3.0.

Re: How to send Mail Notification

Posted: Thu Dec 13, 2012 10:58 am
by ridder75
Hey,

I'm new on this forum and i don't try to send mail via postif from my nagios serveur, i'm post my conf :

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
html_directory = no
inet_interfaces = all
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = renault-trucks.com
mydomain = renault-trucks.com
mynetworks = 10.214.0.0/24, 127.0.0.0/8
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.8.12/README_FILES
sample_directory = /usr/share/doc/postfix-2.8.12/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop

my postfix version :

mail_version = 2.8.12
milter_macro_v = $mail_name $mail_version

I'm try to follow this tuto but -:(

http://doc.fedora-fr.org/wiki/Postfix

Can you help me please?

Thanks.

Raph -:)

Re: How to send Mail Notification

Posted: Fri Dec 14, 2012 11:28 am
by slansing
Riddler, what is the issue you are having? Can you clarify this for us?

Re: How to send Mail Notification

Posted: Fri Dec 14, 2012 5:18 pm
by eltrasimaco
Is the daemon running? did the telnet thing work?
What does /var/log/maillog say?
And /var/log/messages?

Re: How to send Mail Notification

Posted: Mon Dec 17, 2012 2:33 am
by ridder75
Hi,

My problem :

I wan't nagios send automatic alert CRITICAL / WARNING to an email adress and i tried to ionstall / configure for do this.

I don't try to do this.

Daemon status :

[root@xxxxxxxxxxxxxxx ~]# service postfix status
postfix.service - LSB: start and stop postfix
Loaded: loaded (/etc/rc.d/init.d/postfix)
Active: active (running) since Mon, 17 Dec 2012 08:21:10 +0100; 11s ago
Process: 15920 ExecStart=/etc/rc.d/init.d/postfix start (code=exited, status=0/SUCCESS)
Main PID: 15997 (master)
CGroup: name=systemd:/system/postfix.service
â 15997 /usr/libexec/postfix/master
â 16003 pickup -l -t fifo -u
â 16004 qmgr -l -t fifo -u

Telnet :

[root@xxxxxxxxxxxxxxx ~]# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 xxxxxxxxxxxxxxx.renault-trucks.com ESMTP Postfix
quit
221 2.0.0 Bye
Connection closed by foreign host.


[root@xxxxxxxxxxxxxxx ~]# vi /var/log/maillog
Dec 17 03:53:30 localhost sendmail[22241]: qBH2rUtj022241: from=root, size=327, class=0, nrcpts=1, msgid=<[email protected]>, relay=root@localhost
Dec 17 03:53:31 localhost sendmail[22242]: qBH2rUdT022242: from=<[email protected]>, size=615, class=0, nrcpts=1, msgid=<[email protected]>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Dec 17 03:53:31 localhost sendmail[22241]: qBH2rUtj022241: to=root, ctladdr=root (0/0), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30327, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (qBH2rUdT022242 Message accepted for delivery)
Dec 17 03:53:31 localhost sendmail[22243]: qBH2rUdT022242: to=<[email protected]>, ctladdr=<[email protected]> (0/0), delay=00:00:01, xdelay=00:00:00, mailer=local, pri=30851, dsn=2.0.0, stat=Sent
Dec 17 08:21:09 localhost sendmail[15924]: alias database /etc/aliases rebuilt by root
Dec 17 08:21:09 localhost sendmail[15924]: /etc/aliases: 76 aliases, longest 10 bytes, 771 bytes total
Dec 17 08:21:10 localhost postfix/postfix-script[15996]: starting the Postfix mail system
Dec 17 08:21:10 localhost postfix/master[15997]: daemon started -- version 2.8.12, configuration /etc/postfix
Dec 17 08:22:29 localhost postfix/smtpd[16414]: connect from localhost.localdomain[127.0.0.1]
Dec 17 08:23:48 localhost postfix/smtpd[16414]: disconnect from localhost.localdomain[127.0.0.1]

[root@xxxxxxxxxxxxxxx ~]# vi /var/log/messages
Dec 17 08:03:51 localhost kernel: [314561.323970] type=1400 audit(1355727831.090:91): avc: denied { create } for pid=22221 comm="httpd" name="wrtYpWVbU" scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:usr_t:s0 tclass=file
Dec 17 08:03:51 localhost kernel: [314561.331399] type=1400 audit(1355727831.097:92): avc: denied { write } for pid=22221 comm="httpd" path="/usr/local/centreon/GPL_LIB/SmartyCache/compile/wrtYpWVbU" dev="dm-1" ino=1185100 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:usr_t:s0 tclass=file
Dec 17 08:03:51 localhost kernel: [314561.339216] type=1400 audit(1355727831.105:93): avc: denied { rename } for pid=22221 comm="httpd" name="wrtYpWVbU" dev="dm-1" ino=1185100 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:usr_t:s0 tclass=file
Dec 17 08:03:51 localhost kernel: [314561.339228] type=1400 audit(1355727831.105:94): avc: denied { unlink } for pid=22221 comm="httpd" name="%%8A^8AC^8AC56E7C%%BlockHeader.ihtml.php" dev="dm-1" ino=1177384 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:usr_t:s0 tclass=file
Dec 17 08:03:51 localhost kernel: [314561.339420] type=1400 audit(1355727831.105:95): avc: denied { setattr } for pid=22221 comm="httpd" name="%%8A^8AC^8AC56E7C%%BlockHeader.ihtml.php" dev="dm-1" ino=1185100 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:usr_t:s0 tclass=file
Dec 17 08:05:10 localhost systemd-logind[783]: New session 12722 of user raphael.
Dec 17 08:05:16 localhost dbus[817]: [system] Activating service name='net.reactivated.Fprint' (using servicehelper)
Dec 17 08:05:16 localhost dbus-daemon[817]: dbus[817]: [system] Activating service name='net.reactivated.Fprint' (using servicehelper)

Thanks for your help.

Raph :-)