Page 2 of 3
Re: NRDP
Posted: Mon Jun 13, 2016 3:20 pm
by tgriep
Do you see anything in the Apache error logs on the Nagios system when you send to it?
Can you post the command you are using to send the NRDP data from the client?
Did you enable the accept passive checks in the nagios.cfg file?
Re: NRDP
Posted: Fri Jun 17, 2016 9:26 am
by peter19x
Hello,
Thanks for the reply,
@Eloyd
I am not even getting a "Got host checkresult for 'NOTAREALHOST'" Error in the nagios log,.
@Tgriep
- Passive checks are enabled on the box.
- I do not know where to find the apache error log. I googled it and it should be in /var/log/apache2/ but did not find.
- My NRDP is installed correctly and successfully tested when going to
http://nagiosxi//nrdp and entering the token.
My NRDP Command is the below:
Code: Select all
/home/nagiosscripts/send_nrdp.sh -u http://172.25.25.28/nrdp/ -t df23m7jadI34 -H "172.25.25.28" -s "DB_STATUS" -S 2 -o "DB status is DOWN"
Best Regards,
Peter
Re: NRDP
Posted: Fri Jun 17, 2016 9:40 am
by eloyd
peter19x wrote:
@Tgriep
- I do not know where to find the apache error log. I googled it and it should be in /var/log/apache2/ but did not find.
Try /var/log/httpd instead.
Re: NRDP
Posted: Fri Jun 17, 2016 12:27 pm
by tgriep
Another place to look for any errors is on the server that is running the send_nrpd.sh script.
It should create XML files in the /tmp folder and if it cannot connect to the remote server, it should log it there.
The file should look similar to this.
/tmp/nrdp.XXXXXX
Re: NRDP
Posted: Thu Jun 23, 2016 7:08 am
by peter19x
Hello All,
Thank you for the reply,
I have found 2 files is /var/log/httpd: access_log and error_log.
When I tried to send my passive check from 172.25.25.11 I get the following in:
1) access_log:
Code: Select all
172.25.25.11 - - [23/Jun/2016:13:04:14 +0100] "POST /nrdp// HTTP/1.1" 200 170 "-" "curl/7.22.0 (x86_64-unknown-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.0e zlib/1.2.5 c-ares/1.7.5 libidn/1.22 libssh2/1.2.9"
2) error_log:
Code: Select all
[Thu Jun 23 13:04:14 2016] [error] [client 172.25.25.11] PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/London' for 'BST/1.0/DST' instead in /usr/local/nrdp/server/plugins/nagioscorepassivecheck/nagioscorepassivecheck.inc.php on line 105
[Thu Jun 23 13:04:14 2016] [error] [client 172.25.25.11] PHP Warning: chgrp(): Operation not permitted in /usr/local/nrdp/server/plugins/nagioscorepassivecheck/nagioscorepassivecheck.inc.php on line 119
Any Idea What might cause this error?
Best Regards,
Peter
Re: NRDP
Posted: Thu Jun 23, 2016 7:45 am
by eloyd
I see two things wrong.
1) you need to edit /etc/php.ini and set your proper timezone (search for "date.timezone" without the quotes).
2) it seems like you may have a misconfigured nagios group for the nagios command file. See the following.
To help figure out number 2, can you post the output of this commands on your core machine:
Code: Select all
head -130 /usr/local/nrdp/server/plugins/nagioscorepassivecheck/nagioscorepassivecheck.inc.php | tail -20
grep command /usr/local/nrdp/server/config.inc.php
I don't have the same code you do, so I'm not sure which chgrp is the problem, but it's likely that it's having a problem sending the output of the command to the nagios.cmd file. Knowing the output of the above commands will help me say for sure, but I'm guessing that's the problem.
Re: NRDP
Posted: Thu Jun 23, 2016 9:55 am
by rkennedy
Thanks @eloyd!
@peter19x - let us know if you have any further questions.
Re: NRDP
Posted: Fri Jun 24, 2016 4:45 am
by peter19x
Hello @Eloyd.
Thanks for the reply.
Below are the output of the two commands you requested.
Code: Select all
[root@GSIP_MGNT_A httpd]# head -130 /usr/local/nrdp/server/plugins/nagioscorepassivecheck/nagioscorepassivecheck.inc.php | tail -20
fprintf($fh,"exited_ok=1\n");
fprintf($fh,"return_code=%d\n",$state);
fprintf($fh,"output=%s\\n\n",$output);
// close the file
fclose($fh);
// change ownership and perms
chgrp($tmpname,$cfg["nagios_command_group"]);
chmod($tmpname,0770);
// create an ok-to-go, so Nagios Core picks it up
$fh=fopen($tmpname.".ok","w+");
fclose($fh);
$total_checks++;
}
output_api_header();
Code: Select all
[root@GSIP_MGNT_A httpd]# grep command /usr/local/nrdp/server/config.inc.php
// the name of the system group that has write permissions to the external command file
// this group is also used to set file permissions when writing bulk commands or passive check results
$cfg["nagios_command_group"]="nagcmd";
// full path to Nagios external command file
$cfg["command_file"]="/usr/local/nagios/var/rw/nagios.cmd";
Best Regards,
Peter
Re: NRDP
Posted: Fri Jun 24, 2016 6:46 am
by peter19x
Hello,
I found out some other useful information.
The error :
Code: Select all
PHP Warning: chgrp(): Operation not permitted in /usr/local/nrdp/server/plugins/nagioscorepassivecheck/nagioscorepassivecheck.inc.php on line 119
The line 119:
Code: Select all
chgrp($tmpname,$cfg["nagios_command_group"]);
$tmpname =
/usr/local/nagios/var/spool/checkresults
$cfg["nagios_command_group"] =
nagcmd
Now I went to
/usr/local/nagios/var/spool/checkresults
And I found out everytime I send a passive check a file is create in this directory as below :
Code: Select all
-rw-r--r--. 1 apache apache 0 Jun 24 12:27 ctyy9e7.ok
somehow the apache user is the owner of the file so the chgrp command will not work because the script is running as nagios user.
Any idea how to get around that?
Best Regards,
Peter
Re: NRDP
Posted: Fri Jun 24, 2016 7:08 am
by eloyd
Peter,
You hit the nail on the head while I was driving in to the office.
You need to make it so your web server can write to your Nagios file. This is most easily accomplished by adding the "nagcmd" group to the "apache" user via this command:
Code: Select all
usermod apache -a -G nagcmd,nagios
You can verify it worked by typing the first line below. You should see something similar to the second line:
Code: Select all
# groups apache
apache : apache nagios nagcmd
(Edit: comma, not space, between group names when using usermod command)