Service check by_ssh returns Remote command execution failed: Host key verification failed

I have this service:

object Service “Zimbra_Queue” {
host_name = “Zimbra_Int”
check_command = “by_ssh”
max_check_attempts = “3”
check_interval = 1m
retry_interval = 30s
vars.by_ssh_command = “find /opt/zimbra/data/postfix/spool/deferred -type f | wc -l”
vars.by_ssh_identity = “/etc/icinga2/.ssh/id_rsa”
vars.by_ssh_logname = “root”
}

It produces this command:
‘/usr/lib/nagios/plugins/check_by_ssh’ ‘-C’ ‘find /opt/zimbra/data/postfix/spool/deferred -type f | wc -l’ ‘-H’ ‘172.26.4.3’ ‘-i’ ‘/etc/icinga2/.ssh/id_rsa’ ‘-l’ ‘root’

From the web it returns:

Plugin Output

Remote command execution failed: Host key verification failed.

But when I execute the command it works fine:

Bash Output

root@icinga:~# ‘/usr/lib/nagios/plugins/check_by_ssh’ ‘-C’ ‘find /opt/zimbra/data/postfix/spool/deferred -type f | wc -l’ ‘-H’ ‘172.26.4.3’ ‘-i’ ‘/etc/icinga2/.ssh/id_rsa’ ‘-l’ ‘root’
58
root@icinga:~#

Icinga2 version: 2.12.3-1
Icingaweb2 version: 2.8.2-2

The issue is that it doesn’t run as root. Run it as icinga and see if it still works then.