Changeset 8321 in genesis
- Timestamp:
- Aug 12, 2010, 3:33:42 PM (14 years ago)
- Location:
- nodes
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
nodes/gformat.py
r8319 r8321 42 42 return proxylist 43 43 44 45 46 def valid_addr(addr): 47 """ Show which address is valid in which are not """ 48 return str(addr).startswith('172.') 44 49 45 50 … … 307 312 addr, mask = l.split('/') 308 313 # Special case do not process 309 if addr not in ["0.0.0.0"]:314 if not valid_addr(addr): 310 315 ip_list.append(addr) 311 316 return sorted(ip_list) -
nodes/make-map.py
r8320 r8321 152 152 try: 153 153 for host in gformat.get_hostlist(): 154 fqdn = host + ".wLeiden.NET" 154 155 print "## Processing host", host 155 156 datadump = gformat.get_yaml(host) … … 178 179 # By default assume up 179 180 node_status = "up" 180 elif status['node'][ host] == gformat.OK:181 elif status['node'][fqdn] == gformat.OK: 181 182 node_status = "up" 182 elif status['node'][ host] == gformat.DOWN:183 elif status['node'][fqdn] == gformat.DOWN: 183 184 node_status = "down" 184 elif status['node'][ host] == gformat.UNKNOWN:185 elif status['node'][fqdn] == gformat.UNKNOWN: 185 186 node_status = "unknown" 186 187 else: 187 188 assert False, "Status cannot be generated" 189 190 print "### Node status is '%s'" % node_status 188 191 f.write(""" 189 192 <description>All active nodes</description> … … 209 212 """) 210 213 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 211 217 if link_type[addr] == '11a': 212 218 weight = 2 … … 243 249 assert False, "Link status not mapped properly" 244 250 245 246 251 f.write(""" 247 252 <Placemark> -
nodes/make-network-graph.py
r8296 r8321 26 26 27 27 # 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): 31 29 continue 32 30 -
nodes/status-monitoring.py
r8319 r8321 257 257 258 258 # 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 260 265 config = configs[host] 261 266 print "# Problems in host '%s'" % host 262 267 host_down = True 263 268 for ip in gformat.get_used_ips([config]): 269 if not gformat.valid_addr(ip): 270 continue 264 271 if status[ip]['state'] == "up": 265 272 host_down = False … … 267 274 if host_down: 268 275 print "## HOST is DOWN!" 269 nodemap['node'][ host] = gformat.DOWN276 nodemap['node'][fqdn] = gformat.DOWN 270 277 else: 271 278 print "## SNMP problems (not reachable, deamon not running, etc)" 272 nodemap['node'][ host] = gformat.UNKNOWN279 nodemap['node'][fqdn] = gformat.UNKNOWN 273 280 274 281 275 282 276 283 # Correlation mapping 277 for host, details in host_processed.iteritems():278 nodemap['node'][ host] = gformat.OK279 print "# Working on %s" % host284 for fqdn, details in host_processed.iteritems(): 285 nodemap['node'][fqdn] = gformat.OK 286 print "# Working on %s" % fqdn 280 287 for ip, arpmac in details['arpmac'].iteritems(): 281 288 if arpmac in details['mac'].keys(): … … 285 292 print "## [WARN] No parent host for MAC %s (%s) found" % (arpmac, ip) 286 293 else: 287 print "## Interlink %s - %s" % ( host, mac_to_host[arpmac])288 nodemap['link'][( host,mac_to_host[arpmac])] = gformat.OK294 print "## Interlink %s - %s" % (fqdn, mac_to_host[arpmac]) 295 nodemap['link'][(fqdn,mac_to_host[arpmac])] = gformat.OK 289 296 290 297 stream = file(nodemap_status_file,'w')
Note:
See TracChangeset
for help on using the changeset viewer.