Exemple #1
0
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
Exemple #2
0
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']))
Exemple #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
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
    }
Exemple #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')
Exemple #6
0
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)
Exemple #7
0
    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
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
Exemple #9
0
def main():
    configuration = get_configuration()
    mercury_handler = setup_logging(configuration)
    agent = Agent(configuration, mercury_handler)
    agent.run(configuration.agent.dhcp_ip_source)
Exemple #10
0
 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')