The memory check plugin - along with such plugins as check_disk, check_procs, etc. - are what we call “local” checks. They must be run directly on the system you’re trying to monitor.
But do not worry! It is still possible to check these local resources on remote hosts. You can use a daemon, such as NRPE or NSCA, which are installed on the remote host(s) along with applicable plugins. These daemons will send the results of the checks back to your main Nagios box.
The other alternative is check_snmp, though I’ve never used it to check local resources on remote hosts.