diff --git a/pelab/monitor/gen-ip-mapping.pl b/pelab/monitor/gen-ip-mapping.pl
index c82ef522a9c6bd46f31d4a00e7d8f2836d79f073..ceb7d215c4577c126a0d989b8cba73ba4114dc38 100644
--- a/pelab/monitor/gen-ip-mapping.pl
+++ b/pelab/monitor/gen-ip-mapping.pl
@@ -15,7 +15,7 @@ my %opt;
 getopts('p',\%opt);
 
 use strict;
-my (%elabips, %plabips);
+my (%elabips, %plabips, %planetnodes);
 
 open(HOSTS,"/etc/hosts") or die "Unable to open /etc/hosts: $!\n";
 
@@ -26,6 +26,10 @@ while (<HOSTS>) {
         $elabips{$1} = $IP;
     } elsif ($firstname =~ /^(.+)-(plink|plan|pcloud|plabc)$/) {
         $plabips{$1} = $IP;
+    } elsif ($firstname =~ /^(.+)-realinternet$/) {
+        # Note - we don't really get the planetlab node's IP address in the
+        # hosts file, so we just use this to find out if the node exists at all
+        $planetnodes{$1} = 1;
     }
 }
 
@@ -47,11 +51,18 @@ foreach my $elabnode (keys %elabips) {
         print "$elabips{$elabnode} $plabips{$planetnode} elabc-$elabnode\n";
         $lines_output++;
     } else {
+        # If there is not a corresponding planet-* node in the hosts file, it
+        # has probably been removed from the experiment, and we should skip ip
+        my $plabnode = $elabnode;
+        $plabnode =~ s/^elab/planet/;
+        if (! exists($planetnodes{$plabnode})){
+            warn "Skipping $plabnode, which doesn't exist\n";
+            next;
+        }
         # Let's hope this is an experiment with a real (not emulated) planetlab
         # half. Note - this should be run by something that has sourced
-        # common-env.sh so that these are set
-        my $plabhostname = "$elabnode.$ENV{EXPERIMENT}.$ENV{PROJECT}.emulab.net";
-        $plabhostname =~ s/^elab/planet/;
+        # common-env.sh so that these enviroment variables are set
+        my $plabhostname = "$plabnode.$ENV{EXPERIMENT}.$ENV{PROJECT}.emulab.net";
         # Find out the IP address for $plabhostname
         open(H,"host $plabhostname |") or die "Unable to run host\n";
         # Yuck. Why can't 'host' have a flag to spit out just the IP?