Skip to content

Commit

Permalink
Added server version as influx metric tag
Browse files Browse the repository at this point in the history
  • Loading branch information
itzg committed Mar 22, 2020
1 parent 016736a commit 091d97a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions telegraf.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ import (
const (
MetricName = "minecraft_status"

TagHost = "host"
TagPort = "port"
TagStatus = "status"
TagHost = "host"
TagPort = "port"
TagStatus = "status"
TagVersion = "version"

FieldError = "error"
FieldOnline = "online"
Expand Down Expand Up @@ -68,6 +69,7 @@ func (g *TelegrafGatherer) sendInfoMetrics(info *mcpinger.ServerInfo, elapsed ti
m.AddTag(TagHost, g.host)
m.AddTag(TagPort, g.port)
m.AddTag(TagStatus, StatusSuccess)
m.AddTag(TagVersion, info.Version.Name)

m.AddField(FieldResponseTime, elapsed.Seconds())
m.AddField(FieldOnline, uint64(info.Players.Online))
Expand Down

0 comments on commit 091d97a

Please sign in to comment.