added dc
This commit is contained in:
parent
48e102609c
commit
ca6589bf95
|
@ -60,7 +60,7 @@ func (rmq *RabbitMQParser) SampleConfig() string {
|
|||
queue_name = "task_queue"
|
||||
prefetch = 1000
|
||||
dropped_log = "/Users/johnzampolin/.rabbitmq/drops.log"
|
||||
`
|
||||
`
|
||||
}
|
||||
|
||||
// Gather satisfies the telegraf.ServiceInput interface
|
||||
|
@ -187,6 +187,7 @@ func (rmq *RabbitMQParser) SanitizeMsg(msg amqp.Delivery) *client.Point {
|
|||
}
|
||||
for key, val := range data {
|
||||
value := fmt.Sprintf("%v", val)
|
||||
//fmt.Print("=>|Key ", key , "Val", val )
|
||||
switch {
|
||||
case key == "host":
|
||||
ir.Host = value
|
||||
|
@ -251,6 +252,8 @@ func (ir *IRMessage) point() *client.Point {
|
|||
meas, tags, fields := structureKey(ir.Key, ir.Value)
|
||||
tags["host"] = ir.Host
|
||||
tags["server"] = ir.Server
|
||||
//Adding Datacenter as first 4 letter of hostname
|
||||
tags["dc"] = ir.Host[:4]
|
||||
pt, err := client.NewPoint(meas, tags, fields, ir.Clock)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("%v: creating float point", err))
|
||||
|
@ -568,9 +571,6 @@ func structureKey(key string, value interface{}) (string, map[string]string, map
|
|||
field := fmt.Sprintf("%v.%v.%v.%v", s[1], s[2], sp[3], sp[4])
|
||||
fields[field] = value
|
||||
}
|
||||
//Adding Datacenter as first 4 letter of hostname
|
||||
tags["dc"] = tag["host"][:4]
|
||||
|
||||
// Return the start of a point
|
||||
return meas, tags, fields
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue