Check by SSH with a local script

We have started checking some servers via ssh, and not the conventional method. we are not using the check_by_ssh method or connecting and running script installed on the remote machine. Instead, we are using this command(with ssh keys set between the servers):

ssh nagios@$HOSTADDRESS$ 'bash -s' -- < $USER1$/$ARG1$ $ARG2$

And then we are using some custom scripts to do the basic disk, mem and cpu checks. The checks have to be a script, can’t be a compiled program like the default check_mem or check_disk.