Page 2 of 2

Re: Notification email address questions

Posted: Tue Jul 19, 2016 9:50 am
by rkennedy
derekb wrote:
tgriep wrote:What problems are you having?
Can you provide what you have done already and any errors that you are receiving?
Hi Tom!
We're on XI latest. I've uploaded the plugins and made the command as outlined in the read me. I have a host that I'm testing with. I've set it to contact myself via the command also mentioned in the read me. The contact is set to use host notifications via that new command.

/tmp/notifier.txt didn't exist , so I did a touch to create it. I simply don't see any data being written to this file when an event is triggered. I do see events written in /var/log/messages for the host, though.
What are the permissions on /tmp/notifier.txt? ls -l /tmp/notifier.txt The user nagios will need to be able to write to this file.

Re: Notification email address questions

Posted: Tue Jul 19, 2016 9:56 am
by derekb
rkennedy wrote:
derekb wrote:
tgriep wrote:What problems are you having?
Can you provide what you have done already and any errors that you are receiving?
Hi Tom!
We're on XI latest. I've uploaded the plugins and made the command as outlined in the read me. I have a host that I'm testing with. I've set it to contact myself via the command also mentioned in the read me. The contact is set to use host notifications via that new command.

/tmp/notifier.txt didn't exist , so I did a touch to create it. I simply don't see any data being written to this file when an event is triggered. I do see events written in /var/log/messages for the host, though.
What are the permissions on /tmp/notifier.txt? ls -l /tmp/notifier.txt The user nagios will need to be able to write to this file.

Code: Select all

[root@nagios ~]# touch /tmp/notifier.txt
[root@nagios ~]# ls -l /tmp/notifier.txt
-rw-r--r-- 1 root root 0 Jul 19 10:55 /tmp/notifier.txt

Re: Notification email address questions

Posted: Tue Jul 19, 2016 10:50 am
by rkennedy
You need to adjust the permissions on it -

Code: Select all

chown nagios:nagios /tmp/notifier.txt

Re: Notification email address questions

Posted: Tue Jul 19, 2016 11:00 am
by derekb
rkennedy wrote:You need to adjust the permissions on it -

Code: Select all

chown nagios:nagios /tmp/notifier.txt
Done.
-rw-r--r-- 1 nagios nagios 0 Jul 19 10:55 notifier.txt

I made a host go down and brought it back up ,but still don't see anything writing in the /tmp/notifier.txt file

Re: Notification email address questions

Posted: Tue Jul 19, 2016 12:10 pm
by ssax
Did you make sure to check the prereqs?

Code: Select all

PRE-REQUISITES
--------------
perl MIME::Lite		in RedHat/Centos 6, yum install perl-MIME-Lite, 
			otherwise use CPAN to install it
perl-suidperl		in RedHat/CentOS 6, yum install perl-suidperl,
			other distros may already have this installed

Code: Select all

rpm -qa |grep "perl-MIME-Lite\|perl-suidperl"
Is it executable?

Code: Select all

chmod +x /usr/local/nagios/libexec/notifier.pl
What happens if you run it manually as the nagios user?

Code: Select all

su - nagios
/usr/local/nagios/libexec/notifier.pl
Are you seeing anything in your /var/log/cron?

Re: Notification email address questions

Posted: Thu Jul 21, 2016 7:36 am
by derekb
I don't see anything in /var/log/cron for notifier.pl

Code: Select all

[root@nagios ~]# cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# For details see man 4 crontabs

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name command to be executed
*/1 * * * *   /usr/local/nagios/libexec/notifier.pl
I also still don't see anything being written to /tmp/notifier.txt.
If I run notifier.pl manually, it seems to try to rotate the file as a notifier.txt.0 will get created.

Re: Notification email address questions

Posted: Thu Jul 21, 2016 10:52 am
by ssax
Change your /etc/crontab entry to:

Code: Select all

*/1 * * * * nagios /usr/local/nagios/libexec/notifier.pl
Let us know if that resolves the issue.