From 1e5ee780e55efd6c989131cddff3ee80b57ce041 Mon Sep 17 00:00:00 2001 From: Logan Date: Thu, 25 Jan 2018 16:04:09 -0700 Subject: [PATCH] Allow running as console application on Windows (#2754) --- CHANGELOG.md | 1 + cmd/telegraf/telegraf.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b345c88b..15d173ae2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -465,6 +465,7 @@ be deprecated eventually. ### Bugfixes +- [#2754](https://github.com/influxdata/telegraf/pull/2754): allow running as console application on Windows - [#2633](https://github.com/influxdata/telegraf/pull/2633): ipmi_sensor: allow @ symbol in password - [#2077](https://github.com/influxdata/telegraf/issues/2077): SQL Server Input - Arithmetic overflow error converting numeric to data type int. - [#2262](https://github.com/influxdata/telegraf/issues/2262): Flush jitter can inhibit metric collection. diff --git a/cmd/telegraf/telegraf.go b/cmd/telegraf/telegraf.go index 2f7b0c8e5..4abfd0a3e 100644 --- a/cmd/telegraf/telegraf.go +++ b/cmd/telegraf/telegraf.go @@ -54,6 +54,7 @@ var fUsage = flag.String("usage", "", "print usage for a plugin, ie, 'telegraf --usage mysql'") var fService = flag.String("service", "", "operate on the service") +var fRunAsConsole = flag.Bool("console", false, "run as console application (windows only)") var ( nextVersion = "1.6.0" @@ -358,7 +359,7 @@ func main() { return } - if runtime.GOOS == "windows" { + if runtime.GOOS == "windows" && !(*fRunAsConsole) { svcConfig := &service.Config{ Name: "telegraf", DisplayName: "Telegraf Data Collector Service",