
[[metricbeat-developer-guide]]
= Metricbeat Developer Guide

[partintro]
--

Metricbeat periodically interrogates other services to fetch key metrics
information. As a developer, you can use Metricbeat in two different ways:

* Extend Metricbeat directly
* Create your own Beat and use Metricbeat as a library

We recommend that you start by creating your own Beat to keep the development of your own module or metricset
independent of Metricbeat. At a later stage, if you decide to add a module to Metricbeat, you can reuse
the code without making additional changes.

This following topics describe how to contribute to Metricbeat by adding metricsets, modules, and new Beats based on Metricbeat:

* <<metricbeat-dev-overview>>
* <<creating-metricsets>>
* <<metricset-details>>
* <<creating-metricbeat-module>>
* <<creating-beat-from-metricbeat>>
* <<dev-faq>>

If you would like to contribute to Metricbeat or the Beats project, also see the
https://github.com/elastic/beats/blob/master/CONTRIBUTING.md[general contributor guide].

--

[[metricbeat-dev-overview]]
== Overview

Metricbeat consists of modules and metricsets. A Metricbeat module is typically
named after the service the metrics are fetched from, such as redis,
mysql, and so on. Each module can contain multiple metricsets. A metricset represents
multiple metrics that are normally retrieved with one request from the remote
system. For example, the Redis `info` metricset retrieves info that you get when you
run the Redis `INFO` command, and the MySQL `status` metricset retrieves
info that you get when you issue the MySQL `SHOW GLOBAL STATUS` query.

[float]
== Module and Metricsets Requirements

To guarantee the best user experience, it's important to us that only high quality
modules are part of Metricbeat. The modules and metricsets that are contributed
must meet the following requirements:

* Complete `fields.yml` file to generate docs and Elasticsearch templates
* Documentation files
* Integration tests
* 80% test coverage (unit, integration, and system tests combined)

Metricbeat allows you to build a wide variety of modules and metricsets on top of it.
For a module to be accepted, it should focus on fetching service metrics
directly from the service itself and not via a third-party tool. The goal is to
have as few movable parts as possible and for Metricbeat to run as close as
possible to the service that it needs to monitor.

include::./create-metricset.asciidoc[]

include::./metricset-details.asciidoc[]

include::./create-module.asciidoc[]

include::./creating-beat-from-metricbeat.asciidoc[]

include::./faq.asciidoc[]
