-
Notifications
You must be signed in to change notification settings - Fork 718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Stack Monitoring] Kibana monitoring with Metricbeat and Filebeat as sidecars #4618
Conversation
3a0fd41
to
5043bde
Compare
6b1b961
to
9f9c07f
Compare
9f9c07f
to
dc46d1e
Compare
I have checked out the branch and am trying with this manifest: apiVersion: kibana.k8s.elastic.co/v1
kind: Kibana
metadata:
name: kb
spec:
version: 7.14.0-SNAPSHOT
count: 1
elasticsearchRef:
name: quickstart
monitoring:
metrics:
elasticsearchRefs:
- name: quickstart
logs:
elasticsearchRefs:
- name: quickstart
---
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
name: quickstart
spec:
version: 7.14.0-SNAPSHOT
nodeSets:
- name: default
count: 1
config:
node.store.allow_mmap: false I'm getting this error in the logs:
And don't have stack monitoring metrics visible in Kibana :( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's great that you could factorize Kibana and Elasticsearch monitoring into a single package!
I couldn't make things work (see my other comment).
|
||
// buildMetricbeatBaseConfig builds the base configuration for Metricbeat with the Elasticsearch or Kibana modules used | ||
// to collect metrics for Stack Monitoring | ||
func buildMetricbeatBaseConfig( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's unit test this?
} | ||
} | ||
return associations | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's unit test those functions?
I forgot to mention that you need to also enable monitoring on the Elasticsearch associated to the monitored Kibana to be able to take advantage of the Kibana Monitoring UI (https://www.elastic.co/guide/en/kibana/current/monitoring-data.html#monitoring-data). I wondered if we should force or validate this and I think it should be left open because it can make sense to just be interested in metrics and logs collection without the monitoring view.
No, you just tested with an elasticsearchRef with no namespace and it revealed a bug. I've always tested with namespaces 🤦. I will fix this. Also, it will not work to monitor Kibana if it hasn't an associated Elasticsearch because we need to be able to retrieve the internal user dedicated for metrics collection to configure the Metricbeat kibana module. That on the other hand, I think, it makes more sense to be validated. |
55246e0
to
30579ac
Compare
Considering it's a "limitation" / behaviour of the stack and not of ECK I think it's fine to leave as is indeed 👍
👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a few tests it seems to work fine 👍
Left a few last comments, this is almost ready to 🚢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I've enable audit logs and configure Filebeat to collect an audit logs file but I forgot to configure the audit logger to write to a file. We discussed this and decided to configure everything so that the audit logs delivery is ready, but leaving the user the choice to enable it. So, by default, audit logs are off. |
I find a small bug in I leave the PR open if you still want to check and test but I think it's ok to be merged. |
jenkins test this please |
test/e2e/test/checks/monitoring.go
Outdated
|
||
func (c StackMonitoringChecks) CheckMetricbeatIndex() test.Step { | ||
return test.Step{ | ||
Name: "Check that documents are indexed in one metricbeat-* index", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe Kibana metrics are expected to be found in .monitoring-kibana-
when xpack.enabled
is set to true
:
metricbeat-7.14.0-2021.07.12-000001 0 p STARTED 0 208b 10.55.208.22 test-kb-mon-metrics-lf6v-es-masterdata-1
metricbeat-7.14.0-2021.07.12-000001 0 r STARTED 0 208b 10.55.210.23 test-kb-mon-metrics-lf6v-es-masterdata-0
.monitoring-kibana-7-mb-2021.07.12 0 r STARTED 8 59.5kb 10.55.208.22 test-kb-mon-metrics-lf6v-es-masterdata-1
.monitoring-kibana-7-mb-2021.07.12 0 p STARTED 8 59.4kb 10.55.210.23 test-kb-mon-metrics-lf6v-es-masterdata-0
test/e2e/kb/stack_monitoring_test.go
Outdated
} | ||
return test.StepList{ | ||
c.CheckBeatSidecars(), | ||
//c.CheckMetricbeatIndex(), TODO: investigate if it's normal that there is no document in this index when es monitoring is off |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my other comment, I'm not sure to understand why enabling es monitoring would move the stack metrics from .monitoring-*
to metricbeat-*
. I'll try to investigate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I enable Elasticsearch monitoring I get the expected .monitoring-es-
index, but there is also a metricbeat-
index created:
.monitoring-kibana-7-mb-2021.07.12 0 p STARTED 142 183.4kb 10.55.210.25 monitoring-es-default-1
.monitoring-kibana-7-mb-2021.07.12 0 r STARTED 142 166kb 10.55.209.29 monitoring-es-default-2
.monitoring-es-7-mb-2021.07.12 0 p STARTED 839 1mb 10.55.210.25 monitoring-es-default-1
.monitoring-es-7-mb-2021.07.12 0 r STARTED 195 682.8kb 10.55.208.23 monitoring-es-default-0
metricbeat-7.14.0-2021.07.12-000001 0 r STARTED 24 151.6kb 10.55.208.23 monitoring-es-default-0
metricbeat-7.14.0-2021.07.12-000001 0 p STARTED 24 151.6kb 10.55.209.29 monitoring-es-default-2
Having a look at these 24 documents in metricbeat-7.14.0-2021.07.12-000001
they are actually all errors which, I guess, happened during metricbeat startup:
Time | _index | error.message |
---|---|---|
Jul 12, 2021 @ 13:28:09.677 | metricbeat-7.14.0-2021.07.12-000001 | error determining if connected Elasticsearch node is master: error making http request: Get "https://localhost:9200/_nodes/_local/nodes": dial tcp 127.0.0.1:9200: connect: connection refused |
I think metricbeat-*
should not be used in e2e tests to assess that monitoring is working as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in b600503
I hit the same issue, also I was not able to get metrics in the monitoring view, I guess it is because metrics are stored in |
jenkins test this please
|
jenkins test this please
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀
Adds a new
monitoring
field to the Kibana resource to configure one or two different Elasticsearch references to set up stack monitoring with Metricbeat and log delivery with Filebeat. The referenced ES are used to send the data collected by the beats.Very similar to #4528.
YAML example for testing
Implementation notes:
KbMonitoringAssociation
to manage association between the "1 Kibana / n monitoring Elasticsearch clusters" associationHasMonitoring
to make the validations and the base Metricbeat config build genericLimitations:
Relates to #4183.