From 6de6702cb4a37f52815b96d3cfbc33ae36dcc43e Mon Sep 17 00:00:00 2001 From: Stefan Iliev <46542846+StefanIliev545@users.noreply.github.com> Date: Mon, 14 Oct 2019 10:08:01 +0100 Subject: [PATCH] CORDA-3244, CORDA-3245 - Jolokia docs update (#5486) * Fixed wrong command line. Added security policy how to. * Elaborated on security policy to mention when it applies and when not. * Changes according to PR review. * Magic to get jolokia version from a single place and forwarded to the docs. --- constants.properties | 2 ++ docs/source/conf.py | 3 ++- docs/source/node-administration.rst | 16 ++++++++++++++-- node/build.gradle | 7 ++++++- node/src/main/resources/build.properties | 4 +++- 5 files changed, 27 insertions(+), 5 deletions(-) diff --git a/constants.properties b/constants.properties index f08b087465..0352e9178b 100644 --- a/constants.properties +++ b/constants.properties @@ -32,3 +32,5 @@ metricsVersion=4.1.0 metricsNewRelicVersion=1.1.1 openSourceBranch=https://github.com/corda/corda/blob/master openSourceSamplesBranch=https://github.com/corda/samples/blob/master +jolokiaAgentVersion=1.6.1 + diff --git a/docs/source/conf.py b/docs/source/conf.py index 1fa6e4a1e2..f34756ac7d 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -25,7 +25,8 @@ corda_substitutions = { "|quasar_version|" : constants_properties_dict["quasarVersion"], "|platform_version|" : constants_properties_dict["platformVersion"], "|os_branch|" : constants_properties_dict["openSourceBranch"], - "|os_samples_branch|" : constants_properties_dict["openSourceSamplesBranch"] + "|os_samples_branch|" : constants_properties_dict["openSourceSamplesBranch"], + "|jolokia_version|" : constants_properties_dict["jolokiaAgentVersion"] } def setup(app): diff --git a/docs/source/node-administration.rst b/docs/source/node-administration.rst index bb44e666df..379e5efb39 100644 --- a/docs/source/node-administration.rst +++ b/docs/source/node-administration.rst @@ -81,6 +81,12 @@ Note that in production, exposing the database via the node is not recommended. Monitoring your node -------------------- +This section covers monitoring performance and health of a node in Corda Enterprise with Jolokia and Graphite. General best practices for monitoring (e.g. setting up TCP checks for the ports the node communicates on, database health checks etc.) are not covered here but should be followed. + + +Monitoring via Jolokia +++++++++++++++++++++++ + Like most Java servers, the node can be configured to export various useful metrics and management operations via the industry-standard `JMX infrastructure `_. JMX is a standard API for registering so-called *MBeans* ... objects whose properties and methods are intended for server management. As Java @@ -106,8 +112,12 @@ Here are a few ways to build dashboards and extract monitoring data for a node: It can bridge any data input to any output using their plugin system, for example, Telegraf can be configured to collect data from Jolokia and write to DataDog web api. -The Node configuration parameter `jmxMonitoringHttpPort` has to be present in order to ensure a Jolokia agent is instrumented with -the JVM run-time. +In order to ensure that a Jolokia agent is instrumented with the JVM run-time, you can choose one of these options: + +* Specify the Node configuration parameter ``jmxMonitoringHttpPort`` which will attempt to load the jolokia driver from the ``drivers`` folder. + The format of the driver name needs to be ``jolokia-jvm-{VERSION}-agent.jar`` where VERSION is the version required by Corda, currently |jolokia_version|. +* Start the node with ``java -Dcapsule.jvm.args="-javaagent:drivers/jolokia-jvm-1.6.0-agent.jar=port=7777,host=localhost" -jar corda.jar``. + The following JMX statistics are exported: @@ -126,6 +136,8 @@ via a file called ``jolokia-access.xml``. Several Jolokia policy based security configuration files (``jolokia-access.xml``) are available for dev, test, and prod environments under ``/config/``. +To pass a security policy use ``java -Dcapsule.jvm.args=-javaagent:./drivers/jolokia-jvm-1.6.0-agent.jar,policyLocation=file:./config-path/jolokia-access.xml -jar corda.jar`` + Notes for development use +++++++++++++++++++++++++ diff --git a/node/build.gradle b/node/build.gradle index cbcc56f69f..ce88a4bf56 100644 --- a/node/build.gradle +++ b/node/build.gradle @@ -3,7 +3,12 @@ buildscript { def properties = new Properties() file("$projectDir/src/main/resources/build.properties").withInputStream { properties.load(it) } - ext.jolokia_version = properties.getProperty('jolokiaAgentVersion') + + Properties constants = new Properties() + file("$rootDir/constants.properties").withInputStream { constants.load(it) } + + + ext.jolokia_version = constants.getProperty('jolokiaAgentVersion') dependencies { classpath group: 'com.github.docker-java', name: 'docker-java', version: '3.1.5' diff --git a/node/src/main/resources/build.properties b/node/src/main/resources/build.properties index cbe490156a..0b42fe7292 100644 --- a/node/src/main/resources/build.properties +++ b/node/src/main/resources/build.properties @@ -1,4 +1,6 @@ # Build constants exported as resource file to make them visible in Node program # Note: sadly, due to present limitation of IntelliJ-IDEA in processing resource files, these constants cannot be # imported from top-level 'constants.properties' file -jolokiaAgentVersion=1.6.1 +#jolokiaAgentVersion=1.6.1 + +