コード例 #1
0
ファイル: health.py プロジェクト: jr0d/mercury-agent
def system_health_inspector(device_info):
    agent_configuration = get_configuration().agent
    _health = {
        'corrected_hardware_event_count': mcelog.count_logged_events(),
        'system_uptime': cli.run('uptime -s', ignore_error=True).strip(),
        'has_errors': False,
        'errors': []
    }

    def log_error(msg):
        log.error(msg)
        _health['has_errors'] = True
        _health['errors'].append(msg)

    if (_health['corrected_hardware_event_count'] >=
            agent_configuration.hardware.mce_threshold):
        log_error(
            'Hardware event count is {} which exceeds the threshold of {}'.
            format(_health['corrected_hardware_event_count'],
                   agent_configuration.hardware.mce_threshold))

    # OEM Checks here
    _oem_details = {}
    _health['oem_details'] = _oem_details

    if platform_detection.is_hp(device_info.get('dmi', {})):
        _qc_hp(_oem_details, log_error)

    return _health
コード例 #2
0
ファイル: health.py プロジェクト: jr0d/mercury-agent
def _qc_hp(_oem_details, log_error):
    _oem_details['target'] = 'HP'
    hpasm = hpasmcli.HPASMCLI(
        get_configuration().agent.hardware.oem.hp.hpasmcli_path)
    _oem_details['server'] = hpasm.show_server()
    _oem_details['dimm'] = hpasm.show_dimm()
    _oem_details['power_supplies'] = hpasm.show_powersupply()

    for i, proc in enumerate(_oem_details['server'].get('processors', [])):
        if proc['status'] != 'Ok':
            log_error(
                'Processor {} is not in a nominal state. Reported state: {}'.
                format(i, proc['status']))

    for dimm in _oem_details.get('dimm', []):
        if dimm['status'] != 'Ok':
            log_error(
                'DIMM module {} on CPU controller {} is not in a nominal state. '
                'Reporting state: {}'.format(dimm['module_#'],
                                             dimm['processor_#'],
                                             dimm['status']))

    for i, power_supply in enumerate(_oem_details.get('power_supplies')):
        if power_supply['condition'] != 'Ok':
            log_error(
                'Power supply {} is not in a nominal state. Condition: {}'.
                format(i, power_supply['condition']))
コード例 #3
0
def get_backend_client():
    # TODO: Trying this out, 0mq says it is ok
    global __backend_client
    if not __backend_client:
        __backend_client = BackEndClient(
            get_configuration().agent.remote.backend_url)
    return __backend_client
コード例 #4
0
def add_mercury_plugin_data(press_configuration, task_id):
    temp_plugins = press_configuration.get('plugins', [])
    if 'mercury' not in temp_plugins:
        temp_plugins.append('mercury')
        press_configuration['plugins'] = temp_plugins

    press_configuration['mercury'] = {
        'task_id': task_id,
        'backend_zurl': get_configuration().agent.remote.backend_url
    }
コード例 #5
0
 def __init__(self):
     """ MegaRAID support for RAID abstraction.
     This class is using the mercury native storcli interface. The interface is very thin.
     As such, vendor_info may need a little more cleanup in comparison to SmartArray
     """
     super(MegaRAIDActions, self).__init__()
     self.storcli = Storcli(
         binary_path=get_configuration().get('agent', {}).get(
             'hardware', {}).get('raid', {}).get('storcli_path')
         or 'storcli')
コード例 #6
0
ファイル: agent.py プロジェクト: jr0d/mercury-agent
def main():
    try:
        configuration = get_configuration()
    except MercuryConfigurationError as mce:
        import sys
        print("Error in configuration: {}".format(mce), file=sys.stderr)
        sys.exit(1)

    mercury_handler = setup_logging(configuration)
    agent = Agent(configuration, mercury_handler)
    agent.run(configuration.agent.dhcp_ip_source)
コード例 #7
0
ファイル: obm.py プロジェクト: riddhi89/mercury-agent
    def probe(cls, context_data):
        """ Tests that the server is a dell variant and has a compatible DRAC
        interface

        :param context_data: DMI information
        :return:
        """
        if context_data['sys_vendor'] == 'Dell Inc.':
            simple_rac = SimpleRAC(
                get_configuration().agent.hardware.obm.racadm_path)
            if 'System Information' in simple_rac.getsysinfo:
                return True
        return False
コード例 #8
0
def press_native(**kwargs):
    press_configuration = kwargs['configuration']
    task_id = kwargs['task_id']

    mercury_configuration = get_configuration()
    add_mercury_plugin_data(press_configuration, task_id)

    backend_client = BackEndClient(
        mercury_configuration.agent.remote.backend_url)
    log.info('Starting press')
    start = time.time()
    backend_client.update_task({
        'task_id': task_id,
        'action': 'Press: Launching'
    })
    return_data = entry(press_configuration,
                        mercury_configuration.get('press', {}))
    return_data['press_execution_time'] = time.time() - start
    return return_data
コード例 #9
0
ファイル: agent.py プロジェクト: riddhi89/mercury-agent
def main():
    configuration = get_configuration()
    mercury_handler = setup_logging(configuration)
    agent = Agent(configuration, mercury_handler)
    agent.run(configuration.agent.dhcp_ip_source)
コード例 #10
0
ファイル: hp_raid.py プロジェクト: jr0d/mercury-agent
 def __init__(self):
     super(SmartArrayActions, self).__init__()
     self.hpssa = HPSSA(hpssa_path=get_configuration().get('agent', {}).get(
         'hardware', {}).get('raid', {}).get('hpssacli_path') or 'hpssacli')