Diff for /checkStation/checkStation.py between versions 1.1 and 1.2

version 1.1, 2005/05/15 08:35:00 version 1.2, 2005/05/15 10:04:27
Line 6  import os Line 6  import os
 import os.path  import os.path
 import time  import time
   
 module_list=['33335','22222','ff']  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="DragThing"
   
 def zptFile(self, path, orphaned=False):  def zptFile(self, path, orphaned=False):
Line 30  def getLastLine(lines): Line 30  def getLastLine(lines):
   
 def checkFormat(line,formats):  def checkFormat(line,formats):
     """checke formats"""      """checke formats"""
       
     splitted=line.split("GET")      splitted=line.split("GET")
     splitted=splitted[1].split()      splitted=splitted[1].split()
       
     splitted2=splitted[0].split("/")      splitted2=splitted[0].split("/")
   
       try:
     if splitted2[4][0:3] in formats:      if splitted2[4][0:3] in formats:
         return True          return True
     else:      else:
         return False          return False
       except:
           return False
   
 def cmpLine(line):  def cmpLine(line):
     """gibt minuten differenz der letzen beiden eintraege"""      """gibt minuten zwischen letztem Eintrag und localtime"""
   
       # Z2.log
       ## tmp=line.split("[")
   ##     tmp=tmp[1].split("]")
           
     tmp=line.split("[")  ##     timestr=tmp[0]
     tmp=tmp[1].split("]")      
   ##     
   
       #pound log
       tmp=line.split()
       timestr=tmp[2]
           
     timestr=tmp[0]  
           
     split=timestr.split(":")      split=timestr.split(":")
     time1=int(split[1])*60+int(split[2])      time1=int(split[0])*60+int(split[1])
   
     localtime=time.asctime(time.localtime())      localtime=time.asctime(time.localtime())
       
     split=localtime.split(":")      split=localtime.split(":")
     time2=int(split[0].split()[3])*60+int(split[1])      time2=int(split[0].split()[3])*60+int(split[1])
   
Line 64  class checkStation(SimpleItem): Line 76  class checkStation(SimpleItem):
   
     meta_type="check Media Stations"      meta_type="check Media Stations"
   
       manage_options=SimpleItem.manage_options+(
           {'label':'Overview Stations','action':'overviewStations'},
                   {'label':'change check','action':'changeCheckStationForm'},
                   {'label':'checkRebootDead','action':'checkRebootDead'},
           )
     def asctime(self):      def asctime(self):
         return time.asctime(tm)          return time.asctime(tm)
                   
Line 115  class checkStation(SimpleItem): Line 132  class checkStation(SimpleItem):
           
     def rebootStation(self,modul):      def rebootStation(self,modul):
         """neustart"""          """neustart"""
           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" """
Line 125  class checkStation(SimpleItem): Line 143  class checkStation(SimpleItem):
             if ret.find("grep") <= 0:              if ret.find("grep") <= 0:
                 process=ret.split()[0]                  process=ret.split()[0]
                 str="""ssh root@%s kill -9 %s """                  str="""ssh root@%s kill -9 %s """
                 rets=os.popen(str%(ip,process)).readlines()                  #os.popen(str%(ip,process)).readlines()
                 print "WW",str%(ip,process)                  retStr+=str%(ip,process) + "/n"
           return retStr
                   
     def checkRebootDead(self,timer=5):      def checkRebootDead(self,timer=5):
         """checks and reboots non responding firefox"""          """checks and reboots non responding firefox"""
         self.lastCheck=time.localtime()          self.lastCheck=time.localtime()
           ret=""
                   
         for modul in self.getModuls():          for modul in self.getModuls():
   
             checked=self.checkStation(modul,time=timer,formats=["VID"])              checked=self.checkStation(modul,time=timer,formats=["VID"])
             if not checked[0]:              if not checked[0]:
   
                 self.rebootStation(modul)                  ret+=self.rebootStation(modul)
                 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()

Removed from v.1.1  
changed lines
  Added in v.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>