From 2fa5dbdb323f55e3c9831614f9ec8f606a157852 Mon Sep 17 00:00:00 2001 From: Joey Hagedorn Date: Tue, 21 Jun 2005 20:52:39 +0000 Subject: removed some extraneous code (Logical change 1.234) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@979 ce84e21b-d406-0410-9b95-82705330c041 --- src/sbin/StatReports.py | 121 ------------------------------------------------ 1 file changed, 121 deletions(-) (limited to 'src') diff --git a/src/sbin/StatReports.py b/src/sbin/StatReports.py index ccd271b9b..72aa57730 100644 --- a/src/sbin/StatReports.py +++ b/src/sbin/StatReports.py @@ -148,127 +148,6 @@ def mail(reportsections,delivery,deliverytype): mailer.sendmail(fromaddr,toaddr,msg) mailer.quit() -## for machine in report.findall('Machine'): -## for node in statdata.findall('Node'): -## if node.attrib['name'] == machine.attrib['name']: -## if deliverytype == 'nodes-digest': -## mheader="Machine: %s\n"%machine.attrib['name'] -## for stats in node.findall('Statistics'): -## if stats.attrib['state'] == 'clean' and current_date in stats.attrib['time']: -## clean += "%s\n"%machine.attrib['name'] -## if report.attrib['modified'] == 'Y':#replace this with get -## for modxml in stats.findall('Modified'): -## if current_date in stats.attrib['time']: -## modified+="\n%s\n"%tostring(modxml) -## for bad in stats.findall('Bad'): -## srtd = bad.findall('*') -## srtd.sort(lambda x,y:cmp(tostring(x),tostring(y))) -## strongbad = Element("Bad") -## map(lambda x:strongbad.append(x),srtd) -## baddata+="Time Ran:%s\n%s\n"%(stats.attrib['time'],tostring(strongbad)) -## dirty+="%s\n"%machine.attrib['name'] -## strongbad = '' - -## if delivery.attrib['type'] == 'nodes-individual':#replace this with get -## for destination in delivery.findall('Destination'): -## toaddr=destination.attrib['address'] - -## if baddata != '': -## msg="To: %s\nFrom: %s\nSubject: %s: Bcfg Nightly Errors\n\n%s%s"%(toaddr,fromaddr,machine.attrib['name'], modified, baddata) -## else: -## if report.attrib['good'] == 'Y': -## msg="To: %s\nFrom: %s\nSubject: %s: Bcfg Nightly Good\n\n"%(toaddr,fromaddr,machine.attrib['name']) -## mailer.sendmail(fromaddr,toaddr,msg) -## baddata='' -## msg='' -## modified='' -## else: -## if not (modified == '' and baddata == ''): -## msg += "%s %s %s\n"%(mheader,modified,baddata) -## baddata='' -## modified='' - -## if delivery.attrib['type'] == 'nodes-digest': -## for destination in delivery.findall('Destination'): -## toaddr=destination.attrib['address'] -## if msg != '': -## msg="To: %s\nFrom: %s\nSubject: Bcfg Nightly Errors\n\n\nDIRTY:\n%s\nCLEAN:\n%s\nDETAILS:\n%s"%(toaddr,fromaddr,dirty,clean, msg) -## else: -## if user.attrib['good'] == 'Y': -## msg="To: %s\nSubject: Bcfg Nightly All Machines Good\n\n"%(toaddr) -## mailer.sendmail(fromaddr,toaddr,msg) - -## if delivery.attrib['type'] == 'overview-stats': -## statmsg='' -## children = statdata.findall("Node") -## regex = string.join(map(lambda x:x.get("name"), report.findall('Machine')),'|') -## p = re.compile(regex) -## childstates = [] -## for child in children: -## if p.match(child.get("name")): -## child.states = [] -## for state in child.findall("Statistics"): -## child.states.append((child.get("name"),state.get("state"),state.get("time"))) -## if child.states != []: -## #child.states.sort(lambda y,x:cmp(strptime(x[2]),strptime(y[2]))) -## childstates.append(child.states[len(child.states)-1]) -## childstates.sort(lambda x,y:cmp(x[0],y[0])) - -## staleones,cleanones,dirtyones,unpingableones=[] - -## for instance in childstates: -## if instance[1]=="dirty": -## dirtyones.append(instance) -## elif instance[1]=="clean": -## cleanones.append(instance) -## if strptime(instance[2])[0]!=strptime(ctime())[0] \ -## or strptime(instance[2])[1]!=strptime(ctime())[1] \ -## or strptime(instance[2])[2]!=strptime(ctime())[2]: -## staleones.append(instance) - -## if staleones != []: -## print "Pinging hosts that didn't run today. Please wait" -## for instance in staleones: -## if os.system( 'ping -c 1 '+instance[0]+'.mcs.anl.gov &>/dev/null'): -## staleones.remove(instance) -## unpingableones.append(instance) - -## statmsg+="SUMMARY INFORMATION:\n" -## statmsg+="Up & Not Running Nightly: %d\n"%len(staleones) -## statmsg+="Unpingable: %d\n"%len(unpingableones) -## statmsg+="Dirty: %d\n"%len(dirtyones) -## statmsg+="Clean: %d\n"%len(cleanones) -## statmsg+="---------------------------------\n" -## total=len(cleanones)+len(dirtyones) -## statmsg+="Total: %d\n\n\n"%len(childstates) - -## statmsg+="\n UP AND NOT RUNNING NIGHTLY:\n" -## for one in staleones: -## statmsg+=one[0]+".mcs.anl.gov\n" -## statmsg+="\nDIRTY:\n" -## for one in dirtyones: -## statmsg+=one[0]+".mcs.anl.gov\n" -## statmsg+="\nCLEAN:\n" -## for one in cleanones: -## statmsg+=one[0]+".mcs.anl.gov\n" -## statmsg+="\nUNPINGABLE:\n" -## for one in unpingableones: -## statmsg+=one[0]+".mcs.anl.gov\n" - -## #print "%s"%msg -## for destination in delivery.findall('Destination'): -## toaddr=destination.attrib['address'] -## msg="To: %s\nFrom: %s\nSubject: Bcfg Nightly Errors\n\n\n%s"%(toaddr,fromaddr,statmsg) -## mailer.sendmail(fromaddr,toaddr,msg) -## baddata='' -## modified='' -## msg='' -## clean = '' -## dirty = '' -## mailer.quit() - - - def rss(reportsections,delivery,deliverytype): -- cgit v1.2.3-1-g7c22