Nagios HTML mail

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.
ericosman
Posts: 20
Joined: Thu Oct 30, 2014 4:11 am

Nagios HTML mail

Post 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 ? :)
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Nagios HTML mail

Post 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.
ericosman
Posts: 20
Joined: Thu Oct 30, 2014 4:11 am

Re: Nagios HTML mail

Post 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 --myemail@mail.nl mailx -t
It makes a mail in terminal.....
But is it beause i use POSTFIX it wont send the mail?
Last edited by ericosman on Wed Nov 12, 2014 4:10 am, edited 1 time in total.
ericosman
Posts: 20
Joined: Thu Oct 30, 2014 4:11 am

Re: Nagios HTML mail

Post 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]# 
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagios HTML mail

Post 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
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.
ericosman
Posts: 20
Joined: Thu Oct 30, 2014 4:11 am

Re: Nagios HTML mail

Post 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
User avatar
rhassing
Posts: 412
Joined: Sat Oct 05, 2013 10:29 pm
Location: Netherlands

Re: Nagios HTML mail

Post 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
Rob Hassing
Image
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagios HTML mail

Post 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).
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.
ericosman
Posts: 20
Joined: Thu Oct 30, 2014 4:11 am

Re: Nagios HTML mail

Post by ericosman »

Code: Select all

[administrator@Nagios root]$ su nagios
Password: 
This account is currently not available.
User avatar
rhassing
Posts: 412
Joined: Sat Oct 05, 2013 10:29 pm
Location: Netherlands

Re: Nagios HTML mail

Post 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
Rob Hassing
Image
Locked