# How to use subnet in hosts field of metricbeat modules

**URL:** <https://discuss.elastic.co/t/how-to-use-subnet-in-hosts-field-of-metricbeat-modules/313758>\
**Category:** Beats\
**Tags:** beats-module\
**Created:** [September 6, 2022, 7:46am UTC](https://discuss.elastic.co/t/how-to-use-subnet-in-hosts-field-of-metricbeat-modules/313758 "2022-09-06T07:46:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![maheshmotukuri](https://avatars.discourse-cdn.com/v4/letter/m/a8b319/32.png) [@maheshmotukuri](https://discuss.elastic.co/u/maheshmotukuri)\
**Post date:** [September 6, 2022, 7:46am UTC](https://discuss.elastic.co/t/how-to-use-subnet-in-hosts-field-of-metricbeat-modules/313758/1 "2022-09-06T07:46:13Z")

</div>

Would like to use subnet of hosts for collecting metrics from Prometheus exporter instead of list of IP's in hosts collection.

currently it supports

```auto
metricbeat.modules:
- module: prometheus
  period: 10s
  metricsets: ["collector"]
  hosts: ["172.0.0.7:9109"]
  metrics_path: /metrics

```

But would like to use something like below

```auto
metricbeat.modules:
# Metrics collected from a Prometheus endpoint
- module: prometheus
  period: 10s
  metricsets: ["collector"]
  hosts: ["172.0.0.0/16:9109"]
  metrics_path: /metrics

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 4, 2022, 9:46am UTC](https://discuss.elastic.co/t/how-to-use-subnet-in-hosts-field-of-metricbeat-modules/313758/2 "2022-10-04T09:46:30Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
