Index: nodes/gformat.py
===================================================================
--- nodes/gformat.py	(revision 8318)
+++ nodes/gformat.py	(revision 8319)
@@ -28,4 +28,8 @@
     ]
 
+# Global variables uses
+OK = 0
+UNKNOWN = 1
+DOWN = 2
 
 
@@ -289,12 +293,15 @@
 
 
+def get_interface_keys(config):
+  """ Quick hack to get all interface keys, later stage convert this to a iterator """
+  return [elem for elem in config.keys() if (elem.startswith('iface_') and not "lo0" in elem)]
+
 
 def get_used_ips(configs):
     """ Return array of all IPs used in config files"""
     ip_list = []
-    for host,config in configs.iteritems():
+    for config in configs:
       ip_list.append(config['masterip'])
-      iface_keys = [elem for elem in config.keys() if (elem.startswith('iface_') and not "lo0" in elem)]
-      for iface_key in iface_keys:
+      for iface_key in get_interface_keys(config):
         l = config[iface_key]['ip']
         addr, mask = l.split('/')
Index: nodes/status-monitoring.py
===================================================================
--- nodes/status-monitoring.py	(revision 8318)
+++ nodes/status-monitoring.py	(revision 8319)
@@ -246,10 +246,35 @@
   status = stored_status['nmap_status']
 
+  # Data store format used for nodemap generation
+  nodemap_status_file = '/tmp/nodemap_status.yaml'
+  nodemap = { 'node' : {}, 'link' : {}}
+
+  # XXX: Pushed back till we actually store the MAC in the config files automatically
+  #configmac_to_host = dict()
+  #for host,config in configs.iteritems():
+  #  for iface_key in gformat.get_interface_keys(config):
+  #    configmac_to_host[config[iface_key]['mac']] = host
+
   # List of hosts which has some kind of problem
   for host in list(set(configs.keys()) - set(host_processed.keys())):
-     print "# Problem in host '%s'" % host
+     config = configs[host]
+     print "# Problems in host '%s'" % host
+     host_down = True
+     for ip in gformat.get_used_ips([config]):
+       if status[ip]['state'] == "up":
+         host_down = False
+       print "## -  ", ip, status[ip]['state']
+     if host_down:
+       print "## HOST is DOWN!"
+       nodemap['node'][host] = gformat.DOWN
+     else:
+       print "## SNMP problems (not reachable, deamon not running, etc)"
+       nodemap['node'][host] = gformat.UNKNOWN
+
+       
 
   # Correlation mapping
   for host, details in host_processed.iteritems():
+    nodemap['node'][host] = gformat.OK
     print "# Working on %s" % host
     for ip, arpmac in details['arpmac'].iteritems():
@@ -261,5 +286,9 @@
       else:
         print "## Interlink %s - %s"  % (host, mac_to_host[arpmac])
-
+        nodemap['link'][(host,mac_to_host[arpmac])] = gformat.OK
+
+  stream = file(nodemap_status_file,'w')
+  yaml.dump(nodemap, stream, default_flow_style=False)
+  print "# Wrote nodemap status to '%s'" % nodemap_status_file
 
 def usage():
@@ -310,5 +339,5 @@
   if not opt_force_range:
     configs = gformat.get_all_configs()
-    iplist = gformat.get_used_ips(configs)
+    iplist = gformat.get_used_ips(configs.values())
   else:
     iplist = sys.argv[1:]
@@ -330,4 +359,10 @@
     nmap_status = stored_status['nmap_status']
 
+  # Save the MAC -> HOST mappings, by default as it helps indentifing the
+  # 'unknown links'
+  mac_to_host = {}
+  if stored_status:
+     mac_to_host = stored_status['mac_to_host']
+
   # Do SNMP discovery
   if opt_snmp_scan:
@@ -335,4 +370,8 @@
   else:
     snmp_status = stored_status
+
+  # Include our saved MAC -> HOST mappings
+  mac_to_host.update(snmp_status['mac_to_host'])
+  snmp_status['mac_to_host'] = mac_to_host
  
   # Store changed data to disk 
