예제 #1
0
def _perform_repair_loop_report(arguments, inventory):
    """Scan the inventory for DUTs stuck in a repair loop.

    This routine walks through the given inventory looking for DUTs
    where the most recent history shows that the DUT is regularly
    passing repair tasks, but has not run any tests.

    @param arguments  Command-line arguments as returned by
                      `ArgumentParser`
    @param inventory  `_LabInventory` object to be reported on.
    """
    loop_presence = metrics.BooleanMetric(
        'chromeos/autotest/inventory/repair_loops',
        'DUTs stuck in repair loops')
    logging.info('Scanning for DUTs in repair loops.')
    for counts in inventory.itervalues():
        for history in counts.get_working_list():
            # Managed DUTs with names that don't match
            # _HOSTNAME_PATTERN shouldn't be possible.  However, we
            # don't want arbitrary strings being attached to the
            # 'dut_hostname' field, so for safety, we exclude all
            # anomalies.
            if not _HOSTNAME_PATTERN.match(history.hostname):
                continue
            if _dut_in_repair_loop(history):
                fields = {
                    'dut_hostname': history.hostname,
                    'model': history.host_model,
                    'pool': history.host_pool
                }
                logging.info(
                    'Looping DUT: %(dut_hostname)s, '
                    'model: %(model)s, pool: %(pool)s', fields)
                loop_presence.set(True, fields=fields)
예제 #2
0
    def _EmitImportanceMetric(master_config, important_configs,
                              experimental_configs):
        """Emit monarch metrics about which slave configs were important."""
        importance = {build_config: True for build_config in important_configs}
        for build_config in experimental_configs:
            importance[build_config] = False

        m = metrics.BooleanMetric(
            'chromeos/cbuildbot/master/has_important_slave',
            description='Slaves that were considered '
            'important by master.',
            field_spec=[
                ts_mon.StringField('master_config'),
                ts_mon.StringField('slave_config')
            ])
        for slave_config, is_important in importance.items():
            m.set(is_important,
                  fields={
                      'master_config': master_config,
                      'slave_config': slave_config
                  })
예제 #3
0
    start_time=_BOOT_TIME,
    description='Number of bytes up/down on interface.')
_net_packets_metric = metrics.CounterMetric(
    'dev/net/packets',
    start_time=_BOOT_TIME,
    description='Number of packets up/down on interface.')
_net_errors_metric = metrics.CounterMetric(
    'dev/net/errors',
    start_time=_BOOT_TIME,
    description='Total number of errors up/down on interface.')
_net_dropped_metric = metrics.CounterMetric(
    'dev/net/dropped',
    start_time=_BOOT_TIME,
    description='Total number of dropped packages up/down on interface.')

_net_if_isup_metric = metrics.BooleanMetric(
    'dev/net/isup', description='Whether interface is up or down.')
_net_if_duplex_metric = metrics.GaugeMetric(
    'dev/net/duplex',
    description='Whether interface supports full or half duplex.')
_net_if_speed_metric = metrics.GaugeMetric(
    'dev/net/speed', description='Network interface speed in Mb.')
_net_if_mtu_metric = metrics.GaugeMetric(
    'dev/net/mtu', description='Network interface MTU in B.')


def collect_net_info():
    """Collect network metrics."""
    _collect_net_io_duplex_counters()
    _collect_net_if_stats()
    _collect_fqdn()
    _collect_net_if_addrs()