Display the contents of a file along with metrics using [[inputs.file]] plugin


I have been trying to find a way for Telegraf to read contents of a text file using [[inputs.file]] plugin and then include the contents of the text file to be displayed along with the metrics at http://localhost:9273/metrics.

The metrics page should simply display the contents of the text file along with the other perfmon metrics that I have enabled on the config file.

I cant seem to be find the right usage of the plugin to accomplish this and would appreciate some help.


Telegraf is not a webserver, so displaying raw text isn’t possible. You could write your metrics to a file and have that served or let the webserver include the telegraf metrics in some way.