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