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
a7595c91
Commit
a7595c91
authored
7 years ago
by
Bob Shannon
Committed by
Daniel Nelson
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix panic in elasticsearch input if cannot determine master (#2954)
parent
a52f9012
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugins/inputs/elasticsearch/elasticsearch.go
+5
-2
5 additions, 2 deletions
plugins/inputs/elasticsearch/elasticsearch.go
with
5 additions
and
2 deletions
plugins/inputs/elasticsearch/elasticsearch.go
+
5
−
2
View file @
a7595c91
...
@@ -169,7 +169,10 @@ func (e *Elasticsearch) Gather(acc telegraf.Accumulator) error {
...
@@ -169,7 +169,10 @@ func (e *Elasticsearch) Gather(acc telegraf.Accumulator) error {
if
e
.
ClusterStats
{
if
e
.
ClusterStats
{
// get cat/master information here so NodeStats can determine
// get cat/master information here so NodeStats can determine
// whether this node is the Master
// whether this node is the Master
e
.
setCatMaster
(
s
+
"/_cat/master"
)
if
err
:=
e
.
setCatMaster
(
s
+
"/_cat/master"
);
err
!=
nil
{
acc
.
AddError
(
fmt
.
Errorf
(
mask
.
ReplaceAllString
(
err
.
Error
(),
"http(s)://XXX:XXX@"
)))
return
}
}
}
// Always gather node states
// Always gather node states
...
@@ -353,7 +356,7 @@ func (e *Elasticsearch) setCatMaster(url string) error {
...
@@ -353,7 +356,7 @@ func (e *Elasticsearch) setCatMaster(url string) error {
// NOTE: we are not going to read/discard r.Body under the assumption we'd prefer
// NOTE: we are not going to read/discard r.Body under the assumption we'd prefer
// to let the underlying transport close the connection and re-establish a new one for
// to let the underlying transport close the connection and re-establish a new one for
// future calls.
// future calls.
return
fmt
.
Errorf
(
"status-code %d, expected %d"
,
r
.
StatusCode
,
http
.
StatusOK
)
return
fmt
.
Errorf
(
"
elasticsearch: Unable to retrieve master node information. API responded with
status-code %d, expected %d"
,
r
.
StatusCode
,
http
.
StatusOK
)
}
}
response
,
err
:=
ioutil
.
ReadAll
(
r
.
Body
)
response
,
err
:=
ioutil
.
ReadAll
(
r
.
Body
)
...
...
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