Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HAProxy integration #148

Merged
merged 10 commits into from
Jul 29, 2020
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
241 changes: 241 additions & 0 deletions dev/import-beats-resources/haproxy/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@
# HAProxy Integration

This integration periodically fetches logs and metrics from [HAProxy](https://www.haproxy.org/) servers.

## Compatibility

The `log` dataset was tested with logs from HAProxy 1.8, 1.9 and 2.0 running on a Debian. It is not available on Windows.

The `info` and `stat` datasets were tested with tested with HAProxy versions from 1.6, 1.7, 1.8 to 2.0.

## Logs

### log

The `log` dataset collects the HAProxy application logs.

{{fields "log"}}

## Metrics

### info

The HAProxy `info` metricset collects general information about HAProxy processes.

An example event for `info` looks as following:

```$json
{
"@timestamp": "2017-10-12T08:05:34.853Z",
"agent": {
"hostname": "host.example.com",
"name": "host.example.com"
},
"event": {
"dataset": "haproxy.info",
"duration": 115000,
"module": "haproxy"
},
"haproxy": {
"info": {
"compress": {
"bps": {
"in": 0,
"out": 0,
"rate_limit": 0
}
},
"connection": {
"current": 0,
"hard_max": 4000,
"max": 4000,
"rate": {
"limit": 0,
"max": 0,
"value": 0
},
"ssl": {
"current": 0,
"max": 0,
"total": 0
},
"total": 30
},
"idle": {
"pct": 1
},
"memory": {
"max": {
"bytes": 0
}
},
"pipes": {
"free": 0,
"max": 0,
"used": 0
},
"process_num": 1,
"processes": 1,
"requests": {
"total": 30
},
"run_queue": 0,
"session": {
"rate": {
"limit": 0,
"max": 0,
"value": 0
}
},
"sockets": {
"max": 8034
},
"ssl": {
"backend": {
"key_rate": {
"max": 0,
"value": 0
}
},
"cache_misses": 0,
"cached_lookups": 0,
"frontend": {
"key_rate": {
"max": 0,
"value": 0
},
"session_reuse": {
"pct": 0
}
},
"rate": {
"limit": 0,
"max": 0,
"value": 0
}
},
"tasks": 7,
"ulimit_n": 8034,
"uptime": {
"sec": 30
},
"zlib_mem_usage": {
"max": 0,
"value": 0
}
}
},
"metricset": {
"name": "info"
},
"process": {
"pid": 7
},
"service": {
"address": "127.0.0.1:14567",
"type": "haproxy"
}
}
```

The fields reported are:

{{fields "info"}}

### stat

The HAProxy `stat` metricset collects stat fields from HAProxy processes.

See section "9.1. CSV format" of the official [HAProxy Management Guide](http://www.haproxy.org/download/2.0/doc/management.txt) for a full list of stat fields.

An example event for `stat` looks as following:

```$json
{
"@timestamp": "2017-10-12T08:05:34.853Z",
"agent": {
"hostname": "host.example.com",
"name": "host.example.com"
},
"event": {
"dataset": "haproxy.stat",
"duration": 115000,
"module": "haproxy"
},
"haproxy": {
"stat": {
"check": {
"agent.last": "",
"health.last": "",
"status": ""
},
"component_type": 0,
"compressor": {
"bypassed.bytes": 0,
"in.bytes": 0,
"out.bytes": 0,
"response.bytes": 0
},
"connection": {
"total": 0
},
"in.bytes": 0,
"out.bytes": 0,
"proxy": {
"id": 2,
"name": "stat"
},
"queue": {},
"request": {
"denied": 0,
"errors": 0,
"rate": {
"max": 0,
"value": 0
},
"total": 0
},
"response": {
"denied": 0,
"http": {
"1xx": 0,
"2xx": 0,
"3xx": 0,
"4xx": 0,
"5xx": 0,
"other": 0
}
},
"server": {
"id": 0
},
"service_name": "FRONTEND",
"session": {
"current": 0,
"limit": 25000,
"max": 0,
"rate": {
"limit": 0,
"max": 0,
"value": 0
}
},
"status": "OPEN"
}
},
"metricset": {
"name": "stat"
},
"process": {
"pid": 1
},
"service": {
"address": "127.0.0.1:14567",
"type": "haproxy"
}
}
```

The fields reported are:

{{fields "stat"}}
12 changes: 12 additions & 0 deletions packages/haproxy/dataset/info/agent/stream/stream.yml.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
metricsets: ["info"]
hosts:
{{#each hosts}}
- {{this}}
{{/each}}
{{#if username}}
username: {{username}}
{{/if}}
{{#if password}}
password: {{password}}
{{/if}}
period: {{period}}
12 changes: 12 additions & 0 deletions packages/haproxy/dataset/info/fields/base-fields.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- name: dataset.type
type: constant_keyword
description: Dataset type.
- name: dataset.name
type: constant_keyword
description: Dataset name.
- name: dataset.namespace
type: constant_keyword
description: Dataset namespace.
- name: '@timestamp'
type: date
description: Event timestamp.
10 changes: 10 additions & 0 deletions packages/haproxy/dataset/info/fields/ecs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- name: process
title: Process
group: 2
type: group
fields:
- name: pid
level: core
type: long
format: string
description: Process id.
Loading