Changeset 8321 in genesis


Ignore:
Timestamp:
Aug 12, 2010, 3:33:42 PM (14 years ago)
Author:
rick
Message:

Grumble keys got confused everywhere

Location:
nodes
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • nodes/gformat.py

    r8319 r8321  
    4242  return proxylist
    4343
     44
     45
     46def valid_addr(addr):
     47  """ Show which address is valid in which are not """
     48  return str(addr).startswith('172.')
    4449
    4550
     
    307312        addr, mask = l.split('/')
    308313        # Special case do not process
    309         if addr not in ["0.0.0.0"]:
     314        if not valid_addr(addr):
    310315           ip_list.append(addr)
    311316    return sorted(ip_list)
  • nodes/make-map.py

    r8320 r8321  
    152152  try:
    153153    for host in gformat.get_hostlist():
     154      fqdn = host + ".wLeiden.NET"
    154155      print "## Processing host", host
    155156      datadump = gformat.get_yaml(host)
     
    178179        # By default assume up
    179180        node_status = "up"
    180       elif status['node'][host] == gformat.OK:
     181      elif status['node'][fqdn] == gformat.OK:
    181182        node_status = "up"
    182       elif status['node'][host] == gformat.DOWN:
     183      elif status['node'][fqdn] == gformat.DOWN:
    183184        node_status = "down"
    184       elif status['node'][host] == gformat.UNKNOWN:
     185      elif status['node'][fqdn] == gformat.UNKNOWN:
    185186        node_status = "unknown"
    186187      else:
    187188        assert False, "Status cannot be generated"
     189
     190      print "### Node status is '%s'" % node_status
    188191      f.write("""
    189192      <description>All active nodes</description>
     
    209212  """)
    210213  for addr,leden in poel.iteritems():
     214    if not gformat.valid_addr(gformat.showaddr(addr)):
     215      print "## Adres '%s' met leden '%s' ignored'" % (gformat.showaddr(addr), ','.join(leden))
     216      continue
    211217    if link_type[addr] == '11a':
    212218      weight = 2
     
    243249          assert False, "Link status not mapped properly"
    244250
    245            
    246251        f.write("""
    247252      <Placemark>
  • nodes/make-network-graph.py

    r8296 r8321  
    2626
    2727        # Not parsing of these folks please
    28         if "192.168" in addr:
    29           continue
    30         if "0.0.0.0" in addr:
     28        if not gformat.valid_addr(addr):
    3129          continue
    3230
  • nodes/status-monitoring.py

    r8319 r8321  
    257257
    258258  # List of hosts which has some kind of problem
    259   for host in list(set(configs.keys()) - set(host_processed.keys())):
     259  print host_processed.keys()
     260  print configs.keys()
     261  for host in configs.keys():
     262     fqdn = host + ".wLeiden.NET"
     263     if fqdn in host_processed.keys():
     264       continue
    260265     config = configs[host]
    261266     print "# Problems in host '%s'" % host
    262267     host_down = True
    263268     for ip in gformat.get_used_ips([config]):
     269       if not gformat.valid_addr(ip):
     270         continue
    264271       if status[ip]['state'] == "up":
    265272         host_down = False
     
    267274     if host_down:
    268275       print "## HOST is DOWN!"
    269        nodemap['node'][host] = gformat.DOWN
     276       nodemap['node'][fqdn] = gformat.DOWN
    270277     else:
    271278       print "## SNMP problems (not reachable, deamon not running, etc)"
    272        nodemap['node'][host] = gformat.UNKNOWN
     279       nodemap['node'][fqdn] = gformat.UNKNOWN
    273280
    274281       
    275282
    276283  # Correlation mapping
    277   for host, details in host_processed.iteritems():
    278     nodemap['node'][host] = gformat.OK
    279     print "# Working on %s" % host
     284  for fqdn, details in host_processed.iteritems():
     285    nodemap['node'][fqdn] = gformat.OK
     286    print "# Working on %s" % fqdn
    280287    for ip, arpmac in details['arpmac'].iteritems():
    281288      if arpmac in details['mac'].keys():
     
    285292        print "## [WARN] No parent host for MAC %s (%s) found" % (arpmac, ip)
    286293      else:
    287         print "## Interlink %s - %s"  % (host, mac_to_host[arpmac])
    288         nodemap['link'][(host,mac_to_host[arpmac])] = gformat.OK
     294        print "## Interlink %s - %s"  % (fqdn, mac_to_host[arpmac])
     295        nodemap['link'][(fqdn,mac_to_host[arpmac])] = gformat.OK
    289296
    290297  stream = file(nodemap_status_file,'w')
Note: See TracChangeset for help on using the changeset viewer.