# Metricbeat single run

**URL:** <https://discuss.elastic.co/t/metricbeat-single-run/292721>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [December 22, 2021, 4:51pm UTC](https://discuss.elastic.co/t/metricbeat-single-run/292721 "2021-12-22T16:51:14Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tobias\_c](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tobias_c/32/99449_2.png) [@tobias\_c](https://discuss.elastic.co/u/tobias_c)\
**Post date:** [December 22, 2021, 4:51pm UTC](https://discuss.elastic.co/t/metricbeat-single-run/292721/1 "2021-12-22T16:51:14Z")

</div>

Hi all  
Is it possible to let run metricbeat once and then terminate? So the service (everlasting process) is not wanted.  
Thanks  
Tobias

---

<div class="post-metadata">

**Author:** ![AquaX](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aquax/32/92006_2.png) [@AquaX](https://discuss.elastic.co/u/AquaX)\
**Post date:** [December 22, 2021, 7:49pm UTC](https://discuss.elastic.co/t/metricbeat-single-run/292721/2 "2021-12-22T19:49:25Z")

</div>

What do you mean by "run once"? Metricbeat continually grabs data.  
If you want you could write a simple script that starts the service...waits for x amount of time and then stops the service.

---

<div class="post-metadata">

**Author:** ![tobias\_c](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tobias_c/32/99449_2.png) [@tobias\_c](https://discuss.elastic.co/u/tobias_c)\
**Post date:** [December 22, 2021, 10:05pm UTC](https://discuss.elastic.co/t/metricbeat-single-run/292721/3 "2021-12-22T22:05:18Z")

</div>

Yes that's the thing i need: grab data once and then terminate instead of running metricbeat continually.

If i start the service and stop it after x seconds with the script.. how big could x be?

Alternative to a fix waiting time, are there any signs that metricbeat is not just grabbing data? E.g. number of active java processes on OS level or something like that? I think I will try to find special log entries...

---

<div class="post-metadata">

**Author:** ![AquaX](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aquax/32/92006_2.png) [@AquaX](https://discuss.elastic.co/u/AquaX)\
**Post date:** [December 23, 2021, 2:19pm UTC](https://discuss.elastic.co/t/metricbeat-single-run/292721/4 "2021-12-23T14:19:42Z")

</div>

You could setup a [rate\_limit](https://www.elastic.co/guide/en/beats/metricbeat/master/rate-limit.html) processor and set it to a large enough value so that it only sends the data once and then the script that is running terminates before the processor schedule kicks in again.

I have not tried this before but playing around with that may work. However, there is no built in startup once and shutdown option.

---

<div class="post-metadata">

**Author:** ![tobias\_c](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tobias_c/32/99449_2.png) [@tobias\_c](https://discuss.elastic.co/u/tobias_c)\
**Post date:** [December 23, 2021, 11:00pm UTC](https://discuss.elastic.co/t/metricbeat-single-run/292721/5 "2021-12-23T23:00:50Z")

</div>

Also a nice idea, thanks a lot.

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [December 24, 2021, 6:29pm UTC](https://discuss.elastic.co/t/metricbeat-single-run/292721/6 "2021-12-24T18:29:03Z")

</div>

@tobias_c

Why not just set the collection period to say 10m... Then it would collect once and you could stop the service before the 10m was up.

Sometimes when I see questions like this I'm not sure exactly what you're trying to accomplish.

Sometimes it helps if you just state it as I can use your story.

"As an SRE, I'd like collect the infrastructure data once so that I can get a quick check of the health of the host."

If you're really trying to just determine whether a host is up and available and some processes were running, There may be some other ways.

And yes, you can actually create an alert if metricBeat stop sending data That assumes metricbeat is running.

You can pare down metricbeat Data to be very small

So it's back to what are you really trying to accomplish.?

🙂

---

<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:** [January 21, 2022, 8:29pm UTC](https://discuss.elastic.co/t/metricbeat-single-run/292721/7 "2022-01-21T20:29:10Z")

</div>

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