Page 2 of 2

Re: NCPA not sending passive check results to Nagios Core 4.

Posted: Mon Sep 16, 2019 2:16 pm
by hpzaramk
The commands are executed. And we are using different user called nagiosim, i have executed the chown based on this user name.

touch /usr/local/nrdp/server/debug.log
chown nagiosim:nagiosim /usr/local/nrdp/server/debug.log


I waited for few minutes and execute submit JSON check result from NRDP URL and still getting "BAD CHECK RESULTS DIR" and then the error disappeared within seconds. The debug.log is still empty.

# ls -lrt /usr/local/nrdp/server
total 20
drwxr-xr-x 4 nagiosim nagiosim 57 Aug 13 06:39 plugins
-rw-r--r-- 1 nagiosim nagiosim 12488 Aug 13 06:39 index.php
drwxr-xr-x 2 nagiosim nagiosim 135 Aug 13 06:39 includes
-rw-r--r-- 1 nagiosim nagiosim 2918 Sep 16 05:15 config.inc.php
-rwxrwxr-x 1 nagiosim nagiosim 0 Sep 16 14:26 debug.log

Here is the data logged in apache error log after the execution of chown command:

143.34.97.238 - - [16/Sep/2019:15:12:50 -0400] "POST /nrdp/ HTTP/1.1" 200 72 "http://adlg3623.na.pg.com/nrdp/" "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"
127.0.0.1 - - [16/Sep/2019:15:13:33 -0400] "GET / HTTP/1.0" 403 3985 "-" "check_http/v2.2.1.git (nagios-plugins 2.2.1)"


Also, the user for apache is apacheim.. Please refer below outputs from Nagios server:

# grep -i nag /etc/group
nagiosim::30:nagiosim,ch1666,apacheim

Thanks,
Ram.

Re: NCPA not sending passive check results to Nagios Core 4.

Posted: Mon Sep 16, 2019 2:18 pm
by hpzaramk
The commands are executed. And we are using different user called nagiosim, i have executed the chown based on this user name.

touch /usr/local/nrdp/server/debug.log
chown nagiosim:nagiosim /usr/local/nrdp/server/debug.log


I waited for few minutes and execute submit JSON check result from NRDP URL and still getting "BAD CHECK RESULTS DIR" and then the error disappeared within seconds. The debug.log is still empty.

# ls -lrt /usr/local/nrdp/server
total 20
drwxr-xr-x 4 nagiosim nagiosim 57 Aug 13 06:39 plugins
-rw-r--r-- 1 nagiosim nagiosim 12488 Aug 13 06:39 index.php
drwxr-xr-x 2 nagiosim nagiosim 135 Aug 13 06:39 includes
-rw-r--r-- 1 nagiosim nagiosim 2918 Sep 16 05:15 config.inc.php
-rwxrwxr-x 1 nagiosim nagiosim 0 Sep 16 14:26 debug.log

Here is the data logged in apache log after the execution of chown command:

143.34.97.238 - - [16/Sep/2019:15:12:50 -0400] "POST /nrdp/ HTTP/1.1" 200 72 "http://adlg3623.na.pg.com/nrdp/" "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"
127.0.0.1 - - [16/Sep/2019:15:13:33 -0400] "GET / HTTP/1.0" 403 3985 "-" "check_http/v2.2.1.git (nagios-plugins 2.2.1)"


Also, the user for apache is apacheim.. Please refer below outputs from Nagios server:

# grep -i nag /etc/group
nagiosim::30:nagiosim,ch1666,apacheim

Thanks,
Ram.

Re: NCPA not sending passive check results to Nagios Core 4.

Posted: Tue Sep 17, 2019 11:13 am
by mbellerue
Alright, let's focus on the check results dir. Do an ll on /usr/local/nagios/var/spool/

This is what I get

Code: Select all

drwxrwsr-x 2 nagios nagios 4096 Sep 13 14:40 checkresults/
Of course, yours should be nagiosim:nagiosim. But let's give that a check and make sure the permissions are correct. Maybe do an su - nagiosim, and try to touch a file in that directory. See if a file can be created, modified, and deleted by nagiosim.

Re: NCPA not sending passive check results to Nagios Core 4.

Posted: Tue Sep 17, 2019 12:32 pm
by hpzaramk
Here is the output: Permissions of the directory looks to be correct.

# ls -l /usr/local/nagios/var/spool/
total 0
drwxrwsr-x 2 nagiosim nagiosim 6 Aug 7 10:07 checkresults


One more thing i observed is apache service runs as "apache" user as you see below output: However user "apache" is not part of nagiosim group based on /etc/group output..
Do we need to include apache user in the nagiosim group.. Please refer below outputs from nagios server..

# ps -ef|grep -i apache
root 5029 4573 0 13:23 pts/0 00:00:00 grep --color=auto -i apache
apache 8931 30149 0 04:08 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 8989 30149 0 04:09 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 30150 30149 0 Sep16 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 30151 30149 0 Sep16 ? 00:00:01 /usr/sbin/httpd -DFOREGROUND
apache 30152 30149 0 Sep16 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 30153 30149 0 Sep16 ? 00:00:01 /usr/sbin/httpd -DFOREGROUND
apache 30154 30149 0 Sep16 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 30181 30149 0 Sep16 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND


# grep -i nag /etc/group
nagiosim::30:nagiosim,ch1666,apacheim

Thanks,
Ram.

Re: NCPA not sending passive check results to Nagios Core 4.

Posted: Tue Sep 17, 2019 12:53 pm
by scottwilkerson
hpzaramk wrote:Do we need to include apache user in the nagiosim group.. Please refer below outputs from nagios server..
Absolutely, it needs to be able to write to the directory above.

Re: NCPA not sending passive check results to Nagios Core 4.

Posted: Tue Sep 17, 2019 3:52 pm
by hpzaramk
Thanks Scott, It worked. I can see the nagios.log and checkresults directory started updating.
The NRDP "submit JSON check results" now returns ok.
So the problem was the apache user not being part of nagiosim group which is now resolved after adding it in the group..

Thanks,
Ram.

Re: NCPA not sending passive check results to Nagios Core 4.

Posted: Tue Sep 17, 2019 4:01 pm
by scottwilkerson
hpzaramk wrote:Thanks Scott, It worked. I can see the nagios.log and checkresults directory started updating.
The NRDP "submit JSON check results" now returns ok.
So the problem was the apache user not being part of nagiosim group which is now resolved after adding it in the group..

Thanks,
Ram.
Great!

Locking thread