|
Key
This line was removed.
This word was removed. This word was added.
This line was added.
|
Changes (17)
View Page HistoryLuckily Prometheus maintains [jmx_exporter|https://github.com/prometheus/jmx_exporter] which exposes metrics on HTTP. It can either act as a java agent injected into the [JVM|https://en.wikipedia.org/wiki/Java_virtual_machine] during Petals ESB startup or an independent server connecting to Petals ESB by [RMI|https://en.wikipedia.org/wiki/Java_remote_method_invocation].
h2. Installing jmx_exporter as java agent :
From Prometheus documentation:
* Copy *jmx_prometheus_javaagent-XXX.jar* in _petals-esb-directory/lib_ folder
* Create a yaml config file in _petals-esb-directory/conf_ folder, here it is named *prometheus-jmx.yaml*. The file can be empty for now, but this default config will display everything available :{code}
startDelaySeconds: 0
rules:
rules:
* Metrics are available at *[http://localhost:8585/metrics|http://localhost:8484/metrics*]*
+?+{+}Raw metrics sample:+
!Screenshot from 2018-09-24 16-56-28.png!
!Screenshot from 2018-09-24 16-56-28.png!
h2. Alternate jmx_exporter install: as HTTP server
- pattern: ".*"
{code}
{code}
* Start the server, with the exposition HTTP *ip:port* and config file as argument : {code}java \-jar jmx_prometheus_httpserver-0.3.1-jar-with-dependencies.jar localhost:8585 prometheus-jmx.yaml{code}
h2. Install Prometheus
* Install : [https://prometheus.io/docs/prometheus/latest/getting_started/|https://prometheus.io/docs/prometheus/latest/getting_started/]
* Configure Prometheus, here is a sample *prometheus.yml* config:{code}
global:
global:
container: 'petals-sample-0'
{code}
{code}
* Start Prometheus : {code}./prometheus --config.file=prometheus.yml{code}
From Prometheus documentation:
{quote}
Prometheus can reload its configuration at runtime. If the new configuration is not well-formed, the changes will not be applied. A configuration reload is triggered by sending a {color:#333333}{{{}{*}{_}SIGHUP{_}{*}{}}}{color} to the Prometheus process or sending a {color:#333333}{{{}{*}{_}HTTP POST{_}{*}{}}}{color} request to the {color:#333333}{{{}{*}_/-/reload{_}{*}{}}}{color} endpoint (when the {color:#333333}{{{}*\--web.enable-lifecycle flag{*}{}}}{color} is enabled). This will also reload any configured rule files.
{quote}
Prometheus can reload its configuration at runtime. If the new configuration is not well-formed, the changes will not be applied. A configuration reload is triggered by sending a {color:#333333}{{{}{*}{_}SIGHUP{_}{*}{}}}{color} to the Prometheus process or sending a {color:#333333}{{{}{*}{_}HTTP POST{_}{*}{}}}{color} request to the {color:#333333}{{{}{*}_/-/reload{_}{*}{}}}{color} endpoint (when the {color:#333333}{{{}*\--web.enable-lifecycle flag{*}{}}}{color} is enabled). This will also reload any configured rule files.
{quote}
h1. Configuring jmx agent
Jmx agent can be configured in its yaml config file.
Note that :
* Only *numeric values* are supported by Prometheus (though string can me interpreted as regexp to extract numeric values)
* Custom and complex objects may not be exported by the exporter, *having ‘\- pattern “.*”’ as only rule will return every metric available\* (useful for testing).
* Custom and complex objects may not be exported by the exporter, *having ‘\- pattern “.*”’ as only rule will return every metric available\* (useful for testing).
h2. Configuration samples :
The following samples are produced monitoring a Petals ESB single container topology hosting 3 components (SOAP, REST and Camel).
Generic rules samples :
{code}
rules:
rules:
{code}
Metrics parsed by generic rules :
{code}
ProcessCpuLoad{type="OperatingSystem",} 2.5760609293017057E-4
ProcessCpuLoad{type="OperatingSystem",} 2.5760609293017057E-4
{code}
Metrics parsed by advanced rules :
{code}
CpuLoad{target="system",type="OperatingSystem",} 0.10234667681404555
CpuLoad{target="system",type="OperatingSystem",} 0.10234667681404555
{code}
You can mix generic and specific patterns, but remember that they are applied in order, so *always put specific rules first \!*
h1. Configuring Prometheus
# Select _Prometheus_ from the Type dropdown.
# Give a name to the data source
# Give a name to the data source
# Set the URL of prometheus server, in our example the default : localhost:9090
# Clic _Save & Test_
CpuLoad{container="petals-sample-0"}
{code}
{code}
Will display the _CpuLoad_ metric only for _petals-sample-0_ container: !Screenshot from 2018-10-03 16-44-25.png!
You can add different panel types that suit your need ton create your own tailored dashboard:? !Screenshot from 2018-10-05 15-48-54.png!