Hi,
I have configured one service check using "check_by_ssh_master" plugin . when i am trying to execute the command from nagios server it's giving correct output
./check_by_ssh_master -T psnagios@<hostaddress> -t 60 -m 200 -S /usr/local/nagios/tmp "/users/psnagios/nrpe-agent/nrpe/libexec/tomcat_sora2.sh"
Output :- OK - 1 Tomcat Process running from correct path
But when i have configured same thing in Nagiosxi .. PFA (Service config in nagiosxi)
It's giving error as mentioned below.
cannot open /usr/local/nagios/tmp/psnagios@<hostaddress>.sessions: Permission denied
Permissions given to tmp directory and session file present inside it :
drwxrwxrwx 2 nagios nagios 12288 Jul 8 05:00 tmp
-rw------- 1 apache apache 0 Jul 8 05:00 psnagios@<hostname>.sessions
Note: For other servers same thing i have configured, there it's working fine
Please check and let me know what permissions i need to modify , I am not aware of these sessions in nagiosxi.
Please Let me know if any other information is required.
Thanks and Regards,
Ayush Jain
Permission Denied while opening nagios session
-
Ayush Jain
- Posts: 28
- Joined: Sat Mar 05, 2016 6:38 pm
Permission Denied while opening nagios session
You do not have the required permissions to view the files attached to this post.
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: Permission Denied while opening nagios session
There are a couple if things with check_by_ssh_master which will be causing your issues.
If you are logged into the ssh session as root, the command you are executing stores the ssh keys in it's home directory.
When the nagios user goes to execute the plugin, it doesn't know about those certificates the root user owns.
Do the following:
This will confirm the ssh keys have been propely setup and the plugin is correctly executing as the nagios user. If it does not complete, you need to resolve any issues it is complaining about.
One other point to make.
I can see you are running into a couple of problems which can lead to the issues you are having.
Due to how PHP runs as the apache user, the "Test Check Command" does not work in these situations and should be ignored.
So for all further testing of this service you need to:
Make the changes to the service
Save the Service
Apply Configuration
Go back to the home screen and find the Service
When viewing the Service Status Details page click the Schedule a forced immediate check link
Just to re-iterate, for all further testing for this service DO NOT use the "Test Check Command" button, follow the steps above.
Does this help fix your problem?
When you are testing, are you testing as the nagios user ?Ayush Jain wrote:I have configured one service check using "check_by_ssh_master" plugin . when i am trying to execute the command from nagios server it's giving correct output
./check_by_ssh_master -T psnagios@<hostaddress> -t 60 -m 200 -S /usr/local/nagios/tmp "/users/psnagios/nrpe-agent/nrpe/libexec/tomcat_sora2.sh"
Output :- OK - 1 Tomcat Process running from correct path
If you are logged into the ssh session as root, the command you are executing stores the ssh keys in it's home directory.
When the nagios user goes to execute the plugin, it doesn't know about those certificates the root user owns.
Do the following:
Code: Select all
su nagios
/usr/local/nagios/libexec/check_by_ssh_master -T psnagios@<hostaddress> -t 60 -m 200 -S /usr/local/nagios/tmp "/users/psnagios/nrpe-agent/nrpe/libexec/tomcat_sora2.sh"To directly address the permission denied error I must go back to the first point I made. If you've been running the command in the ssh session as the root user, then the directory referenced here -S /usr/local/nagios/tmp (and any temp files the plugin creates) will have been created by the root user and the nagios user will not have permission. You need to either delete the file and let the plugin create them as the nagios user, or fix the permissions.Ayush Jain wrote:But when i have configured same thing in Nagiosxi .. PFA (Service config in nagiosxi)
It's giving error as mentioned below.
cannot open /usr/local/nagios/tmp/psnagios@<hostaddress>.sessions: Permission denied
Permissions given to tmp directory and session file present inside it :
drwxrwxrwx 2 nagios nagios 12288 Jul 8 05:00 tmp
-rw------- 1 apache apache 0 Jul 8 05:00 psnagios@<hostname>.sessions
Note: For other servers same thing i have configured, there it's working fine
Please check and let me know what permissions i need to modify , I am not aware of these sessions in nagiosxi.
One other point to make.
I can see you are running into a couple of problems which can lead to the issues you are having.
Due to how PHP runs as the apache user, the "Test Check Command" does not work in these situations and should be ignored.
So for all further testing of this service you need to:
Make the changes to the service
Save the Service
Apply Configuration
Go back to the home screen and find the Service
When viewing the Service Status Details page click the Schedule a forced immediate check link
Just to re-iterate, for all further testing for this service DO NOT use the "Test Check Command" button, follow the steps above.
Does this help fix your problem?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.