From 85416b113395ccbb5e25b55980324428d31410b5 Mon Sep 17 00:00:00 2001 From: Daniel Nelson Date: Thu, 25 Apr 2019 20:45:16 -0700 Subject: [PATCH] Add --service-display-name option for use with Windows service --- cmd/telegraf/telegraf.go | 3 ++- internal/usage_windows.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/telegraf/telegraf.go b/cmd/telegraf/telegraf.go index 6d4121ad7b56f..55ff58473d793 100644 --- a/cmd/telegraf/telegraf.go +++ b/cmd/telegraf/telegraf.go @@ -60,6 +60,7 @@ var fUsage = flag.String("usage", "", var fService = flag.String("service", "", "operate on the service (windows only)") var fServiceName = flag.String("service-name", "telegraf", "service name (windows only)") +var fServiceDisplayName = flag.String("service-display-name", "Telegraf Data Collector Service", "service display name (windows only)") var fRunAsConsole = flag.Bool("console", false, "run as console application (windows only)") var ( @@ -352,7 +353,7 @@ func main() { if runtime.GOOS == "windows" && windowsRunAsService() { svcConfig := &service.Config{ Name: *fServiceName, - DisplayName: "Telegraf Data Collector Service", + DisplayName: *fServiceDisplayName, Description: "Collects data using a series of plugins and publishes it to" + "another series of plugins.", Arguments: []string{"--config", "C:\\Program Files\\Telegraf\\telegraf.conf"}, diff --git a/internal/usage_windows.go b/internal/usage_windows.go index 70842f5ab8860..6e3c178352ab6 100644 --- a/internal/usage_windows.go +++ b/internal/usage_windows.go @@ -37,6 +37,7 @@ The commands & flags are: --console run as console application (windows only) --service operate on the service (windows only) --service-name service name (windows only) + --service-display-name service display name (windows only) Examples: @@ -65,5 +66,5 @@ Examples: telegraf --service install --config "C:\Program Files\Telegraf\telegraf.conf" # install telegraf service with custom name - telegraf --service install --service-name=my-telegraf + telegraf --service install --service-name=my-telegraf --service-display-name="My Telegraf" `