def uptimes(): if gangliaStats == None: return None, None g = gangliaStats() all = g.getAll() deadTimeout = 300 up, down = findUpDown(all, deadTimeout) uptime = findUptimes(all) return uptime, down
def listOfUpHosts(deadTimeout): g = gangliaStats( reportTimeOnly=1 ) all = g.getAll() up, down = findUpDown(all, deadTimeout) up.sort() # delete hosts with unreliable bmc's for u in unreliable: if u in up: up.remove(u) # sort up hosts into groups with the same prefix uplist = {} uplist[singles] = [] for u in up: # split into prefix (eg. 'x') and suffix (eg. 99) p = u.rstrip( string.digits ) s = u[len(p):] #print u, s if len(s): if s not in unreliable: if p not in uplist.keys(): uplist[p] = [] uplist[p].append(int(s)) else: if p not in unreliable: uplist[singles].append(p) #print 'uplist', uplist # find the minimal lists of ipmi sequences ipmi = [] for p, l in uplist.items(): if p != singles: c = compressList(l) if ',' in c or '-' in c: c = '[' + c + ']' ipmi.append( p + c + manSuffix ) else: for i in l: ipmi.append( i + manSuffix ) # concatenate ipmiHosts = '' for i in ipmi: ipmiHosts += i + ',' ipmiHosts = ipmiHosts[:-1] #print 'ipmiHosts', ipmiHosts return ipmiHosts, up
def listOfUpHosts(deadTimeout): g = gangliaStats(reportTimeOnly=1) all = g.getAll() up, down = findUpDown(all, deadTimeout) up.sort() # delete hosts with unreliable bmc's for u in unreliable: if u in up: up.remove(u) # sort up hosts into groups with the same prefix uplist = {} uplist[singles] = [] for u in up: # split into prefix (eg. 'x') and suffix (eg. 99) p = u.rstrip(string.digits) s = u[len(p):] #print u, s if len(s): if s not in unreliable: if p not in uplist.keys(): uplist[p] = [] uplist[p].append(int(s)) else: if p not in unreliable: uplist[singles].append(p) #print 'uplist', uplist # find the minimal lists of ipmi sequences ipmi = [] for p, l in uplist.items(): if p != singles: c = compressList(l) if ',' in c or '-' in c: c = '[' + c + ']' ipmi.append(p + c + manSuffix) else: for i in l: ipmi.append(i + manSuffix) # concatenate ipmiHosts = '' for i in ipmi: ipmiHosts += i + ',' ipmiHosts = ipmiHosts[:-1] #print 'ipmiHosts', ipmiHosts return ipmiHosts, up
def listOfUpHosts(deadTimeout): g = gangliaStats(reportTimeOnly=1) all = g.getAll() up, down = findUpDown(all, deadTimeout) up.sort() # print 'down', down # print 'up', up # delete hosts with unreliable bmc's for u in unreliable: if u in up: # print 'deleting unreliable', u up.remove(u) # sys.exit(1) return up