Monitoring Port Status Across Multiple Machines

TLDR Simon needed help monitoring specific port reachability on different machines. Prabhat suggested using prometheus blackbox exporter or otel-collector, despite lack of experience with the original tool, telegraf. Simon prefers text instructions over video tutorials.

Photo of Simon
Simon
Tue, 26 Sep 2023 11:44:44 UTC

I'm trying to monitor if a certain port is open, for various machines. What's the best way to achieve that? So far I'm experimenting with telegraf & _response, ```[[inputs.net_response]] protocol = "tcp" address = "192.168.1.1:5555" timeout = "1s" read_timeout = "1s" [inputs.net_response.tags] name = "Server"``` However, I'm not sure this is the best way to go about it, displaying the yes/no data is a bit tricky.

Photo of Prabhat
Prabhat
Tue, 26 Sep 2023 11:48:39 UTC

Is this from a security point of view where you want to cpature which ports are open on which machines?

Photo of Simon
Simon
Tue, 26 Sep 2023 11:49:03 UTC

A specific port on each machine, I wanna know if they're reachable.

Photo of Simon
Simon
Tue, 26 Sep 2023 11:49:10 UTC

Not really security, no.

Photo of Prabhat
Prabhat
Tue, 26 Sep 2023 13:34:26 UTC

I have never tried this with telegraf or observability tools

Photo of Prabhat
Prabhat
Tue, 26 Sep 2023 13:35:00 UTC

I have used `nmap` for this though which is the perfect tool for this kind of activity. Would that help you?

Photo of Prabhat
Prabhat
Tue, 26 Sep 2023 13:35:30 UTC

what is the goal of checking the reachability of the ports? health check of the application ?

Photo of Simon
Simon
Tue, 26 Sep 2023 13:35:37 UTC

Yup

Photo of Prabhat
Prabhat
Tue, 26 Sep 2023 13:35:54 UTC

there area a couple of ways to do this.

Photo of Prabhat
Prabhat
Tue, 26 Sep 2023 13:36:03 UTC

You can use prometheus blackbox exporter

Photo of Prabhat
Prabhat
Tue, 26 Sep 2023 13:36:11 UTC

you could also use otel-collector

Photo of Prabhat
Prabhat
Tue, 26 Sep 2023 13:36:27 UTC

Let me get you the right receiver for otel-collector

Photo of Prabhat
Prabhat
Tue, 26 Sep 2023 13:37:36 UTC

Looks like otel-collector only has an httpchecker

Photo of Prabhat
Prabhat
Tue, 26 Sep 2023 13:37:40 UTC

Photo of Prabhat
Prabhat
Tue, 26 Sep 2023 13:38:03 UTC

If you are looking for raw TCP then you can use prometheus blackbox exporter

Photo of Simon
Simon
Tue, 26 Sep 2023 13:38:20 UTC

Yeah, tcp, it's not an http endpoint.

Photo of Prabhat
Prabhat
Tue, 26 Sep 2023 13:38:43 UTC

- this video explains how to setup blackbox exporter and use it with OpenObserve

Photo of Simon
Simon
Tue, 26 Sep 2023 13:43:08 UTC

Also available as text somewhere? I don't like videos.

Photo of Prabhat
Prabhat
Tue, 26 Sep 2023 13:44:54 UTC

not yet. But you should be able to use prometheus blackbox exporter documentation.

Photo of Simon
Simon
Tue, 26 Sep 2023 13:45:04 UTC

Aye, thanks

Photo of Simon
Simon
Tue, 26 Sep 2023 13:59:05 UTC

Is there a way to have a simple query for open port? prometheus expects a query/response directly, that's a bit much

Photo of Simon
Simon
Tue, 26 Sep 2023 14:02:17 UTC

And the readme uses keys that aren't even mentioned in the configuration doc?