use private ip of nodes if in same aws vpc, else use public

The purpose of this PR is to allow a nagios host located in an AWS VPC to monitor hosts outside the VPC using their public IP. 

Without this, it will try to use their private IP which will not work.