Remotechecking Services with SSH and with password

Hello everyone
I wanted to ask if its somehow possible to execute a disk_check or generally monitoring services over SSH and instead of doing it passwordless giving icinga2 the credentials for the remote-server so he can access it. I did some research and found nothing in this direction, i only found tutorials how to do it passwordless.

Best regards xl3von

Ok i found out how it should work but firstly i dont know how to implement it. But sshpass works in the command line after ive installed it but i have another problem. My by_ssh command gets created completely wrong. I get this command:
‘/usr/lib/nagios/plugins/check_by_ssh’ ‘-C’ ‘’'‘/usr/lib/nagios/plugins/check_disk’'’ ‘'’-c’'’ ‘'‘10%’'’ ‘'’-w’'’ ‘'‘20%’'’ ‘'’-p’'’ ‘'’/‘'’’ ‘-H’ ‘192.168.XXX.XXX’
And when i try to run it it says that ‘’’ isnt an executable command.

This is my template:
template Service “ssh_service” {
import “generic-service”
vars.original_check_command = check_command
check_command = “by_ssh”
vars.by_ssh_command = {{ get_check_command(service.vars.original_check_command).command }}
vars.by_ssh_arguments = {{ get_check_command(service.vars.original_check_command).arguments }}


This is my service:

apply Service “Disk-SSH”{
check_command = “disk”
import “ssh_service”
vars.disk_partition = “/”
vars.disk_cfree = “10%”
vars.disk_wfree = “20%”

assign where “myservers” in host.vars.functions
Could someone tell me what i did wrong?
Thank you in advance

maybe you want to check the docs? Agent Based Monitoring - Icinga 2
and / or the blogpost check_by_ssh mit Icinga 2 - NETWAYS GmbH

Thank you for you reply but i already found out how i can do it.