Skip to content

Instantly share code, notes, and snippets.

@megastef
Last active September 21, 2015 11:13
Show Gist options
  • Save megastef/ccf95add58bc4241a56f to your computer and use it in GitHub Desktop.
Save megastef/ccf95add58bc4241a56f to your computer and use it in GitHub Desktop.
ES monitored with SPM
export SPM_TOKEN=YOUR_TOKEN_HERE
# Name two Elasticsearch nodes
export ES1="ES-1"
export ES2="ES-2"
# let's configure 2 nodes in this example
export SPM_CFG="${SPM_TOKEN} es javagent jvmname:${ES1};${SPM_TOKEN} es javagent jvmname:${ES2}"
docker run --name spm-client -e HOSTNAME=$HOSTNAME --restart=always -e SPM_CFG sematext/spm-client
# start the 2 Elasticsearch nodes, one exposes 9200 to the public
docker run --name $ES1 -h $ES1 p 9200:9200 -d --volumes-from spm-client -e ES_JAVA_OPTS="-Dcom.sun.management.jmxremote -javaagent:/opt/spm/spm-monitor/lib/spm-monitor-es.jar=${SPM_TOKEN}::${ES1} -es.node.name=${ES1}" elasticsearch
docker run --name $ES2 -h $ES2 -d --volumes-from spm-client -e ES_JAVA_OPTS="-Dcom.sun.management.jmxremote -javaagent:/opt/spm/spm-monitor/lib/spm-monitor-es.jar=${SPM_TOKEN}::${ES2} -es.node.name=${ES2}" elasticsearch
spm-client:
image: sematext/spm-client
container_name: spm-client
hostname: spm-client
environment:
# setup 2 JVM monitors ES1, ES2
- SPM_CFG=$SPM_TOKEN es javaagent jvmname:ES1;$SPM_TOEKN es javaagent jvmname:ES2;
ES1:
image: elasticsearch
hostname: ES1
ports:
- "9200:9200"
volumes_from:
- spm-client
environment:
- ES_JAVA_OPTS=-Dcom.sun.management.jmxremote -javaagent:/opt/spm/spm-monitor/lib/spm-monitor-es.jar=$SPM_TOKEN::ES1 -Des.node.name=ES1
command: elasticsearch
ES2:
image: elasticsearch
hostname: ES2
command: elasticsearch
volumes_from:
- spm-client
environment:
- ES_JAVA_OPTS=-Dcom.sun.management.jmxremote -javaagent:/opt/spm/spm-monitor/lib/spm-monitor-es.jar=$SPM_TOKEN::ES2 -Des.node.name=ES2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment