Changeset 8332 in genesis


Ignore:
Timestamp:
Aug 12, 2010, 9:50:46 PM (14 years ago)
Author:
rick
Message:
  • SNMP got not forced
  • IP valid checking was not going for the right IPS
Location:
nodes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • nodes/get-network-status.py

    r8328 r8332  
    131131
    132132
    133 def do_snmp_scan(iphosts, status, stored_status=dict()):
     133def do_snmp_scan(iphosts, status, stored_status=dict(), forced_scan=False):
    134134  """ SNMP scanning, based on results fould in NMAP scan"""
    135135  mac_to_host = dict()
     
    156156    status[host]['iface'] = dict()
    157157    try:
    158       if stored_status[host]['snmp_retval'] != 0:
     158      if not forced_scan and stored_status[host]['snmp_retval'] != 0:
    159159        print "## SNMP Connect failed last time, ignoring"
    160160        continue
     
    231231      print "## Arp table MAC %s -> %s %s" % (ip, mac, local)
    232232 
    233     # Make sure we keep a record of the processed host
    234     host_processed[hostname] = status[host]
     233    # Make sure we keep a record of the processed host which ip entry to check
     234    host_processed[hostname] = host
    235235
    236236  stored_status['host_processed'] = host_processed
     
    282282
    283283  # Correlation mapping
    284   for fqdn, details in host_processed.iteritems():
     284  for fqdn, ip in host_processed.iteritems():
     285    details = status[ip]
    285286    nodemap['node'][fqdn] = gformat.OK
    286287    print "# Working on %s" % fqdn
     
    386387  # Do SNMP discovery
    387388  if opt_snmp_scan:
    388     snmp_status = do_snmp_scan(iplist, nmap_status, stored_status)
     389    snmp_status = do_snmp_scan(iplist, nmap_status, stored_status, opt_force_snmp)
    389390  else:
    390391    snmp_status = stored_status
  • nodes/gformat.py

    r8323 r8332  
    312312        addr, mask = l.split('/')
    313313        # Special case do not process
    314         if not valid_addr(addr):
    315            ip_list.append(addr)
     314        if valid_addr(addr):
     315          ip_list.append(addr)
     316        else:
     317          print "## IP '%s' in '%s' not valid" % (addr, config['nodename'])
    316318    return sorted(ip_list)
    317319
Note: See TracChangeset for help on using the changeset viewer.