Hello,
We have an SSH check that runs a remote script checking the license count for an application. When running the check via the actual service monitor, I get this result (I've changed IP information below):
[nagios@nagiosxi ~]$ /usr/local/nagios/libexec/check_by_ssh -H [IP HERE] -C "~/check_ud.sh"
Remote command execution failed: Permission denied, please try again.
If I log into the server itself, and su - nagios from the root, running the same command, I get the expected output:
[nagios@nagiosxi ~]$ /usr/local/nagios/libexec/check_by_ssh -H [IP HERE] -C "~/check_ud.sh"
Password:
OK - 341 is 71% of 478 Unidata Licenses used.|unidata=71%;90;95
It seems like the keypair/fingerprint is not present, but I've added that both via the IP and the hostname to known_hosts. I've also created a keypair on the nagios server itself and added the public key to the monitoring endpoint server.
What am I missing?
Thanks!
SSH Check monitor fails, but works manually via CLI
-
- Posts: 31
- Joined: Mon Mar 22, 2021 12:57 pm
Re: SSH Check monitor fails, but works manually via CLI
Hello aylesworth,
Please check the permissions and ownership on your "~/check_ud.sh" script. should be:
and
Thanks,
Perry
Please check the permissions and ownership on your "~/check_ud.sh" script. should be:
Code: Select all
chown nagios:nagios ~/check_ud.sh
Code: Select all
chmod 755 ~/check_ud.sh
Perry
-
- Posts: 31
- Joined: Mon Mar 22, 2021 12:57 pm
Re: SSH Check monitor fails, but works manually via CLI
Hi Perry,
Thanks for the suggestion, not sure what happened but re-issuing the keypair and re-adding that to the host fixed the issue.
This can be closed!
Thanks for the suggestion, not sure what happened but re-issuing the keypair and re-adding that to the host fixed the issue.
This can be closed!
Re: SSH Check monitor fails, but works manually via CLI
Have you tried to ssh to the remote host as nagios from the nagios host? If it prompts for a password, something in the ssh setup probably needs fixed.