diff --git a/vagrant/Makefile b/vagrant/Makefile index 887cba489c..44b2a5ece9 100755 --- a/vagrant/Makefile +++ b/vagrant/Makefile @@ -182,6 +182,7 @@ application-metrics-jmxexporter-docker-clean: kubectl delete ns demo-jmxexporter-docker ## Jolokia based JMX +### Jolokia as javagent application-metrics-jolokia-docker-build: docker build /sumologic/vagrant/k8s/application_metrics/jmx/jolokia/docker/ -t localhost:32000/jolokia/docker docker push localhost:32000/jolokia/docker @@ -192,3 +193,15 @@ application-metrics-jolokia-docker-run: application-metrics-jolokia-docker-clean: kubectl delete ns demo-jolokia-docker + +### Jolokia as standalone application +application-metrics-jolokia-agent-build: + docker build /sumologic/vagrant/k8s/application_metrics/jmx/jolokia/agent/ -t localhost:32000/jolokia/agent + docker push localhost:32000/jolokia/agent + +application-metrics-jolokia-agent-run: + kubectl create ns demo-jolokia-agent || true + kubectl -n demo-jolokia-agent apply -f ${k8s_path}/application_metrics/jmx/jolokia/agent/statefulset.yaml + +application-metrics-jolokia-agent-clean: + kubectl delete ns demo-jolokia-agent diff --git a/vagrant/k8s/application_metrics/jmx/jolokia/agent/Dockerfile b/vagrant/k8s/application_metrics/jmx/jolokia/agent/Dockerfile new file mode 100644 index 0000000000..8cc9dd597e --- /dev/null +++ b/vagrant/k8s/application_metrics/jmx/jolokia/agent/Dockerfile @@ -0,0 +1,5 @@ +FROM tomcat:jdk8-adoptopenjdk-openj9 +RUN apt-get update && apt-get install -y wget +RUN wget https://search.maven.org/remotecontent?filepath=org/jolokia/jolokia-jvm/1.6.2/jolokia-jvm-1.6.2-agent.jar -O /jolokia-jvm-1.6.2-agent.jar +COPY entrypoint.sh /entrypoint.sh +CMD ["/entrypoint.sh"] diff --git a/vagrant/k8s/application_metrics/jmx/jolokia/agent/entrypoint.sh b/vagrant/k8s/application_metrics/jmx/jolokia/agent/entrypoint.sh new file mode 100755 index 0000000000..ebac96652b --- /dev/null +++ b/vagrant/k8s/application_metrics/jmx/jolokia/agent/entrypoint.sh @@ -0,0 +1,5 @@ +#!/bin/bash +bash catalina.sh run 2>&1 | tee -a /tmp/stdout.log & +sleep 5 +java -jar /jolokia-jvm-1.6.2-agent.jar start org.apache.catalina.startup.Bootstrap 2>&1 | tee -a /tmp/stdout.log & +tail -f /tmp/stdout.log diff --git a/vagrant/k8s/application_metrics/jmx/jolokia/agent/statefulset.yaml b/vagrant/k8s/application_metrics/jmx/jolokia/agent/statefulset.yaml new file mode 100644 index 0000000000..b9d2e5e5e9 --- /dev/null +++ b/vagrant/k8s/application_metrics/jmx/jolokia/agent/statefulset.yaml @@ -0,0 +1,75 @@ +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: jolokia + namespace: demo-jolokia-agent +spec: + selector: + matchLabels: + app: jolokia + serviceName: jolokia + template: + metadata: + labels: + app: jolokia + annotations: + telegraf.influxdata.com/inputs: |+ + [[inputs.jolokia2_agent]] + urls = ["http://127.0.0.1:8778/jolokia"] + + [[inputs.jolokia2_agent.metric]] + name = "sumologic_java_lang_GarbageCollector" + mbean = "java.lang:name=*,type=GarbageCollector" + paths = ["LastGcInfo", "CollectionTime", "Valid", "CollectionCount"] + tag_keys = ["name"] + [[inputs.jolokia2_agent.metric]] + name = "sumologic_java_lang_Threading" + mbean = "java.lang:type=Threading" + paths = ["ThreadAllocatedMemorySupported", "ThreadContentionMonitoringEnabled", "CurrentThreadAllocatedBytes", "TotalStartedThreadCount", "CurrentThreadCpuTimeSupported", "CurrentThreadUserTime", "PeakThreadCount", "ThreadAllocatedMemoryEnabled", "CurrentThreadCpuTime", "ThreadContentionMonitoringSupported", "ThreadCpuTimeSupported", "ThreadCount", "ThreadCpuTimeEnabled", "ObjectMonitorUsageSupported", "SynchronizerUsageSupported", "DaemonThreadCount"] + tag_keys = [] + [[inputs.jolokia2_agent.metric]] + name = "sumologic_java_lang_MemoryPool" + mbean = "java.lang:name=*,type=MemoryPool" + paths = ["Usage", "PeakUsage", "CollectionUsage", "UsageThresholdSupported", "CollectionUsageThresholdSupported", "Valid"] + tag_keys = ["name"] + [[inputs.jolokia2_agent.metric]] + name = "sumologic_java_lang_Memory" + mbean = "java.lang:type=Memory" + paths = ["ObjectPendingFinalizationCount", "Verbose", "HeapMemoryUsage", "NonHeapMemoryUsage"] + tag_keys = [] + [[inputs.jolokia2_agent.metric]] + name = "sumologic_java_lang_OperatingSystem" + mbean = "java.lang:type=OperatingSystem" + paths = ["OpenFileDescriptorCount", "CommittedVirtualMemorySize", "FreePhysicalMemorySize", "SystemLoadAverage", "ProcessCpuLoad", "FreeSwapSpaceSize", "TotalPhysicalMemorySize", "TotalSwapSpaceSize", "TotalMemorySize", "ProcessCpuTime", "MaxFileDescriptorCount", "SystemCpuLoad", "AvailableProcessors", "CpuLoad", "FreeMemorySize"] + tag_keys = [] + [[inputs.jolokia2_agent.metric]] + name = "sumologic_java_lang_MemoryManager" + mbean = "java.lang:name=*,type=MemoryManager" + paths = ["Valid"] + tag_keys = ["name"] + [[inputs.jolokia2_agent.metric]] + name = "sumologic_java_lang_ClassLoading" + mbean = "java.lang:type=ClassLoading" + paths = ["UnloadedClassCount", "LoadedClassCount", "Verbose", "TotalLoadedClassCount"] + tag_keys = [] + [[inputs.jolokia2_agent.metric]] + name = "sumologic_java_lang_Compilation" + mbean = "java.lang:type=Compilation" + paths = ["CompilationTimeMonitoringSupported", "TotalCompilationTime"] + tag_keys = [] + [[inputs.jolokia2_agent.metric]] + name = "sumologic_java_lang_Runtime" + mbean = "java.lang:type=Runtime" + paths = ["Uptime", "StartTime", "Pid", "BootClassPathSupported"] + tag_keys = [] + + telegraf.influxdata.com/class: sumologic-prometheus + telegraf.influxdata.com/limits-cpu: '750m' + prometheus.io/scrape: "true" + prometheus.io/port: "9273" + spec: + containers: + - name: jolokia + image: localhost:32000/jolokia/agent + imagePullPolicy: Always