When I try to test the config file using, I am seeing the correct command output with the telnet results on the console. However, I am not seeing the same telnet output along with the other metrics when I call http://localhost:9273/metrics. Please advise on what needs to be done for the command output to be displayed along with the other metrics.
What is the exact output of tnc google.com -port 443?
What do your telegraf logs show?
Can you enable the [[outputs.file]] output to see what metrics might be produced?
My understanding is that once it shows up here, it should also show up at /metrics endpoint.
I tried to output the metrics to a file, but couldnt get it to work for some reason :
[[outputs.file]]
files = [“stdout”, “E:\metrics.out”]
data_format = “influx”
Sorry I missed this. If you are using --test there should be a nice big message that says outputs are not used in test mode. So the output will only go to stdout.
So what other plugin would one need to enable for the ping/telnet results to be displayed along with other regular metrics at /metrics endpoint during the normal run of Telegraf?
The current configuration file is capturing CPU, memory, disk info at the /metrics endpoint. I would like the results of the script(ping/telnet results) also to be displayed along with regular metrics. What am I doing wrong?
Your issue is not that clear to me, so I’ll try to summarize it…
You are gathering data via Telegraf
You are also running a custom PS script via inputs.exec
2.a You are basically pinging google (I guess to ensure the machine has internet access)
You expect whatever value comes out of it to be available on some /metrics endpoint
I think you are writing data to InfluxDB…
First, Telegraf does not expose any endpoint, the only /metrics endpoint I’m aware of is exposed by InfluxDB and exposes InfluxDB-related counters. What /metrics endpoint you are talking about?
If you are talking about the InfluxDB endpoint you can’t change its content
The data you are gathering via script are not formatted/serialized in any way, it’s just a multiline string, meaning that filtering by SourceAddress or whatever won’t be possible… not in a nice/performing way at least.
In order to ping stuff you can also use input.ping which is built-in and might save you several Powershell related issues (version, proper permission and execution policy, data serialization, etc)
I’ve only been starting out with Telegraf, kindly excuse if I’m using incorrect terminology.
The /metrics endpoint I’m referring to is the [[outputs.prometheus_client]] plugin. I have this enabled and listening on port 9126 and I’m able to see metrics (CPU, Memory, Disk) from the configuration file when I call https://localhost:9126/metrics after starting telegraf. I’m looking for a way to be able to see the ping & telnet results also at https://localhost:9126/metrics which is going to be scraped by a VictoriaMetrics server that we have setup. (We are not sending data to influxdb for now) I’m hoping to setup alerting on the VictoriaMetrics side based on the script output, if that can be scraped from Telegraf prometheus endpoint.
My requirement is to monitor connections between 2 internal servers (requires ping and telnet) every interval and raise an alert on VictoriaMetrics side when the connection is down. So I feel the input.ping plugin might not be fit for this task.
Request you to also suggest any other plugin combinations that may help me with monitoring connections between servers. (ping & telnet)