SSL and Email issues with nagios

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

Re: SSL and Email issues with nagios

Post 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:

Code: Select all

yum install perl-Mail-Sendmail
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.
vivithemage
Posts: 102
Joined: Tue May 21, 2013 2:52 pm

Re: SSL and Email issues with nagios

Post by vivithemage »

That's the one I missed:

Code: Select all

yum install perl-Mail-Sendmail
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.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: SSL and Email issues with nagios

Post by abrist »

How about:

Code: Select all

yum install rrdtool rrdtool-devel rrdtool-perl 
You may also need:

Code: Select all

yum install perl-RRD-Simple
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.
vivithemage
Posts: 102
Joined: Tue May 21, 2013 2:52 pm

Re: SSL and Email issues with nagios

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

Re: SSL and Email issues with nagios

Post 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?
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.
vivithemage
Posts: 102
Joined: Tue May 21, 2013 2:52 pm

Re: SSL and Email issues with nagios

Post by vivithemage »

Is there a simple way to verify that?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: SSL and Email issues with nagios

Post 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.
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.
vivithemage
Posts: 102
Joined: Tue May 21, 2013 2:52 pm

Re: SSL and Email issues with nagios

Post by vivithemage »

Where would I add that exactly?
vivithemage
Posts: 102
Joined: Tue May 21, 2013 2:52 pm

Re: SSL and Email issues with nagios

Post 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.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: SSL and Email issues with nagios

Post 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?
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Locked