User Tools
toolsandtechnologies:jmx_prometheus_exporter
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| toolsandtechnologies:jmx_prometheus_exporter [2017/10/09 15:07] – ekenny | toolsandtechnologies:jmx_prometheus_exporter [2021/06/25 10:09] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== JMX Prometheus Exporter Set Up ====== | ||
| + | Download the jmx_prometheus_javaagent.jar. | ||
| + | * Available at : [[https:// | ||
| + | * Move the downloaded jar to a directory on the handler running the application you wish to monitor. | ||
| + | * In same directory create a config.yaml file. (Basic example config shown below) | ||
| + | < | ||
| + | ssl: false | ||
| + | lowercaseOutputName: | ||
| + | lowercaseOutputLabelNames: | ||
| + | whitelistObjectNames: | ||
| + | blacklistObjectNames: | ||
| + | </ | ||
| + | |||
| + | * vi into the startup.sh file for the application you wish to monitor. | ||
| + | * Add the following lines inside the JAVA_OPTS. | ||
| + | < | ||
| + | -javaagent:/ | ||
| + | -Dcom.sun.management.jmxremote=true \ | ||
| + | -Dcom.sun.management.jmxremote.ssl=false \ | ||
| + | </ | ||
| + | |||
| + | * Replace the paths to point to the jar and the config file for the exporter. | ||
| + | * Replace PORTNUMBER with the port number you want your endpoint on. | ||
| + | * Save and quit. | ||
| + | * To start the exporter requires an application restart. | ||
| + | * To verify the metrics are exposed you can view them in the browser or on the command line of the app handler: | ||
| + | * http:// | ||
| + | * curl localhost: | ||
| + | * Following this you should see output similar to below. | ||
| + | < | ||
| + | # HELP jmx_config_reload_failure_total Number of times configuration have failed to be reloaded. | ||
| + | # TYPE jmx_config_reload_failure_total counter | ||
| + | jmx_config_reload_failure_total 0.0 | ||
| + | # HELP jvm_memory_bytes_used Used bytes of a given JVM memory area. | ||
| + | # TYPE jvm_memory_bytes_used gauge | ||
| + | jvm_memory_bytes_used{area=" | ||
| + | jvm_memory_bytes_used{area=" | ||
| + | # HELP jvm_memory_bytes_committed Committed (bytes) of a given JVM memory area. | ||
| + | # TYPE jvm_memory_bytes_committed gauge | ||
| + | jvm_memory_bytes_committed{area=" | ||
| + | jvm_memory_bytes_committed{area=" | ||
| + | # HELP jvm_memory_bytes_max Max (bytes) of a given JVM memory area. | ||
| + | # TYPE jvm_memory_bytes_max gauge | ||
| + | jvm_memory_bytes_max{area=" | ||
| + | jvm_memory_bytes_max{area=" | ||
| + | # HELP jvm_memory_pool_bytes_used Used bytes of a given JVM memory pool. | ||
| + | # TYPE jvm_memory_pool_bytes_used gauge | ||
| + | jvm_memory_pool_bytes_used{pool=" | ||
| + | jvm_memory_pool_bytes_used{pool=" | ||
| + | jvm_memory_pool_bytes_used{pool=" | ||
| + | jvm_memory_pool_bytes_used{pool=" | ||
| + | jvm_memory_pool_bytes_used{pool=" | ||
| + | # HELP jvm_memory_pool_bytes_committed Committed bytes of a given JVM memory pool. | ||
| + | # TYPE jvm_memory_pool_bytes_committed gauge | ||
| + | jvm_memory_pool_bytes_committed{pool=" | ||
| + | jvm_memory_pool_bytes_committed{pool=" | ||
| + | jvm_memory_pool_bytes_committed{pool=" | ||
| + | jvm_memory_pool_bytes_committed{pool=" | ||
| + | jvm_memory_pool_bytes_committed{pool=" | ||
| + | # HELP jvm_memory_pool_bytes_max Max bytes of a given JVM memory pool. | ||
| + | # TYPE jvm_memory_pool_bytes_max gauge | ||
| + | jvm_memory_pool_bytes_max{pool=" | ||
| + | jvm_memory_pool_bytes_max{pool=" | ||
| + | jvm_memory_pool_bytes_max{pool=" | ||
| + | jvm_memory_pool_bytes_max{pool=" | ||
| + | jvm_memory_pool_bytes_max{pool=" | ||
| + | # HELP jvm_classes_loaded The number of classes that are currently loaded in the JVM | ||
| + | # TYPE jvm_classes_loaded gauge | ||
| + | jvm_classes_loaded 13164.0 | ||
| + | # HELP jvm_classes_loaded_total The total number of classes that have been loaded since the JVM has started execution | ||
| + | # TYPE jvm_classes_loaded_total counter | ||
| + | jvm_classes_loaded_total 13957.0 | ||
| + | # HELP jvm_classes_unloaded_total The total number of classes that have been unloaded since the JVM has started execution | ||
| + | # TYPE jvm_classes_unloaded_total counter | ||
| + | jvm_classes_unloaded_total 793.0 | ||
| + | # HELP jmx_scrape_duration_seconds Time this JMX scrape took, in seconds. | ||
| + | # TYPE jmx_scrape_duration_seconds gauge | ||
| + | jmx_scrape_duration_seconds 6.1745E-5 | ||
| + | # HELP jmx_scrape_error Non-zero if this scrape failed. | ||
| + | # TYPE jmx_scrape_error gauge | ||
| + | jmx_scrape_error 0.0 | ||
| + | # HELP process_cpu_seconds_total Total user and system CPU time spent in seconds. | ||
| + | # TYPE process_cpu_seconds_total counter | ||
| + | process_cpu_seconds_total 1308.58 | ||
| + | # HELP process_start_time_seconds Start time of the process since unix epoch in seconds. | ||
| + | # TYPE process_start_time_seconds gauge | ||
| + | process_start_time_seconds 1.507297514844E9 | ||
| + | # HELP process_open_fds Number of open file descriptors. | ||
| + | # TYPE process_open_fds gauge | ||
| + | process_open_fds 61.0 | ||
| + | # HELP process_max_fds Maximum number of open file descriptors. | ||
| + | # TYPE process_max_fds gauge | ||
| + | process_max_fds 4096.0 | ||
| + | # HELP process_virtual_memory_bytes Virtual memory size in bytes. | ||
| + | # TYPE process_virtual_memory_bytes gauge | ||
| + | process_virtual_memory_bytes 1.1074588672E10 | ||
| + | # HELP process_resident_memory_bytes Resident memory size in bytes. | ||
| + | # TYPE process_resident_memory_bytes gauge | ||
| + | process_resident_memory_bytes 1.434279936E9 | ||
| + | # HELP jmx_config_reload_success_total Number of times configuration have successfully been reloaded. | ||
| + | # TYPE jmx_config_reload_success_total counter | ||
| + | jmx_config_reload_success_total 0.0 | ||
| + | # HELP jvm_gc_collection_seconds Time spent in a given JVM garbage collector in seconds. | ||
| + | # TYPE jvm_gc_collection_seconds summary | ||
| + | jvm_gc_collection_seconds_count{gc=" | ||
| + | jvm_gc_collection_seconds_sum{gc=" | ||
| + | jvm_gc_collection_seconds_count{gc=" | ||
| + | jvm_gc_collection_seconds_sum{gc=" | ||
| + | # HELP jvm_threads_current Current thread count of a JVM | ||
| + | # TYPE jvm_threads_current gauge | ||
| + | jvm_threads_current 95.0 | ||
| + | # HELP jvm_threads_daemon Daemon thread count of a JVM | ||
| + | # TYPE jvm_threads_daemon gauge | ||
| + | jvm_threads_daemon 72.0 | ||
| + | # HELP jvm_threads_peak Peak thread count of a JVM | ||
| + | # TYPE jvm_threads_peak gauge | ||
| + | jvm_threads_peak 96.0 | ||
| + | # HELP jvm_threads_started_total Started thread count of a JVM | ||
| + | # TYPE jvm_threads_started_total counter | ||
| + | jvm_threads_started_total 967.0 | ||
| + | # HELP jvm_threads_deadlocked Cycles of JVM-threads that are in deadlock waiting to acquire object monitors or ownable synchronizers | ||
| + | # TYPE jvm_threads_deadlocked gauge | ||
| + | jvm_threads_deadlocked 0.0 | ||
| + | # HELP jvm_threads_deadlocked_monitor Cycles of JVM-threads that are in deadlock waiting to acquire object monitors | ||
| + | # TYPE jvm_threads_deadlocked_monitor gauge | ||
| + | jvm_threads_deadlocked_monitor 0.0 | ||
| + | # HELP jvm_info JVM version info | ||
| + | # TYPE jvm_info gauge | ||
| + | jvm_info{version=" | ||
| + | </ | ||
| + | |||
| + | * vi into your prometheus.yml file | ||
| + | * Under " | ||
| + | |||
| + | < | ||
| + | - job_name: ' | ||
| + | |||
| + | # metrics_path defaults to '/ | ||
| + | # scheme defaults to ' | ||
| + | |||
| + | static_configs: | ||
| + | - targets: [' | ||
| + | </ | ||
| + | |||
| + | * Replace ' | ||
| + | * Save and quit | ||
| + | * Start prometheus | ||
| + | * Prometheus config can also be refreshed in stead of restarting - • curl –X POST http:// | ||
| + | * In the prometheus UI select the " | ||
| + | * You should see your target showing as " | ||
| + | {{ : | ||