SHA256
1
0
forked from pool/telegraf
telegraf/feature_passive_amqp_exchange.patch

70 lines
2.1 KiB
Diff

Index: telegraf-1.5.2/plugins/inputs/amqp_consumer/amqp_consumer.go
===================================================================
--- telegraf-1.5.2/plugins/inputs/amqp_consumer/amqp_consumer.go.original 2018-02-12 11:44:32.583888582 +0100
+++ telegraf-1.5.2/plugins/inputs/amqp_consumer/amqp_consumer.go 2018-02-12 11:53:42.111013874 +0100
@@ -20,6 +20,7 @@
URL string
// AMQP exchange
Exchange string
+ ExchangePassive bool
// Queue Name
Queue string
// Binding Key
@@ -65,6 +66,7 @@
url = "amqp://localhost:5672/influxdb"
## AMQP exchange
exchange = "telegraf"
+ exchange_passive = false
## AMQP queue name
queue = "telegraf"
## Binding Key
@@ -180,15 +182,27 @@
return nil, fmt.Errorf("Failed to open a channel: %s", err)
}
- err = ch.ExchangeDeclare(
- a.Exchange, // name
- "topic", // type
- true, // durable
- false, // auto-deleted
- false, // internal
- false, // no-wait
- nil, // arguments
- )
+ if a.ExchangePassive == true {
+ err = ch.ExchangeDeclarePassive(
+ a.Exchange, // name
+ "topic", // type
+ true, // durable
+ false, // auto-deleted
+ false, // internal
+ false, // no-wait
+ nil, // arguments
+ )
+ } else {
+ err = ch.ExchangeDeclare(
+ a.Exchange, // name
+ "topic", // type
+ true, // durable
+ false, // auto-deleted
+ false, // internal
+ false, // no-wait
+ nil, // arguments
+ )
+ }
if err != nil {
return nil, fmt.Errorf("Failed to declare an exchange: %s", err)
}
Index: telegraf-1.5.2/etc/telegraf.conf
===================================================================
--- telegraf-1.5.2/etc/telegraf.conf.original 2018-02-12 14:06:03.304072548 +0100
+++ telegraf-1.5.2/etc/telegraf.conf 2018-02-12 14:06:27.544041814 +0100
@@ -2747,6 +2747,7 @@
# url = "amqp://localhost:5672/influxdb"
# ## AMQP exchange
# exchange = "telegraf"
+# exchange_passive = false
# ## AMQP queue name
# queue = "telegraf"
# ## Binding Key