icingabeat/README.md

143 lines
3.3 KiB
Markdown
Raw Normal View History

2017-01-02 21:18:06 +01:00
[![Build Status](https://travis-ci.org/Icinga/icingabeat.svg?branch=master)](https://travis-ci.org/Icinga/icingabeat)
2017-01-02 15:44:34 +01:00
# Icingabeat
2017-03-15 11:37:28 +01:00
2017-02-01 16:55:48 +01:00
> The Beats are lightweight data shippers, written in Go, that you install on
> your servers to capture all sorts of operational data (think of logs,
> metrics, or network packet data). The Beats send the operational data to
> Elasticsearch, either directly or via Logstash, so it can be visualized with
> Kibana.
2017-03-15 11:37:28 +01:00
Icingabeat is an [Elastic Beat](https://www.elastic.co/products/beats) that
fetches data from the Icinga 2 API and sends it either directly to Elasticsearch
2017-03-17 11:23:35 +01:00
or Logstash.
2017-12-22 13:11:42 +01:00
![icingabeat-checkresult-dashboard](screenshots/checkresults.png)
2017-03-15 11:37:28 +01:00
2017-12-22 13:11:42 +01:00
## Documentation
Please read the documentation on
[icinga.com/docs/icingabeat/latest](https://www.icinga.com/docs/icingabeat/latest/)
for more information
2017-01-02 17:22:45 +01:00
2017-03-15 11:37:28 +01:00
## Development
### Building and running manually
2017-01-02 12:02:47 +01:00
2017-03-15 11:37:28 +01:00
#### Requirements
2017-01-02 12:02:47 +01:00
2017-12-22 13:11:42 +01:00
* [Golang](https://golang.org/dl/) 1.9
2017-01-02 12:02:47 +01:00
2017-03-15 11:37:28 +01:00
#### Clone
2017-01-02 12:02:47 +01:00
To clone Icingabeat from the git repository, run the following commands:
2017-01-02 12:26:55 +01:00
```shell
2017-01-02 12:02:47 +01:00
mkdir -p ${GOPATH}/github.com/icinga
cd ${GOPATH}/github.com/icinga
git clone https://github.com/icinga/icingabeat
```
2017-04-21 11:09:44 +02:00
For further development check out the [beat developer guide](https://www.elastic.co/guide/en/beats/libbeat/current/new-beat.html).
2017-03-15 11:37:28 +01:00
#### Build
2017-01-02 12:02:47 +01:00
Ensure that this folder is at the following location:
`${GOPATH}/github.com/icinga`
2017-01-02 12:02:47 +01:00
To build the binary for Icingabeat run the command below. This will generate a
binary in the same directory with the name icingabeat.
2017-01-02 12:26:55 +01:00
```shell
make
```
2017-03-15 11:37:28 +01:00
#### Run
To run Icingabeat with debugging output enabled, run:
2017-01-02 12:26:55 +01:00
```shell
./icingabeat -c icingabeat.yml -e -d "*"
```
2017-03-15 11:37:28 +01:00
#### Test
To test Icingabeat, run the following command:
2017-01-02 12:26:55 +01:00
```shell
make testsuite
```
alternatively:
2017-01-02 12:26:55 +01:00
```shell
make unit-tests
make system-tests
make integration-tests
make coverage-report
```
The test coverage is reported in the folder `./build/coverage/`
2017-03-15 11:37:28 +01:00
#### Update
2017-01-02 12:02:47 +01:00
Each beat has a template for the mapping in elasticsearch and a documentation
for the fields which is automatically generated based on `etc/fields.yml`.
To generate etc/icingabeat.template.json and etc/icingabeat.asciidoc
2017-01-02 12:26:55 +01:00
```shell
make update
```
2017-03-15 11:37:28 +01:00
#### Cleanup
To clean Icingabeat source code, run the following commands:
2017-01-02 12:26:55 +01:00
```shell
make fmt
make simplify
```
To clean up the build directory and generated artifacts, run:
2017-01-02 12:26:55 +01:00
```shell
make clean
```
2017-03-15 11:37:28 +01:00
### Packaging
2017-01-02 12:02:47 +01:00
The beat frameworks provides tools to crosscompile and package your beat for
different platforms. This requires [docker](https://www.docker.com/) and
vendoring as described above. To build packages of your beat, run the following
command:
2017-01-02 12:26:55 +01:00
```shell
make package
```
2017-04-21 11:09:44 +02:00
This will fetch and create all images required for the build process. The whole
process can take several minutes to finish.
2017-03-15 11:37:28 +01:00
To disable snapshot packages or build specific packages, set the following
environment variables:
```shell
export SNAPSHOT=false
export TARGETS="\"linux/amd64 linux/386\""
export PACKAGES=icingabeat/deb
make package
```
2017-03-15 14:39:04 +01:00
2017-03-15 14:42:52 +01:00
#### Dashboards
To be able to export dashboards with all their dependencies (visualizations and
2017-03-15 14:39:04 +01:00
searches) you have to name the dashboard with a `icingabeat-` prefix.
Export dashboards:
```shell
export ES_URL=http://127.0.0.1:9200
make export-dashboards
```
2017-03-15 14:42:52 +01:00
After exporting, dashboards can be packaged:
```shell
export SNAPSHOT=false
make package-dashboards
```