Beispiel #1
0
def main():
  Script.disableCS()
  Script.parseCommandLine()
  args = Script.getPositionalArgs()

  from DIRAC.FrameworkSystem.Client.ComponentInstaller import gComponentInstaller

  __RCSID__ = "$Id$"

  if len(args) > 2:
    Script.showHelp(exitCode=1)

  system = '*'
  component = '*'
  if len(args) > 0:
    system = args[0]
  if system != '*':
    if len(args) > 1:
      component = args[1]
  #
  gComponentInstaller.exitOnError = True
  #
  result = gComponentInstaller.getStartupComponentStatus([system, component])
  if not result['OK']:
    print('ERROR:', result['Message'])
    exit(-1)

  gComponentInstaller.printStartupStatus(result['Value'])
Beispiel #2
0
    def __storeProfiling():
        """
    Retrieves and stores into ElasticSearch profiling information about the components on the host
    """
        # TODO: if we have a component which is not running, we will not profile the running processes
        result = gComponentInstaller.getStartupComponentStatus([])
        if not result['OK']:
            gLogger.error(result['Message'])
            return S_ERROR(result['Message'])
        startupComps = result['Value']

        result = gComponentInstaller.getSetupComponents()
        if not result['OK']:
            gLogger.error(result['Message'])
            return S_ERROR(result['Message'])
        setupComps = result['Value']

        # Get the profiling information for every running component and send it to MonitoringSystem
        for cType in setupComps:
            for system in setupComps[cType]:
                for comp in setupComps[cType][system]:
                    instance = "%s_%s" % (system, comp)
                    if instance not in startupComps:
                        gLogger.error("Wrongly configured component: %s" %
                                      instance)
                        continue
                    pid = startupComps[instance]['PID']
                    if pid not in gProfilers:
                        gProfilers[pid] = Profiler.Profiler(pid)
                    profiler = gProfilers[pid]
                    result = profiler.getAllProcessData()
                    if result['OK']:
                        log = result['Value']['stats']
                        log['host'] = socket.getfqdn()
                        log['component'] = instance
                        log['timestamp'] = result['Value']['datetime']
                        gMonitoringReporter.addRecord(log)
                    else:
                        gLogger.error(result['Message'])
                        return result
        gMonitoringReporter.commit()
        return S_OK('Profiling information logged correctly')
  def __storeProfiling():
    """
    Retrieves and stores into ElasticSearch profiling information about the components on the host
    """
    # TODO: if we have a component which is not running, we will not profile the running processes
    result = gComponentInstaller.getStartupComponentStatus([])
    if not result['OK']:
      gLogger.error(result['Message'])
      return S_ERROR(result['Message'])
    startupComps = result['Value']

    result = gComponentInstaller.getSetupComponents()
    if not result['OK']:
      gLogger.error(result['Message'])
      return S_ERROR(result['Message'])
    setupComps = result['Value']

    # Get the profiling information for every running component and send it to MonitoringSystem
    for cType in setupComps:
      for system in setupComps[cType]:
        for comp in setupComps[cType][system]:
          instance = "%s_%s" % (system, comp)
          if instance not in startupComps:
            gLogger.error("Wrongly configured component: %s" % instance)
            continue
          pid = startupComps[instance]['PID']
          if pid not in gProfilers:
            gProfilers[pid] = Profiler.Profiler(pid)
          profiler = gProfilers[pid]
          result = profiler.getAllProcessData()
          if result['OK']:
            log = result['Value']['stats']
            log['host'] = socket.getfqdn()
            log['component'] = instance
            log['timestamp'] = result['Value']['datetime']
            gMonitoringReporter.addRecord(log)
          else:
            gLogger.error(result['Message'])
            return result
    gMonitoringReporter.commit()
    return S_OK('Profiling information logged correctly')
Beispiel #4
0
def main():
  cliParams = Params()

  Script.disableCS()
  Script.registerSwitch(
      "e",
      "exitOnError",
      "flag to exit on error of any component installation",
      cliParams.setExitOnError)

  Script.addDefaultOptionValue('/DIRAC/Security/UseServerCertificate', 'yes')
  Script.addDefaultOptionValue('LogLevel', 'INFO')
  Script.parseCommandLine()
  args = Script.getExtraCLICFGFiles()

  if len(args) > 1:
    Script.showHelp(exitCode=1)

  cfg = None
  if len(args):
    cfg = args[0]
  from DIRAC.FrameworkSystem.Client.ComponentInstaller import gComponentInstaller

  gComponentInstaller.exitOnError = cliParams.exitOnError

  result = gComponentInstaller.setupSite(Script.localCfg, cfg)
  if not result['OK']:
    print("ERROR:", result['Message'])
    exit(-1)

  result = gComponentInstaller.getStartupComponentStatus([])
  if not result['OK']:
    print('ERROR:', result['Message'])
    exit(-1)

  print("\nStatus of installed components:\n")
  result = gComponentInstaller.printStartupStatus(result['Value'])
  if not result['OK']:
    print('ERROR:', result['Message'])
    exit(-1)
def main():
    Script.disableCS()
    # Registering arguments will automatically add their description to the help menu
    Script.registerArgument(
        " System:  Name of the system for the component (default *: all)", mandatory=False, default="*"
    )
    Script.registerArgument(
        (
            "Service: Name of the particular component (default *: all)",
            "Agent:   Name of the particular component (default *: all)",
        ),
        mandatory=False,
        default="*",
    )
    _, args = Script.parseCommandLine()
    system, component = Script.getPositionalArgs(group=True)

    from DIRAC.FrameworkSystem.Client.ComponentInstaller import gComponentInstaller

    __RCSID__ = "$Id$"

    if len(args) > 2:
        Script.showHelp(exitCode=1)

    if len(args) > 0:
        system = args[0]
    if system != "*":
        if len(args) > 1:
            component = args[1]
    #
    gComponentInstaller.exitOnError = True
    #
    result = gComponentInstaller.getStartupComponentStatus([system, component])
    if not result["OK"]:
        print("ERROR:", result["Message"])
        exit(-1)

    gComponentInstaller.printStartupStatus(result["Value"])
Beispiel #6
0
 def export_getStartupComponentStatus(self, componentTupleList):
     """  Get the list of all the components ( services and agents )
      set up for running with runsvdir in startup directory
 """
     return gComponentInstaller.getStartupComponentStatus(
         componentTupleList)
Beispiel #7
0
 def export_getStartupComponentStatus( self, componentTupleList ):
   """  Get the list of all the components ( services and agents )
        set up for running with runsvdir in startup directory
   """
   return gComponentInstaller.getStartupComponentStatus( componentTupleList )
                                     '  system:        Name of the system for the component (default *: all)',
                                     '  service|agent: Name of the particular component (default *: all)' ] ) )
Script.parseCommandLine()
args = Script.getPositionalArgs()

from DIRAC.FrameworkSystem.Client.ComponentInstaller import gComponentInstaller


__RCSID__ = "$Id$"

if len( args ) > 2:
  Script.showHelp()
  exit( -1 )

system = '*'
component = '*'
if len( args ) > 0:
  system = args[0]
if system != '*':
  if len( args ) > 1:
    component = args[1]
#
gComponentInstaller.exitOnError = True
#
result = gComponentInstaller.getStartupComponentStatus( [system, component] )
if not result['OK']:
  print 'ERROR:', result['Message']
  exit( -1 )

gComponentInstaller.printStartupStatus( result['Value'] )
Beispiel #9
0
    'Arguments:',
    '  system:        Name of the system for the component (default *: all)',
    '  service|agent: Name of the particular component (default *: all)'
]))
Script.parseCommandLine()
args = Script.getPositionalArgs()

from DIRAC.FrameworkSystem.Client.ComponentInstaller import gComponentInstaller

__RCSID__ = "$Id$"

if len(args) > 2:
    Script.showHelp(exitCode=1)

system = '*'
component = '*'
if len(args) > 0:
    system = args[0]
if system != '*':
    if len(args) > 1:
        component = args[1]
#
gComponentInstaller.exitOnError = True
#
result = gComponentInstaller.getStartupComponentStatus([system, component])
if not result['OK']:
    print('ERROR:', result['Message'])
    exit(-1)

gComponentInstaller.printStartupStatus(result['Value'])
Beispiel #10
0
Script.addDefaultOptionValue('/DIRAC/Security/UseServerCertificate', 'yes')
Script.addDefaultOptionValue('LogLevel', 'INFO')
Script.parseCommandLine()
args = Script.getExtraCLICFGFiles()
#
if len(args) > 1:
  Script.showHelp(exitCode=1)
#
cfg = None
if len(args):
  cfg = args[0]
from DIRAC.FrameworkSystem.Client.ComponentInstaller import gComponentInstaller
#
gComponentInstaller.exitOnError = cliParams.exitOnError
#
result = gComponentInstaller.setupSite(Script.localCfg, cfg)
if not result['OK']:
  print("ERROR:", result['Message'])
  exit(-1)
#
result = gComponentInstaller.getStartupComponentStatus([])
if not result['OK']:
  print('ERROR:', result['Message'])
  exit(-1)

print("\nStatus of installed components:\n")
result = gComponentInstaller.printStartupStatus(result['Value'])
if not result['OK']:
  print('ERROR:', result['Message'])
  exit(-1)
Beispiel #11
0
Script.addDefaultOptionValue( 'LogLevel', 'INFO' )
Script.parseCommandLine()
args = Script.getExtraCLICFGFiles()
#
if len( args ) > 1:
  Script.showHelp()
  exit( -1 )
#
cfg = None
if len( args ):
  cfg = args[0]
from DIRAC.FrameworkSystem.Client.ComponentInstaller import gComponentInstaller
#
gComponentInstaller.exitOnError = cliParams.exitOnError
#
result = gComponentInstaller.setupSite( Script.localCfg, cfg )
if not result['OK']:
  print "ERROR:", result['Message']
  exit( -1 )
#
result = gComponentInstaller.getStartupComponentStatus( [] )
if not result['OK']:
  print 'ERROR:', result['Message']
  exit( -1 )

print "\nStatus of installed components:\n"
result = gComponentInstaller.printStartupStatus( result['Value'] )
if not result['OK']:
  print 'ERROR:', result['Message']
  exit( -1 )