I'm trying to implement a remote command from a nagios (let's call it for convenience nagios A
anyway i want to implement a simple command that control my nagios.log (on remote server nagios B)
i have just put the public key in authorized_keys.... and the access without password... works! the nagiosA access to the nagiosB only with a specific port:
Code: Select all
ssh -p 2022 [email protected]Code: Select all
root@maestro: root@maestro:/etc/nagios-plugins/config# /usr/lib/nagios/plugins/check_by_ssh -H 'intranet.xx.xx' -p '2022' -C "/usr/local/nagios/libexec/check_nagios -F '/usr/local/nagios/var/nagios.log' -e '5' -C '/usr/local/nagios/bin/nagios'"
NAGIOS OK: 40 processes, status log updated 47 seconds ago but when i try to implement this command on servece definition (for control automatically the remote nagios.log)
i got this error:
Code: Select all
backups;Nagios Status;UNKNOWN;SOFT;2;Remote command execution failed: Permission denied, please try again.
this is my command definition:
Code: Select all
define command{
command_name check_nagios_ssh
command_line /usr/lib/nagios/plugins/check_by_ssh -H '$HOSTADDRESS$' -p '$ARG4$' -C "/usr/local/nagios/libexec/check_nagios -F '$ARG1$' -e '$ARG2$' -C '$ARG3$'"
}
Code: Select all
define service {
use generic-service
host_name backups
service_description Nagios Status
check_command check_nagios_ssh!/usr/local/nagios/var/nagios.log!5!/usr/local/nagios/bin/nagios!2022
}
Code: Select all
define host{
use generic-host ; Name of host template to use
host_name backups
alias Server Nagios
address intranet.xx.xx
}