From 44499d1ec3ada9e75e0ae3ad8c2ccd8bfc690e4a Mon Sep 17 00:00:00 2001
From: "p.molyavin"
Date: Fri, 10 Feb 2017 13:50:01 +0700
Subject: [PATCH 1/3] Add options to enable jmx monitoring
---
defaults/main.yml | 2 ++
templates/jvm.options.j2 | 7 +++++++
2 files changed, 9 insertions(+)
diff --git a/defaults/main.yml b/defaults/main.yml
index fb31044..70ad585 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -36,3 +36,5 @@ pid_dir: ''
log_dir: ''
conf_dir: ''
data_dirs: ''
+# JMX remote monitoring
+jmx_remote_monitoring_enabled: true
diff --git a/templates/jvm.options.j2 b/templates/jvm.options.j2
index 8d34be6..cacb1b0 100644
--- a/templates/jvm.options.j2
+++ b/templates/jvm.options.j2
@@ -106,3 +106,10 @@
# WARNING: This option will be removed in Elasticsearch 6.0.0 and is provided
# only for migration purposes.
#-Delasticsearch.json.allow_unquoted_field_names=true
+{% if jmx_remote_monitoring_enabled == true %}
+#-Dcom.sun.management.jmxremote.port={{ jmx_remote_monitoring_port }}
+#-Dcom.sun.management.jmxremote.authenticate={{ jmx_remote_monitoring_auth }}
+#-Dcom.sun.management.jmxremote.ssl={{ jmx_remote_monitoring_ssl }}
+##-Djava.rmi.server.hostname="127.0.0.1"
+-Dcom.sun.management.jmxremote
+{% endif %}
From f80fe56af9938d0b51ad78d6c56134d8748e13ee Mon Sep 17 00:00:00 2001
From: "p.molyavin"
Date: Mon, 13 Feb 2017 09:09:17 +0700
Subject: [PATCH 2/3] Fix typo
---
templates/jvm.options.j2 | 4 ----
1 file changed, 4 deletions(-)
diff --git a/templates/jvm.options.j2 b/templates/jvm.options.j2
index cacb1b0..97f26b0 100644
--- a/templates/jvm.options.j2
+++ b/templates/jvm.options.j2
@@ -107,9 +107,5 @@
# only for migration purposes.
#-Delasticsearch.json.allow_unquoted_field_names=true
{% if jmx_remote_monitoring_enabled == true %}
-#-Dcom.sun.management.jmxremote.port={{ jmx_remote_monitoring_port }}
-#-Dcom.sun.management.jmxremote.authenticate={{ jmx_remote_monitoring_auth }}
-#-Dcom.sun.management.jmxremote.ssl={{ jmx_remote_monitoring_ssl }}
-##-Djava.rmi.server.hostname="127.0.0.1"
-Dcom.sun.management.jmxremote
{% endif %}
From 425278923f3ca7523fb854280aeef14665faf7c4 Mon Sep 17 00:00:00 2001
From: "p.molyavin"
Date: Mon, 13 Feb 2017 13:13:20 +0700
Subject: [PATCH 3/3] Refactor to more common options for jvm
---
defaults/main.yml | 4 ++--
templates/jvm.options.j2 | 6 ++++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/defaults/main.yml b/defaults/main.yml
index 70ad585..62dec45 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -36,5 +36,5 @@ pid_dir: ''
log_dir: ''
conf_dir: ''
data_dirs: ''
-# JMX remote monitoring
-jmx_remote_monitoring_enabled: true
+# JVM custom parameters
+es_jvm_custom_parameters: ''
diff --git a/templates/jvm.options.j2 b/templates/jvm.options.j2
index 97f26b0..0e70a75 100644
--- a/templates/jvm.options.j2
+++ b/templates/jvm.options.j2
@@ -106,6 +106,8 @@
# WARNING: This option will be removed in Elasticsearch 6.0.0 and is provided
# only for migration purposes.
#-Delasticsearch.json.allow_unquoted_field_names=true
-{% if jmx_remote_monitoring_enabled == true %}
--Dcom.sun.management.jmxremote
+{% if es_jvm_custom_parameters !='' %}
+{% for item in es_jvm_custom_parameters %}
+{{ item }}
+{% endfor %}
{% endif %}