Page 1 of 3

Nagios HTML mail

Posted: Mon Nov 10, 2014 10:14 am
by ericosman
Hi,

After you guys helped me with setting up the mail notification i would like to use HTML teplates ( because it looks better and is easy in use ).
Now i wanted to install the following plugin in CentOs :
http://engineering.voxer.com/2014/02/24 ... templates/
But i could not download it :(
After that i tryed this one :
https://github.com/jasonhancock/nagios-html-email
But i didnt recived any mail.
I also tryed this one :
http://exchange.nagios.org/directory/Ad ... v2/details
But could not find the nagios/libexec/ folder....

Is there anyone who could help me out ? :)

Re: Nagios HTML mail

Posted: Mon Nov 10, 2014 10:34 am
by slansing
Well, none of these are likely to be "plug and play" solutions, Core takes a bit of work when you want to add in solutions such as these.
I also tryed this one :
http://exchange.nagios.org/directory/Ad ... v2/details
But could not find the nagios/libexec/ folder....
What distro are you on? You should have a /usr/local/nagios/libexec directory by default if you configured the plugins package on Centos/RHEL.

For the top one you posted, you did not follow the directions... you need to use the node package manager, not yum, I suggest you re-read the instructions and try that one out first.

Re: Nagios HTML mail

Posted: Tue Nov 11, 2014 2:38 am
by ericosman
Hi,

I installed node package manager and downloaded the plugin.
But whenn i changed the send mail code to :

Code: Select all

define command {
    command_name notify-service-by-email
    command_line nagios-html-email service http://nagios.example.com | mailx -t
}
define command {
    command_name notify-host-by-email
    command_line nagios-html-email host http://nagios.example.com | mailx -t
}
I even changed

Code: Select all

mailx -t
to

Code: Select all

postfix 
But i wont recive mail

I found this on there website :
No emails are being generated

Most likely, the path with nagios-html-email in it is not in the PATH variable for the Nagios server. Ensure the path given by which nagios-html-email is in the PATH of the Nagios server.
But how can i check / change the path?

EDIT :

Whenn i use this code in terminal :

Code: Select all

 nagios-html-email -a [email protected] mailx -t
It makes a mail in terminal.....
But is it beause i use POSTFIX it wont send the mail?

Re: Nagios HTML mail

Posted: Tue Nov 11, 2014 5:50 am
by ericosman
So i guess it cant find the email adresses?

Code: Select all

root@Nagios objects]# nagios-html-email service http://nagios.example.com | mailx -t
env NAGIOS_CONTACTEMAIL or `-a <address>` must be supplied!

Usage: nagios-html-email [options] <service|host> [arg1] [arg2] ...

This command is meant to be run from nagios when a service or host
experiences problems.  The output will be suitable for passing to
a mail program that takes raw email data like `mailx -t`

Options
  -a, --address <email>      the email address to send mail to, defaults to env NAGIOS_CONTACTEMAIL
  -h, --help                 print this message and exit
  -s, --subject <subject>    the email subject to use, defaults to _subject for the host/service, or default nagios subject
  -t, --template-dir <dir>   dir to find ejs template files, defaults to builtin templates
  -u, --updates              check for available updates on npm
  -v, --version              print the version number and exit
No message, no subject; hope that's ok
No recipients specified
"/root/dead.letter" 7/186
[root@Nagios objects]# 

Re: Nagios HTML mail

Posted: Wed Nov 12, 2014 5:40 pm
by abrist
Can you try running the same command again as the nagios user:

Code: Select all

su nagios
nagios-html-email service http://nagios.example.com | mailx -t

Re: Nagios HTML mail

Posted: Thu Nov 13, 2014 4:35 am
by ericosman
abrist wrote:Can you try running the same command again as the nagios user:

Code: Select all

su nagios
nagios-html-email service http://nagios.example.com | mailx -t
Hi,

What is the standard password?
Because i cant figure it out :o

Re: Nagios HTML mail

Posted: Thu Nov 13, 2014 5:17 am
by rhassing
You should not need the password if you were root on the system.
Or else you could set the password with the following command:

Code: Select all

passwd nagios

Re: Nagios HTML mail

Posted: Thu Nov 13, 2014 4:16 pm
by abrist
As mentioned, it is easiest to log in as root and then change to the nagios user:

Code: Select all

su nagios
Let us know if you have issues with the nagios account and /bin/login or nologin).

Re: Nagios HTML mail

Posted: Fri Nov 14, 2014 7:02 am
by ericosman

Code: Select all

[administrator@Nagios root]$ su nagios
Password: 
This account is currently not available.

Re: Nagios HTML mail

Posted: Fri Nov 14, 2014 7:26 am
by rhassing

Code: Select all

usermod -s /bin/bash nagios
or if you are not root

Code: Select all

sudo usermod -s /bin/bash nagios