# Extend Metricbeat

**URL:** <https://discuss.elastic.co/t/extend-metricbeat/146181>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [August 27, 2018, 1:25pm UTC](https://discuss.elastic.co/t/extend-metricbeat/146181 "2018-08-27T13:25:45Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manjukb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/manjukb/32/33758_2.png) [@Manjukb](https://discuss.elastic.co/u/Manjukb)\
**Post date:** [August 27, 2018, 1:25pm UTC](https://discuss.elastic.co/t/extend-metricbeat/146181/1 "2018-08-27T13:25:46Z")

</div>

I understand there is a way to extend metric beats

but documentation is bit confusing it says there are two ways to extend

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

what i understand is extending metricbeat directly is creating module and metricset under existing metric repo and start extending this new metric set

Create your own Beat is create a new beat with --type=metricbeat and start extending this new beat

**but**

when i fallow 1st method to direcltly extend metricbeat after creating  
a metric set inside elastic/beat/metricbeat folder and enabled my module and tried to run i got and error  
`Exiting: 1 error: 1 error: metricset 'micro/mic' is not registered, module not found`

i don't really understand how to build using `Create your own Beat and use Metricbeat as a library`

generate a new beat by passing --type as metricbeat and it asks for metricset and module name

after this i compiled using `make` and executed using ./beatname -c myyml.yml i get error as  
`Exiting: one or more modules must be configured`

i don't understand whats going one please help

---

<div class="post-metadata">

**Author:** ![shaunak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaunak/32/6643_2.png) [@shaunak](https://discuss.elastic.co/u/shaunak)\
**Post date:** [August 27, 2018, 3:28pm UTC](https://discuss.elastic.co/t/extend-metricbeat/146181/2 "2018-08-27T15:28:10Z")

</div>

Let's focus on the second path (create your own beat and use metricbeat as a library) for now, since that is the recommended starting path. Can you share the contents of your `myyml.yml` here please?

---

<div class="post-metadata">

**Author:** ![Manjukb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/manjukb/32/33758_2.png) [@Manjukb](https://discuss.elastic.co/u/Manjukb)\
**Post date:** [August 28, 2018, 6:19am UTC](https://discuss.elastic.co/t/extend-metricbeat/146181/3 "2018-08-28T06:19:32Z")

</div>

ok i got it

issue was the name in .yml i created my beat named xyz and in .yml which i was using still had config pointing to `metricbeat.config.modules:` i dint find this anywhere in documentation that we need to change the name in .yml i just gave a try and it worked 🙂

**but**  
i have one more issue with packaging if i do `make package` under my new beat i get `make: Nothing to be done for 'package'.`

Any idea why this happens ??

---

<div class="post-metadata">

**Author:** ![Manjukb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/manjukb/32/33758_2.png) [@Manjukb](https://discuss.elastic.co/u/Manjukb)\
**Post date:** [August 28, 2018, 6:34am UTC](https://discuss.elastic.co/t/extend-metricbeat/146181/4 "2018-08-28T06:34:09Z")

</div>

ok further to this i downgraded beat to 6.2 and created new normal beat (without --type=metricbeat)  
under new beat folder `make setup` was success and `make package` started buildinf triggering docker

and i created new beat with --type=metricbeat and did `make setup` go below error

`cp: cannot stat 'module/*/_meta/kibana': No such file or directory vendor/github.com/elastic/beats/metricbeat/Makefile:23: recipe for target 'kibana' failed make[1]: [kibana] Error 1 (ignored) Traceback (most recent call last): File "./vendor/github.com/elastic/beats/script/generate_imports.py", line 7, in <module> from generate_imports_helper import comment, get_importable_lines ImportError: No module named generate_imports_helper vendor/github.com/elastic/beats/metricbeat/Makefile:57: recipe for target 'imports' failed make[1]: ***[imports] Error 1 make[1]: Leaving directory '/home/misra_debasish90/go/src/github.com/Manjukb/metrictest' Makefile:17: recipe for target 'setup' failed make:*** [setup] Error 2`

please help

---

<div class="post-metadata">

**Author:** ![dcroonen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dcroonen/32/27450_2.png) [@dcroonen](https://discuss.elastic.co/u/dcroonen)\
**Post date:** [August 29, 2018, 9:29am UTC](https://discuss.elastic.co/t/extend-metricbeat/146181/5 "2018-08-29T09:29:04Z")

</div>

Hi @Manjukb

When using the 6.2 branch before executing `make setup` in step 3 do:

- `cp -r $GOPATH/src/github.com/elastic/beats/metricbeat/scripts .`
- `vi ${GOPATH}/src/github.com/elastic/beats/metricbeat/Makefile`
  - line 25 replace  
`@-cp -r module/*/_meta/kibana _meta/`  
by  
`@-cp -r ../../elastic/beats/metricbeat/module/*/_meta/kibana _meta/`

Now you can run `make setup`.

---

<div class="post-metadata">

**Author:** ![Manjukb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/manjukb/32/33758_2.png) [@Manjukb](https://discuss.elastic.co/u/Manjukb)\
**Post date:** [August 29, 2018, 12:24pm UTC](https://discuss.elastic.co/t/extend-metricbeat/146181/6 "2018-08-29T12:24:12Z")

</div>

@dcroonen thanks `make setup` worked fine

after i want to package so did `make package` got bellow error ☹

`Copying main source folder /source to folder /go/src/github.com/***`  
`Fetching dependencies...`  
`Execute /scripts/before_build.sh github.com/**/metricbeat ./vendor/github.com/elastic/beats`  
`# disable the system/load metricset on windows`  
`sed -i.bk 's/- load/#- load/' /build/modules.d-win/system.yml`  
`sed: can't read /build/modules.d-win/system.yml: No such file or directory`  
`make: *** [before-build] Error 2`  
`vendor/github.com/elastic/beats/libbeat/scripts/Makefile:424: recipe for target 'prepare-package-cgo' ``failed make[1]: ***[prepare-package-cgo] Error 2 make[1]: Leaving directory '/home/misra_debasish90/work/src/github.com/**/metricbeat' vendor/github.com/elastic/beats/libbeat/scripts/Makefile:465: recipe for target 'package' failed make: *** [package] Error 2`

---

<div class="post-metadata">

**Author:** ![dcroonen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dcroonen/32/27450_2.png) [@dcroonen](https://discuss.elastic.co/u/dcroonen)\
**Post date:** [August 29, 2018, 12:44pm UTC](https://discuss.elastic.co/t/extend-metricbeat/146181/7 "2018-08-29T12:44:16Z")

</div>

The file `/build/modules.d-win/system.yml` isn't found. My guess is that some variable isn't set correctly. I suspect there will a file `system.yml` in `<path to your module>/build/modules.d-win` but the the `sed` program is looking in `/build/modules.d-win` and that's your root directory.

---

<div class="post-metadata">

**Author:** ![Manjukb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/manjukb/32/33758_2.png) [@Manjukb](https://discuss.elastic.co/u/Manjukb)\
**Post date:** [August 30, 2018, 7:28am UTC](https://discuss.elastic.co/t/extend-metricbeat/146181/8 "2018-08-30T07:28:36Z")

</div>

`/build/modules.d-win/` don't have `system.yml` file it has only file called `mymodule.yml.disabled`

pasting `go env`

`GOARCH="amd64"`  
`GOBIN="/home/misra_debasish90/work/bin"`  
`GOEXE=""`  
`GOHOSTARCH="amd64"`  
`GOHOSTOS="linux"`  
`GOOS="linux"`  
`GOPATH="/home/misra_debasish90/work"`  
`GORACE=""`  
`GOROOT="/usr/local/go"`  
`GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"`  
`GCCGO="gccgo"`  
`CC="gcc"`  
`GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-`build723023866=/tmp/go-build -gno-record-gcc-switches"```CXX="g++"`  
`CGO_ENABLED="1"`  
`CGO_CFLAGS="-g -O2"`  
`CGO_CPPFLAGS=""`  
`CGO_CXXFLAGS="-g -O2"`  
`CGO_FFLAGS="-g -O2"`  
`CGO_LDFLAGS="-g -O2"`  
`PKG_CONFIG="pkg-config"`

---

<div class="post-metadata">

**Author:** ![Manjukb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/manjukb/32/33758_2.png) [@Manjukb](https://discuss.elastic.co/u/Manjukb)\
**Post date:** [August 30, 2018, 1:34pm UTC](https://discuss.elastic.co/t/extend-metricbeat/146181/9 "2018-08-30T13:34:25Z")

</div>

can anyone please look into it ??

---

<div class="post-metadata">

**Author:** ![shaunak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaunak/32/6643_2.png) [@shaunak](https://discuss.elastic.co/u/shaunak)\
**Post date:** [August 30, 2018, 6:25pm UTC](https://discuss.elastic.co/t/extend-metricbeat/146181/10 "2018-08-30T18:25:20Z")

</div>

Is there a reason you are working off the `6.2` branch and not `master` or even the `6.x` branch? The reason I ask is because the `sed ...` command for `modules.d-win/system.yml` seems to have been removed in 6.3 as part of a larger refactoring effort: [https://github.com/elastic/beats/pull/7388](https://github.com/elastic/beats/pull/7388).

Unless you have a very strong reason to develop off the `6.2` branch, I'd recommend working off `master` or `6.x`.

---

<div class="post-metadata">

**Author:** ![Manjukb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/manjukb/32/33758_2.png) [@Manjukb](https://discuss.elastic.co/u/Manjukb)\
**Post date:** [August 31, 2018, 4:51am UTC](https://discuss.elastic.co/t/extend-metricbeat/146181/11 "2018-08-31T04:51:25Z")

</div>

i have no reason to use 6.2

in master branch `make package` won't even start it says `make: *** No rule to make target 'package'. Stop.`

so i tried downgrading and found that packaging was starting and it even packaged without errors for normal beat(not --type=metricbeat)

---

<div class="post-metadata">

**Author:** ![Manjukb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/manjukb/32/33758_2.png) [@Manjukb](https://discuss.elastic.co/u/Manjukb)\
**Post date:** [August 31, 2018, 1:17pm UTC](https://discuss.elastic.co/t/extend-metricbeat/146181/12 "2018-08-31T13:17:02Z")

</div>

any idea why this happens ??

pasting more details  
`python --version = Python 2.7.13`  
`go version = go version go1.10 linux/amd64`  
`docker --version= Docker version 18.06.1-ce, build e68fc7a`

please help

---

<div class="post-metadata">

**Author:** ![shaunak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaunak/32/6643_2.png) [@shaunak](https://discuss.elastic.co/u/shaunak)\
**Post date:** [August 31, 2018, 5:56pm UTC](https://discuss.elastic.co/t/extend-metricbeat/146181/13 "2018-08-31T17:56:12Z")

</div>

Hi @Manjukb,

I just went through all the steps in [https://www.elastic.co/guide/en/beats/devguide/current/creating-beat-from-metricbeat.html](https://www.elastic.co/guide/en/beats/devguide/current/creating-beat-from-metricbeat.html) (working off `master`). There are two issues in that tutorial which need to be fixed:

- Step 3 results in this error: [make: \*\*\* No rule to make target `create-metricset', needed by `setup'](https://github.com/elastic/beats/issues/8181)
  - Workaround for now: run `make setup`, let it fail with the error above, then run `make create-metricset collect git-add`.

- Step 5 results in this error: [make: \*\*\* No rule to make target `package'](https://github.com/elastic/beats/issues/8184)
  - Workaround for now: run `make release` instead.

Thank you for pointing us to these issues!

---

<div class="post-metadata">

**Author:** ![Manjukb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/manjukb/32/33758_2.png) [@Manjukb](https://discuss.elastic.co/u/Manjukb)\
**Post date:** [September 3, 2018, 6:50am UTC](https://discuss.elastic.co/t/extend-metricbeat/146181/14 "2018-09-03T06:50:59Z")

</div>

Thanks this works 🙂

i'm trying to implement CI using **travis CI** but i fails

do you have any example YML which works for master both for type=metricbeat and normal beat

this will be helpful for me

Thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 1, 2018, 8:51am UTC](https://discuss.elastic.co/t/extend-metricbeat/146181/15 "2018-10-01T08:51:01Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
