====== Metricbeat: werking======
[[elk_stack:elk_stack|{{ :elk_stack:icon.jpg?120|}}]]
===== context=====
dit document beschrijft de werking van Metricbeat
===== configuratie =====
- /etc/metricbeat/metricbeat.yml
- vergelijkbaar met de configuratie van [[elk_stack:werking_filebeat|Filebeat]] heb je ook een **.reference.yml**-bestand waarin alle opties netjes worden uitgelegd.
- standaard staat **output** naar ES, ipv Logstash. Pas dit als volgt aan:
-zet IN commentaar:output.elasticsearch:
hosts: ["localhost:9200"]
-voeg adres van kibana toe: setup.kibana:
host: "localhost:5601"
-haal UIT commentaar:#output.logstash:
#hosts: ["localhost:5044"]
- schakel [[elk_stack:logging_naar_syslog_uistschakelen|logging_naar_syslog_uit]]
- activeer [[elk_stack:sample_dashboards_activeren|sample dashboards]]
- om de werking van de agent wat te leren kennen, zetten we logging aan:logging.level: debug
logging.to_files: true
logging.files:
path: /var/log/metricbeat
logging.metrics.enabled: false
- test je config file: metricbeat test config
- herstart metricbeat: sudo systemctl restart metricbeat
===== Kibana =====
- maak een [[elk_stack:index|index]] aan in kibana
- controleer dat events binnenkomen in **Discover**\\ Nu kan je deze verwerken in [[elk_stack:visualizations|visualizations]]
- activeer de **voorbeeld dashboards** als volgt:
- open /etc/metricbeat/metricbeat.yml
- activeer de waarde:setup.dashboards.enabled: true
- herstart metricbeat service:sudo systemctl restart metricbeat
===== problemen, problemen =====
* ga kijken in /var/log/metricbeat/metricbeat
==== Kibana sample dashboards worden niet geladen ====
**fout**: ERROR instance/beat.go:933 Exiting: error connecting to Kibana: fail to get the Kibana version: HTTP GET request to http://localhost:5601/api/status fails: ... Get http://localhost:5601/api/status: dial tcp 127.0.0.1:5601: connect: connection refused. Response: .
**oorzaak**:filebeat maakt verbinding op Kibana API endpoint. Indien niet expliciet geconfigureerd, gaat filebeat uit van localhost. Als kibana luistert op ander adres, voeg dit dan als volgt toe in metricbeat.yml: setup.kibana:
# Kibana Host
# Scheme and port can be left out and will be set to the default (http and 5601)
# In case you specify and additional path, the scheme is required: http://localhost:5601/path
# IPv6 addresses should always be defined as: https://[2001:db8::1]:5601
host: ":5601"
===== meer info =====
* [[elk_stack:metricbeat_installatie|Metricbeat: installatie]]
* [[https://www.elastic.co/guide/en/beats/metricbeat/current/exported-fields-system.html|metricbeat system module]]
{{tag>elk_stack metricbeat configuratie beat}}