added docker and JMX examples, multistep-init docs

This commit is contained in:
Alexander Lukyanchikov 2019-06-23 00:05:08 -04:00 committed by GitHub
parent 7356f2959f
commit e78971482f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 36 additions and 5 deletions

View File

@ -47,6 +47,7 @@ Using Sampler is basically a 3-step process:
- [Real-world recipes (contributions welcome!)](#real-world-recipes) - [Real-world recipes (contributions welcome!)](#real-world-recipes)
- [Databases (MySQL, PostgreSQL, MongoDB, Neo4j)](#databases) - [Databases (MySQL, PostgreSQL, MongoDB, Neo4j)](#databases)
- [Kafka](#kafka) - [Kafka](#kafka)
- [Docker](#docker)
- [SSH](#ssh) - [SSH](#ssh)
- [JMX](#jmx) - [JMX](#jmx)
@ -227,6 +228,18 @@ textboxes:
sample: top sample: top
``` ```
#### Multistep init
It is also possible to execute multiple init commands one after another, before you start sampling.
```yml
textboxes:
- title: Java application uptime
multistep-init:
- java -jar jmxterm-1.0.0-uber.jar
- open host:port # or local PID
- bean java.lang:type=Runtime
sample: get Uptime
```
### Variables ### Variables
If the configuration file contains repeated patterns, they can be extracted into the `variables` section. If the configuration file contains repeated patterns, they can be extracted into the `variables` section.
Also variables can be specified using `-v`/`--variable` flag on startup, and any system environment variables will also be available in the scripts. Also variables can be specified using `-v`/`--variable` flag on startup, and any system environment variables will also be available in the scripts.
@ -330,7 +343,6 @@ sparklines:
<details><summary>Kafka lag per consumer group</summary> <details><summary>Kafka lag per consumer group</summary>
```yml ```yml
variables: variables:
kafka_connection: $KAFKA_HOME/bin/kafka-consumer-groups --bootstrap-server localhost:9092 kafka_connection: $KAFKA_HOME/bin/kafka-consumer-groups --bootstrap-server localhost:9092
runcharts: runcharts:
@ -347,12 +359,23 @@ runcharts:
</details> </details>
### Docker
<details><summary>Docker containers stats (CPU, MEM, O/I)</summary>
```yml
textboxes:
- title: Docker containers stats
sample: docker stats --no-stream --format "table {{.Name}}\t{{.CPUPerc}}\t{{.MemPerc}}\t{{.MemUsage}}\t{{.NetIO}}\t{{.BlockIO}}\t{{.PIDs}}"
```
</details>
### SSH ### SSH
<details><summary>TOP command on a remote server</summary> <details><summary>TOP command on a remote server</summary>
```yml ```yml
variables: variables:
sshconnection: ssh -i ~/my-key-pair.pem ec2-user@1.2.3.4 sshconnection: ssh -i ~/my-key-pair.pem ec2-user@1.2.3.4
textboxes: textboxes:
@ -365,6 +388,14 @@ textboxes:
</details> </details>
### JMX ### JMX
... Prerequisite: download [jmxterm jar file](https://docs.cyclopsgroup.org/jmxterm)
### Spring Boot ```yml
... textboxes:
- title: Java application uptime
multistep-init:
- java -jar jmxterm-1.0.0-uber.jar
- open host:port # or local PID
- bean java.lang:type=Runtime
sample: get Uptime
transform: echo $sample | tr -dc '0-9' | awk '{printf "%.1f min", $1/1000/60}'
```