telegraf service
The telegraf service command installs, removes, and manages the Telegraf
service on Microsoft Windows.
Windows only
The service command is available only in Windows builds of Telegraf.
On Linux and macOS, manage Telegraf with systemd or launchd.
See Run Telegraf as a service.
Usage
telegraf.exe [global flags] service <subcommand> [service flags]Subcommands
| Subcommand | Description |
|---|---|
install | Install Telegraf as a Windows service |
uninstall | Remove the Telegraf service |
start | Start the Telegraf service |
stop | Stop the Telegraf service |
status | Print the current status of the service |
Flags
The service to operate on is selected with the global, Windows-only
--service-name flag, placed before the service command:
| Global flag | Description |
|---|---|
--service-name <name> | Name of the service to operate on. Default is telegraf. |
The install subcommand supports the following flags:
| Flag | Description |
|---|---|
--display-name <name> | Service name as displayed in the service manager. Default is Telegraf Data Collector Service. |
--auto-restart | Enable automatic service restart on failure. |
--restart-delay <duration> | Duration for delaying the service restart on failure. Default is 5m. |
Global flags, such as --config and --config-directory, are recorded as
part of the service definition when installing.
Always use absolute paths.
Examples
The following examples use PowerShell.
They also work in Command Prompt if you replace the PowerShell
line-continuation backtick (`) with a caret (^) or enter each
command on a single line.
Install Telegraf as a Windows service
.\telegraf.exe `
--config "C:\Program Files\InfluxData\telegraf\telegraf.conf" `
service installInstall a second service instance with automatic restart
.\telegraf.exe `
--config "C:\Program Files\InfluxData\telegraf\telegraf-2.conf" `
--service-name telegraf-2 `
service install --auto-restartStart and check the service
.\telegraf.exe service start
.\telegraf.exe service statusFor running and managing the service, including logging to the Windows Event Viewer and troubleshooting startup errors, see Run Telegraf as a service.
Was this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for Telegraf and this documentation. To find support, use the following resources:
Customers with an annual or support contract can contact InfluxData Support.