forked from influxdata/telegraf
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mongodb): add skip_ping_at_init option
- Loading branch information
1 parent
579ae4b
commit f315c61
Showing
4 changed files
with
66 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package mongodb | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/influxdata/telegraf/testutil" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestMongodb_SkipPingAtInit(t *testing.T) { | ||
m := &MongoDB{ | ||
Log: testutil.Logger{}, | ||
Servers: []string{"mongodb://aaa:[email protected]:37017/adminaaa"}, | ||
} | ||
err := m.Init() | ||
assert.Error(t, err) | ||
m.SkipPingAtInit = true | ||
err = m.Init() | ||
assert.NoError(t, err) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Read metrics from one or many MongoDB servers | ||
[[inputs.mongodb]] | ||
## An array of URLs of the form: | ||
## "mongodb://" [user ":" pass "@"] host [ ":" port] | ||
## For example: | ||
## mongodb://user:[email protected]:27017, | ||
## mongodb://10.10.3.33:18832, | ||
servers = ["mongodb://127.0.0.1:27017/?connect=direct"] | ||
|
||
## When true, collect cluster status. | ||
## Note that the query that counts jumbo chunks triggers a COLLSCAN, which | ||
## may have an impact on performance. | ||
# gather_cluster_status = true | ||
|
||
## When true, collect per database stats | ||
# gather_perdb_stats = false | ||
|
||
## When true, collect per collection stats | ||
# gather_col_stats = false | ||
|
||
## When true, collect usage statistics for each collection | ||
## (insert, update, queries, remove, getmore, commands etc...). | ||
# gather_top_stat = false | ||
|
||
## List of db where collections stats are collected | ||
## If empty, all db are concerned | ||
# col_stats_dbs = ["local"] | ||
|
||
## Optional TLS Config | ||
# tls_ca = "/etc/telegraf/ca.pem" | ||
# tls_cert = "/etc/telegraf/cert.pem" | ||
# tls_key = "/etc/telegraf/key.pem" | ||
## Use TLS but skip chain & host verification | ||
# insecure_skip_verify = false | ||
|
||
## Skip Ping at initialization | ||
# skip_ping_at_init = true |