(metric, logger)
Parse a single metric in the `metrics` section of a config file.

    Can either be:

    * An OID metric:

    ```
    metrics:
      - OID: 1.3.6.1.2.1.2.2.1.14
        name: ifInErrors
    ```

    * A symbol metric:

    ```
    metrics:
      - MIB: IF-MIB
        symbol: ifInErrors
        # OR:
        symbol:
          OID: 1.3.6.1.2.1.2.2.1.14
          name: ifInErrors
    ```

    * A table metric (see parsing for table metrics for all possible options):

    ```
    metrics:
      - MIB: IF-MIB
        table: ifTable
        symbols:
          - OID: 1.3.6.1.2.1.2.2.1.14
            name: ifInErrors
    ```
Parse a single metric in the `metrics` section of a config file.
Parse a single metric in the metrics section of a config file .
def _parse_metric(metric, logger):
    # type: (Metric, Optional[Logger]) -> MetricParseResult
    """
    Parse a single metric in the `metrics` section of a config file.

    Can either be:

    * An OID metric:

    ```
    metrics:
      - OID: 1.3.6.1.2.1.2.2.1.14
        name: ifInErrors
    ```

    * A symbol metric:

    ```
    metrics:
      - MIB: IF-MIB
        symbol: ifInErrors
        # OR:
        symbol:
          OID: 1.3.6.1.2.1.2.2.1.14
          name: ifInErrors
    ```

    * A table metric (see parsing for table metrics for all possible options):

    ```
    metrics:
      - MIB: IF-MIB
        table: ifTable
        symbols:
          - OID: 1.3.6.1.2.1.2.2.1.14
            name: ifInErrors
    ```
    """

    if 'OID' in metric:
        metric = cast(OIDMetric, metric)
        return _parse_oid_metric(metric)

    if 'MIB' not in metric:
        raise ConfigurationError('Unsupported metric in config file: {}'.format(metric))

    if 'symbol' in metric:
        metric = cast(SymbolMetric, metric)
        return _parse_symbol_metric(metric)

    if 'table' in metric:
        if 'symbols' not in metric:
            raise ConfigurationError('When specifying a table, you must specify a list of symbols')
        metric = cast(TableMetric, metric)
        return _parse_table_metric(metric, logger)

    raise ConfigurationError('When specifying a MIB, you must specify either a table or a symbol')
def _parse_metric ( metric , logger ) : # type: (Metric, Optional[Logger]) -> MetricParseResult if 'OID' in metric : metric = cast ( OIDMetric , metric ) return _parse_oid_metric ( metric ) if 'MIB' not in metric : raise ConfigurationError ( 'Unsupported metric in config file: {}' . format ( metric ) ) if 'symbol' in metric : metric = cast ( SymbolMetric , metric ) return _parse_symbol_metric ( metric ) if 'table' in metric : if 'symbols' not in metric : raise ConfigurationError ( 'When specifying a table, you must specify a list of symbols' ) metric = cast ( TableMetric , metric ) return _parse_table_metric ( metric , logger ) raise ConfigurationError ( 'When specifying a MIB, you must specify either a table or a symbol' )