<commit_before># Prometheus SNMP Exporter

This an exporter that exposes information gathered from SNMP
for use by the Prometheus monitoring system.

## Installation

```
pip install snmp_exporter
```

You may need to also install the `python-dev` package on Debian/Ubuntu systems,
as some depenancies require it.

## Usage

```
snmp_exporter config_file [port]
```

`config` contains what OIDs to scrape and how to process them, see examples
in the `example_configs` directory. `port` defaults to 9116.

Visit http://localhost:9116/metrics?address=1.2.3.4 where 1.2.3.4 is the IP of the
SNMP device to get metrics from.

## Prometheus Configuration

The snmp exporter needs to be passed the address as a parameter.

Example config:
```
scrape_config:
  - job_name: 'snmp'
    target_groups:
      - targets:
        - 192.168.1.2  # SNMP device.
    relabel_configs:
      - source_labels: [__address__]
        regex: (.*):80
        target_label: __param_address
        replacement: ${1}
      - source_labels: [__param_address]
        regex: (.*)
        target_label: instance
        replacement: ${1}
      - source_labels: []<commit_msg>tweak<commit_after># Prometheus SNMP Exporter

This an exporter that exposes information gathered from SNMP
for use by the Prometheus monitoring system.

## Installation

```
pip install snmp_exporter
```

You may need to also install the `python-dev` package on Debian/Ubuntu systems,
as some depenancies require it.

## Usage

```
snmp_exporter config_file [port]
```

`config` contains what OIDs to scrape and how to process them, see examples
in the `example_configs` directory. `port` defaults to 9116.

Visit http://localhost:9116/metrics?address=1.2.3.4 where 1.2.3.4 is the IP of the
SNMP device to get metrics from.

## Prometheus Configuration

The snmp exporter needs to be passed the address as a parameter, this can be
done with relabelling.

Example config:
```
scrape_config:
  - job_name: 'snmp'
    target_groups:
      - targets:
        - 192.168.1.2  # SNMP device.
    relabel_configs:
      - source_labels: [__address__]
        regex: (.*):80
        target_label: __param_address
        replacement: ${1}
      - source_labels: [__param_address]
        regex: (.*)
        target_label: instance
        replacement: ${1}
      - source_labels: []
{'fraction_non_alphanumeric': 0.0926324859974149, 'fraction_numerical': 0.024127531236535976, 'mean_word_length': 3.2605504587155965, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6357039', 'n_tokens_mistral': 770, 'n_tokens_neox': 711, 'n_words': 250}