From 9320a6e115b0bc2d7a832ae56ef0c8329df9db79 Mon Sep 17 00:00:00 2001 From: Ricard Clau Date: Sat, 2 Apr 2016 11:28:44 +0100 Subject: [PATCH] windows service docs closes #954 --- docs/WINDOWS_SERVICE.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 docs/WINDOWS_SERVICE.md diff --git a/docs/WINDOWS_SERVICE.md b/docs/WINDOWS_SERVICE.md new file mode 100644 index 000000000..679a41527 --- /dev/null +++ b/docs/WINDOWS_SERVICE.md @@ -0,0 +1,36 @@ +# Running Telegraf as a Windows Service + +If you have tried to install Go binaries as Windows Services with the **sc.exe** +tool you may have seen that the service errors and stops running after a while. + +**NSSM** (the Non-Sucking Service Manager) is a tool that helps you in a +[number of scenarios](http://nssm.cc/scenarios) including running Go binaries +that were not specifically designed to run only in Windows platforms. + +## NSSM Installation via Chocolatey + +You can install [Chocolatey](https://chocolatey.org/) and [NSSM](http://nssm.cc/) +with these commands + +```powershell +iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) +choco install -y nssm +``` + +## Installing Telegraf as a Windows Service with NSSM + +You can download the latest Telegraf Windows binaries (still Experimental at +the moment) from [the Telegraf Github repo](https://github.com/influxdata/telegraf). + +Then you can create a C:\telegraf folder, unzip the binary there and modify the +**telegraf.conf** sample to allocate the metrics you want to send to **InfluxDB**. + +Once you have NSSM installed in your system, the process is quite straightforward. +You only need to type this command in your Windows shell + +```powershell +nssm install Telegraf c:\telegraf\telegraf.exe -config c:\telegraf\telegraf.config +``` + +And now your service will be installed in Windows and you will be able to start and +stop it gracefully \ No newline at end of file