Photon OS check_by_ssh


I have some Photon OS VM machines in our environment (VMware appliance, not vCenter) and I want to monitor some checks with “check_by_ssh” command.

On the other VMs where I have Ubuntu for example the check are working great, only on the PhotonOS I got “Remote command execution failed”, the ssh session is also working.

For example if I want to get the uptime from the host with a simple command:
ssh nagios@ip-address uptime and i got the right uptime from the host

If I tryed with check_by_ssh method:
/usr/lib/nagios/plugins/check_by_ssh -H ip_address -l nagios -C “uptime”
Remote command execution failed:

I added for test purpose the “session required /bin/true” to /etc/pam.d/sshd config but nothing changed, I think the os not allows to run commands remotely from ssh.

Thanks in advance!

Are you trying ssh and check_by_ssh as the same user and the same ip/hostname/FQDN?

You could add -v to get more details.

Yes, I am trying ssh manually and check_by_ssh to the same host with same user (nagios) with ip address.

I tryed with -v option:

With option -v at the final I see the same Remote command execution failed, but before that I can see the uptime information also.

It shows stdout correctly but stderr additionally. Something related to this PR. Hmm, no idea.

Maybe try, which is able to handle stdout and stderr?

1 Like

Update in this topic:

icinga services.conf :
apply Service “Uptime” {
import “generic-service”
check_command = “check_by_ssh”
vars.by_ssh_command = “/home/nagios/bin/check_uptime”
vars.by_ssh_arguments = {
“-H” = “$address$”
“-C” = “$by_ssh_command$”
“-l” = “$ssh_username$”
“-E” = “false”
assign where host.groups && (host.groups.contains(“photonos”))


If I run the command from icinga server:
nagios@vcloud-mon01:~$ /usr/lib/nagios/plugins/check_by_ssh -H -l nagios -C “uptime” -E “false”
08:47:04 up 186 days, 14:02, 2 users, load average: 0.15, 0.14, 0.10

But on the icinga web I the same error as originally:
Plugin Output
Remote command execution failed:

On the remote host for test purpose I added the nagios user to sudoers:
nagios ALL=(ALL:ALL) ALL