Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
telegraf-nftables
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Due to inactivity, this project is scheduled to be deleted on 2035-04-24.
Why is this scheduled?
Show more breadcrumbs
vqgroup
telegraf-nftables
Commits
3d62e045
Commit
3d62e045
authored
7 years ago
by
Daniel Nelson
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix format of connection_timeout in mqtt_consumer (#3286)
parent
ad4a5aa7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
plugins/inputs/mqtt_consumer/README.md
+1
-1
1 addition, 1 deletion
plugins/inputs/mqtt_consumer/README.md
plugins/inputs/mqtt_consumer/mqtt_consumer.go
+7
-2
7 additions, 2 deletions
plugins/inputs/mqtt_consumer/mqtt_consumer.go
with
8 additions
and
3 deletions
plugins/inputs/mqtt_consumer/README.md
+
1
−
1
View file @
3d62e045
...
@@ -14,7 +14,7 @@ The plugin expects messages in the
...
@@ -14,7 +14,7 @@ The plugin expects messages in the
## MQTT QoS, must be 0, 1, or 2
## MQTT QoS, must be 0, 1, or 2
qos
=
0
qos
=
0
## Connection timeout for initial connection in seconds
## Connection timeout for initial connection in seconds
connection_timeout
=
30
connection_timeout
=
"
30
s"
## Topics to subscribe to
## Topics to subscribe to
topics
=
[
topics
=
[
...
...
This diff is collapsed.
Click to expand it.
plugins/inputs/mqtt_consumer/mqtt_consumer.go
+
7
−
2
View file @
3d62e045
...
@@ -15,6 +15,9 @@ import (
...
@@ -15,6 +15,9 @@ import (
"github.com/eclipse/paho.mqtt.golang"
"github.com/eclipse/paho.mqtt.golang"
)
)
// 30 Seconds is the default used by paho.mqtt.golang
var
defaultConnectionTimeout
=
internal
.
Duration
{
Duration
:
30
*
time
.
Second
}
type
MQTTConsumer
struct
{
type
MQTTConsumer
struct
{
Servers
[]
string
Servers
[]
string
Topics
[]
string
Topics
[]
string
...
@@ -57,7 +60,7 @@ var sampleConfig = `
...
@@ -57,7 +60,7 @@ var sampleConfig = `
## MQTT QoS, must be 0, 1, or 2
## MQTT QoS, must be 0, 1, or 2
qos = 0
qos = 0
## Connection timeout for initial connection in seconds
## Connection timeout for initial connection in seconds
connection_timeout = 30
connection_timeout =
"
30
s"
## Topics to subscribe to
## Topics to subscribe to
topics = [
topics = [
...
@@ -270,6 +273,8 @@ func (m *MQTTConsumer) createOpts() (*mqtt.ClientOptions, error) {
...
@@ -270,6 +273,8 @@ func (m *MQTTConsumer) createOpts() (*mqtt.ClientOptions, error) {
func
init
()
{
func
init
()
{
inputs
.
Add
(
"mqtt_consumer"
,
func
()
telegraf
.
Input
{
inputs
.
Add
(
"mqtt_consumer"
,
func
()
telegraf
.
Input
{
return
&
MQTTConsumer
{}
return
&
MQTTConsumer
{
ConnectionTimeout
:
defaultConnectionTimeout
,
}
})
})
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment