Page 4 of 5
Re: SSL and Email issues with nagios
Posted: Thu Nov 21, 2013 4:15 pm
by abrist
The following includes are required:
Code: Select all
use Getopt::Long;
use Mail::Sendmail;
use Digest::MD5 qw(md5_hex);
use MIME::Base64;
use File::Temp;
At the moment, we know you need
Mail::Sendmail:
Re: SSL and Email issues with nagios
Posted: Thu Nov 21, 2013 4:20 pm
by vivithemage
That's the one I missed:
I put one in downtime, and I see this:
Code: Select all
1385068727] HOST NOTIFICATION: nagiosadmin;client315_node01;DOWNTIMESTART (UP);notify-host-by-email;PING OK - Packet loss = 0%, RTA = 8.75 ms
[1385068727] wproc: NOTIFY job 42 from worker Core Worker 18956 is a non-check helper but exited with return code 2
[1385068727] wproc: command: /usr/local/nagios/bin/nagios_send_host_mail.pl -c "" -f html -u
[1385068727] wproc: host=client315_node01; service=(none); contact=nagiosadmin
[1385068727] wproc: early_timeout=0; exited_ok=1; wait_status=512; error_code=0;
and
Code: Select all
[1385068794] wproc: stderr line 01: Can't locate RRDs.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /usr/local/nagios/bin/nagios_send_service_mail.pl line 38.
[1385068794] wproc: stderr line 02: BEGIN failed--compilation aborted at /usr/local/nagios/bin/nagios_send_service_mail.pl line 38.
Re: SSL and Email issues with nagios
Posted: Thu Nov 21, 2013 5:04 pm
by abrist
How about:
Code: Select all
yum install rrdtool rrdtool-devel rrdtool-perl
You may also need:
Re: SSL and Email issues with nagios
Posted: Thu Nov 21, 2013 5:15 pm
by vivithemage
[root@vmmgmtappnagios var]# yum install perl-RRD-Simple
Loaded plugins: security
Setting up Install Process
No package perl-RRD-Simple available.
Nothing to do
[root@vmmgmtappnagios var]#
the rest worked fine though.
and now getting:
[1385072067] wproc: NOTIFY job 8 from worker Core Worker 19087 is a non-check helper but exited with return code 255
[1385072067] wproc: command: /usr/local/nagios/bin/nagios_send_host_mail.pl -c "" -f html -u
[1385072067] wproc: host=client315_node02; service=(none); contact=nagiosadmin
[1385072067] wproc: early_timeout=0; exited_ok=1; wait_status=65280; error_code=0;
[1385072067] wproc: stdout line 01: Error: no recipients have been provided
[1385072067] wproc: stdout line 02: Usage: /usr/local/nagios/bin/nagios_send_host_mail.pl [-v] [-V] [-h] [-t] [-H <SMTP host>] [-p <customername>]
[1385072067] wproc: stdout line 03: [-r <to_recipients>] or -g <to_group>] [-c <cc_recipients>] [-b <bcc_recipients>]
[1385072067] wproc: stdout line 04: [-f <text|html|multi|graph>] [-u] [-l <en|jp|fr|de>(or other languages if added]
[1385072091] SERVICE NOTIFICATION: nagiosadmin;localhost;Current Load;CRITICAL;notify-service-by-email;(No output on stdout) stderr:
[1385072094] wproc: NOTIFY job 56 from worker Core Worker 19087 is a non-check helper but exited with return code 255
[1385072094] wproc: command: /usr/local/nagios/bin/nagios_send_service_mail.pl -c "" -f html -u
[1385072094] wproc: host=localhost; service=Current Load; contact=nagiosadmin
[1385072094] wproc: early_timeout=0; exited_ok=1; wait_status=65280; error_code=0;
Re: SSL and Email issues with nagios
Posted: Thu Nov 21, 2013 5:39 pm
by abrist
It looks like the first script (/usr/local/nagios/bin/nagios_mail.php) is not handing off any of the macro values to the second script (/usr/local/nagios/bin/nagios_send_host_mail.pl).
Did you ever verify if the first script was able to use the env vars?
Re: SSL and Email issues with nagios
Posted: Thu Nov 21, 2013 11:53 pm
by vivithemage
Is there a simple way to verify that?
Re: SSL and Email issues with nagios
Posted: Fri Nov 22, 2013 10:41 am
by abrist
You could add some debug output to the first file to check if it is getting the env vars. As it is php, I would suggest using "put_file_contents" (
http://us2.php.net/file_put_contents).
Have it dump some of the php vars that were loaded from the env vars to a file in /tmp.
Re: SSL and Email issues with nagios
Posted: Sun Nov 24, 2013 6:30 pm
by vivithemage
Where would I add that exactly?
Re: SSL and Email issues with nagios
Posted: Mon Nov 25, 2013 1:04 pm
by vivithemage
okay, so I am going to skip that mail script and go back to the old one, as the format looks better. To start debugging it ... I was able to send a test email no problem generated by the script, but it seems like nagios cannot send any on its own.
I see one message in my /var/log/maillog and it was the only successful attempt that I sent via my test command line. I don't see any errors in nagios.log when the script is trying to execute...so I am not sure what other log files I can look at to narrow down where the problem is.
Re: SSL and Email issues with nagios
Posted: Tue Nov 26, 2013 11:38 am
by sreinhardt
Can you post the command definition that is configured for this script please? Does this have read and execute permission for the nagios user and group? Where is it located on your file system? Can you su to the nagios user and execute by hand or does that also give an issue?