/
Makefile
80 lines (64 loc) · 2.56 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
# Name can be overwritten, as Metricbeat is also a library
BEATNAME?=metricbeat
BEAT_DESCRIPTION?=Sends metrics to Elasticsearch.
SYSTEM_TESTS=true
TEST_ENVIRONMENT?=true
GOPACKAGES=$(shell go list ${BEAT_DIR}/... | grep -v /vendor/)
ES_BEATS?=..
TARGETS?="windows/amd64 windows/386 darwin/amd64"
TARGETS_OLD?="linux/amd64 linux/386"
CGO=true
# Metricbeat can only be cross-compiled on platforms not requiring CGO which
# are the same platforms where the system metrics (cpu, memory) are not
# implemented.
GOX_OS=solaris netbsd
GOX_FLAGS='-arch=amd64'
include ${ES_BEATS}/libbeat/scripts/Makefile
# Collects all module dashboards
.PHONY: kibana
kibana:
-rm -r etc/kibana
mkdir -p etc/kibana
-cp -r module/*/_meta/kibana/ etc/kibana
# Collects all module and metricset fields
.PHONY: fields
fields:
mkdir -p etc/
cat ${ES_BEATS}/metricbeat/etc/_meta/fields_base.yml > etc/fields.yml
. ${PYTHON_ENV}/bin/activate; python ${ES_BEATS}/metricbeat/scripts/fields_collector.py >> etc/fields.yml
# Collects all module docs
.PHONY: collect-docs
collect-docs: python-env
-rm -r docs/modules
mkdir -p docs/modules
. ${PYTHON_ENV}/bin/activate; python ${ES_BEATS}/metricbeat/scripts/docs_collector.py
# Collects all module configs
.PHONY: configs
configs: python-env
. ${PYTHON_ENV}/bin/activate; python ${ES_BEATS}/metricbeat/scripts/config_collector.py $(PWD) > etc/beat.yml
. ${PYTHON_ENV}/bin/activate; python ${ES_BEATS}/metricbeat/scripts/config_collector.py --full $(PWD) > etc/beat.full.yml
# Generates imports for all modules and metricsets
.PHONY: imports
imports:
mkdir -p include
python ${ES_BEATS}/metricbeat/scripts/generate_imports.py > include/list.go
# This is called by the beats packer before building starts
.PHONY: before-build
before-build:
# disable the system/load metricset on windows
sed -i.bk 's/- load/#- load/' $(PREFIX)/metricbeat-win.yml
rm $(PREFIX)/metricbeat-win.yml.bk
sed -i.bk 's/- load/#- load/' $(PREFIX)/metricbeat-win.full.yml
rm $(PREFIX)/metricbeat-win.full.yml.bk
# Runs all collection steps and updates afterwards
.PHONY: collect
collect: fields collect-docs configs kibana imports update
# Creates a new metricset. Requires the params MODULE and METRICSET
.PHONY: create-metricset
create-metricset:
python ${ES_BEATS}/metricbeat/scripts/create_metricset.py --path=$(PWD) --es_beats=$(ES_BEATS) --module=$(MODULE) --metricset=$(METRICSET)
# Generates the data.json example documents
.PHONY: generate-json
generate-json: build-image
${DOCKER_COMPOSE} run beat go test -tags=integration github.com/elastic/beats/metricbeat/module/... -data