Can someone guide me through the simple installations of a postfix as a null client so nagios can send me a notification if something is changing ... i have install Ubuntu server 12.04 LTS and nagios work great on it ... On the Ubuntu Server there is nothing more just a nagios and updates ...
Postfix
Postfix
Hi again
Can someone guide me through the simple installations of a postfix as a null client so nagios can send me a notification if something is changing ... i have install Ubuntu server 12.04 LTS and nagios work great on it ... On the Ubuntu Server there is nothing more just a nagios and updates ...
Can someone guide me through the simple installations of a postfix as a null client so nagios can send me a notification if something is changing ... i have install Ubuntu server 12.04 LTS and nagios work great on it ... On the Ubuntu Server there is nothing more just a nagios and updates ...
Re: Postfix
Hi MPIvan,
Below are the steps I used to install Postfix on Ubuntu 12.04:
Postfix Server Installation
First you need to install postfix;
When prompted, choose internet site, then enter the @ part where you wish the mail to be sent from, e.g nagios.notify.
This will mean that emails received from nagios will be @nagios.notify..
Mailx Server Installation
Now install nagios's part of the mail server;
Configuring Nagios Mail Command
You need to edit the commands.cfg folder to take into account the new paths;
Replace;
With;
Note that the change is '/bin/mail' to '/usr/bin/mailx'.
Now restart Nagios;
You should now receive email notifications of services/host states (after defining the email in the contact definition).
Good luck!
Kind Regards,
Gary Shergill
Below are the steps I used to install Postfix on Ubuntu 12.04:
Postfix Server Installation
First you need to install postfix;
Code: Select all
apt-get install postfixThis will mean that emails received from nagios will be @nagios.notify..
Mailx Server Installation
Now install nagios's part of the mail server;
Code: Select all
apt-get install heirloom-mailxYou need to edit the commands.cfg folder to take into account the new paths;
Code: Select all
vi /usr/local/nagios/etc/objects/commands.cfgCode: 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 -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" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}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$
}Now restart Nagios;
Code: Select all
/etc/init.d/nagios restartGood luck!
Kind Regards,
Gary Shergill
-
slansing
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: Postfix
Thanks for the great guide Garry! I'm sure that will be very helpful. If you run into any issues let us know MPIvan.
Re: Postfix
Hi tnx to all for the reply's !!!
I have one question for now ...
What if i want to be send as [email protected] then as you say instead of @nagios.notify should be @mydomain.com i suppose ?
I have one question for now ...
.When prompted, choose internet site, then enter the @ part where you wish the mail to be sent from, e.g nagios.notify.
This will mean that emails received from nagios will be @nagios.notify..
What if i want to be send as [email protected] then as you say instead of @nagios.notify should be @mydomain.com i suppose ?
Re: Postfix
Hi MPIvan,
Yup I don't see any reason why that wouldn't work. I only chose nagios.notify because it helps me organise my emails more effectively.
Kind Regards,
Gary Shergil
Yup I don't see any reason why that wouldn't work. I only chose nagios.notify because it helps me organise my emails more effectively.
Kind Regards,
Gary Shergil
-
slansing
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: Postfix
Please let us know if you run into further issues regarding this topic!
Re: Postfix
Hi,
we have some problem with the network and network policy ... new firewall added and i cant download nothing
so im hoping tomorrow im gonna start ... first i have to fix this policy on the new firewall cant dl postifx :S ... tnx for helping me and i will post how it went the firs thing ill do after the postfix installed .... tnx again for support ...
we have some problem with the network and network policy ... new firewall added and i cant download nothing
Re: Postfix
Great, let us know how everything went.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: Postfix
Hi guy's , here i am ... i have do like you told me gshergill. And everything went well. Im using Ubuntu Server 12.04LTS by the way ... i have in nagios template define router host template where i define "contactgroup_name emailme" and in contact.cfg i have define the contact like
define contact {
contact_name ivan
use generic-contact
alias ivanMP
email [email protected]
}
and
define contactgroup{
contactgroup_name emailme
alias mail me
members ivan
}
and i have nothing ... also i was trying to send mail like in this article and i have some problems like when i get to ehlo localhost
mail from: [email protected]
rcpt to: [email protected]
i have this error 550 5.1.1 <[email protected]>: Recipient address rejected: User unknown in local recipient table
so how do i test is it ok with postfix or sending mail or with my nagios configuration or do i missing something ... ?
or should i configure like this (null client)
define contact {
contact_name ivan
use generic-contact
alias ivanMP
email [email protected]
}
and
define contactgroup{
contactgroup_name emailme
alias mail me
members ivan
}
and i have nothing ... also i was trying to send mail like in this article and i have some problems like when i get to ehlo localhost
mail from: [email protected]
rcpt to: [email protected]
i have this error 550 5.1.1 <[email protected]>: Recipient address rejected: User unknown in local recipient table
so how do i test is it ok with postfix or sending mail or with my nagios configuration or do i missing something ... ?
or should i configure like this (null client)
Re: Postfix
Below is a description from stackoverflow of the error:MPIvan wrote: i have this error 550 5.1.1 <[email protected]>: Recipient address rejected: User unknown in local recipient table
Essentially, you need to create local users for each email address, or create a virtual domain and add the users there, or remove the target domain so the server just acts like an outbound relay.The error is pretty self-descriptive: the target email username (left of the @ sign) can't be mapped to a local user on the system (default postfix settings), nor to a virtual domain (as none are configured out of the box). The decision to try and perform this mapping is controlled by the list of domains in 'mydestination' (plus any virtual domains). If this machine is in fact a domain's primary MX, then users that don't exist have broken mail. If this box only needs to send outgoing messages, simply removing the target domain from mydestination (by removing $mydomain from the list) should suffice -- it will still accept messages directly for [email protected], but messages for [email protected] will go through the MX lookup process for delivery elsewhere. You can shortcut the process by setting up a transport map (for individual domains), or for configuring a smarthost (for all mail)
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.