version 1.3, 2005/05/15 10:46:29
|
version 1.4, 2005/05/15 11:02:01
|
Line 7 import os.path
|
Line 7 import os.path
|
import time |
import time |
|
|
module_list=['11150','11220','11240','11340','12010','13110','13210','13310','13500','20610','21210','21600','22310','23110','24110','24212','24231','24241','24251','24321','24341','24411','24421','24431','24441','24511','24521','30511','31111','31120','31131','31142','31151','31161','31171','31211','31221','31231','31252','31305','31410','32010','33100'] |
module_list=['11150','11220','11240','11340','12010','13110','13210','13310','13500','20610','21210','21600','22310','23110','24110','24212','24231','24241','24251','24321','24341','24411','24421','24431','24441','24511','24521','30511','31111','31120','31131','31142','31151','31161','31171','31211','31221','31231','31252','31305','31410','32010','33100'] |
grepString="DragThing" |
grepString="firefox-bin" |
|
|
def zptFile(self, path, orphaned=False): |
def zptFile(self, path, orphaned=False): |
"""returns a page template file from the product""" |
"""returns a page template file from the product""" |
Line 44 def checkFormat(line,formats):
|
Line 44 def checkFormat(line,formats):
|
except: |
except: |
return False |
return False |
|
|
|
def getIP(line): |
|
"""ip aus pound log line""" |
|
splitted=line.split() |
|
try: |
|
return splitted[5] |
|
except: |
|
return 0 |
|
|
def cmpLine(line): |
def cmpLine(line): |
"""gibt minuten zwischen letztem Eintrag und localtime""" |
"""gibt minuten zwischen letztem Eintrag und localtime""" |
|
|
Line 106 class checkStation(SimpleItem):
|
Line 114 class checkStation(SimpleItem):
|
return True,"",0 |
return True,"",0 |
|
|
cmpT=cmpLine(line) |
cmpT=cmpLine(line) |
|
ip=getIP(line) |
|
|
if not checkFormat(line,formats): |
if not checkFormat(line,formats): |
# teste ob letzte Zeile vom format in formats |
# teste ob letzte Zeile vom format in formats |
|
|
return True,line,cmpT |
return True,line,cmpT,ip |
|
|
|
|
if cmpT > time: |
if cmpT > time: |
return False,line,cmpT |
return False,line,cmpT,ip |
|
|
else: |
else: |
return True,line,cmpT |
return True,line,cmpT,ip |
|
|
def getModuls(self): |
def getModuls(self): |
"""getModuls""" |
"""getModuls""" |
Line 131 class checkStation(SimpleItem):
|
Line 140 class checkStation(SimpleItem):
|
|
|
ips={"22222":"127.0.0.1","33335":"127.0.0.2"} |
ips={"22222":"127.0.0.1","33335":"127.0.0.2"} |
|
|
def rebootStation(self,modul): |
def rebootStation(self,ip): |
"""neustart""" |
"""neustart""" |
retStr="" |
retStr="" |
ip=self.ips[modul] |
#ip=self.ips[modul] |
|
|
str="""ssh root@%s "ps -xa | grep %s" """ |
str="""ssh root@%s "ps -xa | grep %s" """ |
rets=os.popen(str%(ip,grepString)).readlines() |
rets=os.popen(str%(ip,grepString)).readlines() |
Line 158 class checkStation(SimpleItem):
|
Line 167 class checkStation(SimpleItem):
|
checked=self.checkStation(modul,time=timer,formats=["VID"]) |
checked=self.checkStation(modul,time=timer,formats=["VID"]) |
if not checked[0]: |
if not checked[0]: |
|
|
ret+=self.rebootStation(modul) |
ret+=self.rebootStation(checked[3]) |
if not hasattr(self,'modulOverview'): |
if not hasattr(self,'modulOverview'): |
setattr(self,'modulOverview',{}) |
setattr(self,'modulOverview',{}) |
self.modulOverview[modul]=time.localtime() |
self.modulOverview[modul]=time.localtime() |
|
|
|
return ret |
|
|
def rebootOverview(self): |
def rebootOverview(self): |
"""give Overview""" |
"""give Overview""" |