Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --service-display-name option for use with Windows service #5770

Merged
merged 1 commit into from
May 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cmd/telegraf/telegraf.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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"},
Expand Down
3 changes: 2 additions & 1 deletion internal/usage_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ The commands & flags are:
--console run as console application (windows only)
--service <service> operate on the service (windows only)
--service-name service name (windows only)
--service-display-name service display name (windows only)

Examples:

Expand Down Expand Up @@ -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"
`