Skip to content

Commit

Permalink
Detect error during requesting status info from Kibana (elastic#6991)
Browse files Browse the repository at this point in the history
* detect error during requesting status info of Kibana

* add missing whitespace
  • Loading branch information
kvch authored and tsg committed May 2, 2018
1 parent ec72bfc commit 0515124
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion filebeat/beater/filebeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func (fb *Filebeat) loadModulesML(b *beat.Beat, kibanaConfig *common.Config) err

kibanaVersion, err := common.NewVersion(kibanaClient.GetVersion())
if err != nil {
return err
return errors.Errorf("Error checking Kibana version: %v", err)
}

if err := setupMLBasedOnVersion(fb.moduleRegistry, esClient, kibanaClient, kibanaVersion); err != nil {
Expand Down
6 changes: 3 additions & 3 deletions libbeat/setup/kibana/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func NewKibanaClient(cfg *common.Config) (*Client, error) {
}

if err = client.SetVersion(); err != nil {
return nil, fmt.Errorf("fail to get the Kibana version:%v", err)
return nil, fmt.Errorf("fail to get the Kibana version: %v", err)
}

return client, nil
Expand Down Expand Up @@ -179,8 +179,8 @@ func (client *Client) SetVersion() error {
Version string `json:"version"`
}

_, result, err := client.Connection.Request("GET", "/api/status", nil, nil)
if err != nil {
code, result, err := client.Connection.Request("GET", "/api/status", nil, nil)
if err != nil || code >= 400 {
return fmt.Errorf("HTTP GET request to /api/status fails: %v. Response: %s.",
err, truncateString(result))
}
Expand Down

0 comments on commit 0515124

Please sign in to comment.