zephir.monitor.agents.diag

Package zephir :: Package monitor :: Package agents :: Module diag |
[frames] | no frames]

# Source Code for Module zephir.monitor.agents.diag

     1  # -*- coding: UTF-8 -*-
     2  ###########################################################################
     3  # Eole NG - 2009
     4  # Copyright Pole de Competence Eole  (Ministere Education - Academie Dijon)
     5  # Licence CeCill  cf /root/LicenceEole.txt
     6  # eole@ac-dijon.fr
     7  ###########################################################################
     8
     9  """
    10  Agent diagnostic
    11  """
    12
    13  from zephir.monitor.agentmanager.agent import Agent
    14  from twisted.internet.utils import getProcessOutput
    15  from zephir.monitor.agentmanager import status
    16  from os.path import isfile
    17
    18  PROG = '/usr/share/creole/diag.py'
    19
    20 -class Diag(Agent):
    21      """
    22      Diagnostic
    23      """
    24 -    def measure(self):
    25          """ lancement du diagnostic """
    26          if isfile(PROG):
    27              res = getProcessOutput(PROG, env = {'LC_ALL': 'C'})
    28              res.addCallback(self.measure_process)
    29              return res
    30          else:
    31              return {}
    32
    33 -    def measure_process(self, result):
    34          """ retour du programme """
    35          return {}
    36
    37 -    def check_status(self):
    38          """ envoi du statut (toujours OK) """
    39          return status.OK()
    40