Hi,I want to run the telegraf in background mode. I have created a conf file and while running the conf file telegraf is keep running in that screen and i am unable to anything. Is there anyway to run telegraf in background. It will come out of the screen only when you press Ctrl + C
Can you please help me how to install and the steps for the service/agent to start. Because I want to make that run in background as it is keeps running in the window.
Hi philb, thanks for the info. I feel I am doing something wrong.there must be some command to execute of need to place the conf file somewhere.i am trying to run using this command(FF_TEST11.conf in my local directory) :
Hi @oom, apologies for the delay its been a busy day.
On my Ubuntu server my config is stored in /etc/telegraf/telegraf.conf - It loads that one automatically.
Do you have that file directory?
Honestly, I don’t know if there is a flag or argument to run the command as a background process. Not like docker with the -d argument to run it in detatched mode. I think to do what you want you will need to define it as a service.
If you can see the telefgraf.conf file in /etc/telegraf/ then i think the service would be installed.
So, you can update the telegraf.conf file in that directory with your connection details. If you want to test that particular config you mention, you could drop that in to /etc/telegraf/telegraf.d/ but make sure to remove any information from the config that is NOT related to your plugin. So no connection details, no other plugin definintions (ok so you can define more than one in the file, but if that is already defined in the main config you won’t need to)
Then using one of the commands i mentioned to start the service, telegraf should start up and read the telegraf.conf file and the contents of /telegraf.d from within /etc/telegraf/
If it isn;t installed as a service already (it should be if you’ve installed it with a package manager) then this topic might help, its a few years old now but the theory should be the same.
Other than that, I’m not sure what other option there is unfortunately.
I’m out for the weekend, but will be back around on Monday if you’re still struggling to get this going
Hi philib,
Thanks for the detailed info and it really worked.
but still I am getting some errors on the output.
I placed the conf file under /etc/telegraf/telegraf.d
I think that is coming from the name_override line in your config. You’re applying it to the database so any plugins running will be getting that same name. I’m guessing you have some inputs for cpu, memory, disk and so on in your config file.
I would
move the name_overide line to the same block as the plugin definition itsellf
move that entire block of config into a new file, something.conf
place that in /etc/telegraf/telegraf.d
restart the telegraf agent.
At that point the other inputs should start using their default names (dictated by the input itself)
If you then run show measurements from the influx CLI you should get a few different ones like
cpu, mem, disk, diskio, your measurement and possibly others depending on whats in the main telegraf config
restarting telegraf will apply the changes you made, so yes i think restarting it would have caused it. Its an easy enough mistake to make though, you just had the name_override line in the wrong section.
Unfortunately those fields will still appear, if you want to get the clean output just from your CSV you can either drop the current measurement and telegraf will recreate it, or you can just specify a different name in the name_override section