getMonitorDistance function