ok when i do
su - icinga
/usr/lib/nagios/plugins/check_by_ssh -C /usr/lib/nagios/plugins/check_script.sh -i /home/icinga/.ssh/id_rsa -H hostip -l root -E -t 30 -------> works
with out -E it doesnot give me output. throws error
Remote command execution failed: Unauthorized access to this machine is prohibited
But my question is on the icinga web GUI it always throws me error. not sure whats the problem. But in command line it works
Please suggest
Remote command execution failed: Warning: Identity file /home/icinga/.ssh/id_rsa not accessible: Permission denied.
Strange -E isn’t supposed to make it work only to suppress error messages in the output.
Do you get a valid output from /usr/lib/nagios/plugins/check_script.sh with -E?
Maybe it’s a motd or a SSH banner you need to deactivate on the remote server?
I think the other thread has the explanation on how to pass stuff to the command via director but with imported commands it’s some times easier to just redefine them in the director and use your own version.
The icinga director doesn’t care about your id_rsa file as he never touches the file system at all.
In the director you build objects in a database that get compiled into icinga DSL config directives and this code gets deployed via icinga API.
when i do inspect in icingaweb2, i can see the
/usr/lib/nagios/plugins/check_by_ssh -C /usr/lib/nagios/plugins/check_script.sh -i /home/icinga/.ssh/id_rsa -H hostip -l root -E 1 -t 30
the same command if i run as
root@icingaserver or icinga@icingaserver -------> works
itseems we cannot use -l root, icinga always tries to check with icinga userthough we specify as root. that could be one of the reason. But strange is when i create icinga user on remote and try to copy pubkey to remote host , it asked me password. but the password which i issued for icinga user on remote , the same i have given. it doesnot work
Sorry, the two restarts are just to make the activation and deactivation of the debug log take effect.
The important part for the next steps to see what what gets written in the debug log.
its only a guess not sure though. On the command line it just executes the script i can print output verywell. if we debuglog, it doesnot show anything may be as we are configuring services and commands on director .
ok the log just displays warning terminated with exit code 255
warning/PluginCheckTask: Check command for object UNKNOWN - check_by_ssh: Remote command '/usr/lib/nagios/plugins/check_script.sh ’ returned status 255 atleast from one of the website they say to use different user which is not working in my case .
I have only this
4.072021,latency=0.001131,max_check_attempts=3i,reachable=true,state=0i,state_type=1i 1663328179’.
[2022-09-16 11:36:50 +0000] information/ExternalCommandListener: Executing external command: [1663328210] SCHEDULE_FORCED_SVC_CHECK;host;check_script1663328210
I have only this
4.072021,latency=0.001131,max_check_attempts=3i,reachable=true,state=0i,state_type=1i 1663328179’.
[2022-09-16 11:36:50 +0000] information/ExternalCommandListener: Executing external command: [1663328210] SCHEDULE_FORCED_SVC_CHECK;host;check_script1663328210