This repository has been archived by the owner on Oct 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmetricbeat.txt
70 lines (63 loc) · 1.83 KB
/
metricbeat.txt
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
This step runs a metricbeat Docker container to grab the host metrics and send them to Elasticsearch
or in a log.
`metricbeat.stop()` will stop the metricbeat Docker container.
```
metricbeat()
...
metricbeat.stop()
```
```
metricbeat(){
....
}
```
* *es_secret:* Vault secrets with the details to access to Elasticsearch, this parameter is optional ({user: 'foo', password: 'myFoo', url: 'http://foo.example.com'})
* *output:* log file to save all Docker metricbeat details (docker_inspect.log). Optional
* *config:* metricbeat configuration file, a default configuration is created if the file does not exists (metricbeat_conf.yml).
* *image:* metricbeat Docker image to use (docker.elastic.co/beats/metricbeat:7.10.1).
* *timeout:* Time to wait before kill the metricbeat Docker container on the stop operation.
* *workdir:* Directory to use as root folder to read and write files (current folder).
* *archiveOnlyOnFail:* if true only archive the files in case of failure.
```
metricbeat(
es_secret: 'secret/team/details',
config: 'metricbeat.yml',
image: 'docker.elastic.co/beats/metricbeat:7.10.1',
workdir: "${env.WORKSPACE}")
...
metricbeat.stop(workdir: "${env.WORKSPACE}")
```
```
pipeline {
agent { label "ubuntu" }
stages {
stage('My Docker tests') {
steps {
metricbeat(es_secret: 'secret/team/details', workdir: "${env.WORKSPACE}")
sh('docker run busybox ls')
}
post {
cleanup{
script {
metricbeat.stop(workdir: "${env.WORKSPACE}")
}
}
}
}
}
}
```
```
pipeline {
agent { label "ubuntu" }
stages {
stage('My Docker tests') {
steps {
metricbeat(es_secret: 'secret/team/details', workdir: "${env.WORKSPACE}"){
sh('docker run -it busybox sleep 30')
}
}
}
}
}
```