Skip to content
Snippets Groups Projects
Commit b6f81b53 authored by Gunnar's avatar Gunnar Committed by Cameron Sparr
Browse files

Add commit to Telegraf version string (#1756)

parent c3aa43a6
No related branches found
No related tags found
No related merge requests found
...@@ -52,6 +52,16 @@ var ( ...@@ -52,6 +52,16 @@ var (
branch string branch string
) )
func init() {
// If commit or branch are not set, make that clear.
if commit == "" {
commit = "unknown"
}
if branch == "" {
branch = "unknown"
}
}
const usage = `Telegraf, The plugin-driven server agent for collecting and reporting metrics. const usage = `Telegraf, The plugin-driven server agent for collecting and reporting metrics.
Usage: Usage:
...@@ -137,8 +147,7 @@ func reloadLoop(stop chan struct{}, s service.Service) { ...@@ -137,8 +147,7 @@ func reloadLoop(stop chan struct{}, s service.Service) {
if len(args) > 0 { if len(args) > 0 {
switch args[0] { switch args[0] {
case "version": case "version":
v := fmt.Sprintf("Telegraf - version %s", version) fmt.Printf("Telegraf v%s (git: %s %s)\n", version, branch, commit)
fmt.Println(v)
return return
case "config": case "config":
config.PrintSampleConfig(inputFilters, outputFilters) config.PrintSampleConfig(inputFilters, outputFilters)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment