Here I tried both ways after changing the owernership. It shows the same result. I think there is something wrong with command line.
/opt/omd/sites/monitoring/local/lib/nagios/plugins/check_sophos_xg_memory.pl -H $HOSTADDRESS$