ansible-middleware / amq

A collection to manage AMQ brokers
Apache License 2.0
16 stars 12 forks source link

Incorrect package name for ArtemisPrometheusMetricsPlugin in downstream #119

Closed garethahealy closed 6 months ago

garethahealy commented 6 months ago
SUMMARY

RH docs explain how to enable the promethus metrics plugin at https://access.redhat.com/documentation/en-us/red_hat_amq_broker/7.11/html-single/managing_amq_broker/index#assembly-br-monitoring-broker-runtime-metrics_managing but I cant see how you'd do this using the ansible module.

The TLDR, is:

  1. copy the jar into the broker lib:

    cp amq/apache-artemis-2.28.0/lib/artemis-prometheus-metrics-plugin-2.1.0.redhat-00001.jar amq/one/lib/artemis-prometheus-metrics-plugin-2.1.0.redhat-00001.jar
  2. enable in broker XML:

    <metrics>
    <plugin class-name="com.redhat.amq.broker.core.server.metrics.plugins.ArtemisPrometheusMetricsPlugin"/>
    </metrics>
ISSUE TYPE

my RH ID: gahealy@redhat

guidograzioli commented 6 months ago

Hello, thanks for reporting. The prometheus enablement is here: https://github.com/ansible-middleware/amq/blob/54baba24d7fa57876b82f76f8f4d28c3f94f058e/roles/activemq/tasks/configure_broker.yml#L98 , for it to work you need to be using redhat.amq_broker from automation hub (not middleware_automation.amq), and set activemq_prometheus_enabled to True

There is also an alternative implemented via jmx_exporter, using the following parameters:

Variable Description Default
activemq_jmx_exporter_port Port for prometheus JMX exporter to listen 18080
activemq_jmx_exporter_config_path JMX exporter configuration path {{ activemq_dest }}/{{ activemq_instance_name }}/etc/jmx_exporter.yml
activemq_jmx_exporter_enabled Enable install and configuration of prometheus-jmx-exporter False
activemq_jmx_exporter_package The rpm package name providing JMX exporter prometheus-jmx-exporter-openjdk11

Those will install the RPM, and add the necessary JVM arguments here: https://github.com/ansible-middleware/amq/blob/54baba24d7fa57876b82f76f8f4d28c3f94f058e/roles/activemq/tasks/systemd.yml#L27

Defaults are here: https://github.com/ansible-middleware/amq/blob/54baba24d7fa57876b82f76f8f4d28c3f94f058e/roles/activemq/defaults/main.yml#L214

Hope that helps, if you have any other question you welcome to add here

garethahealy commented 6 months ago

I didn't use the RPM package because I couldn't find it provided by RHEL9.3. Maybe it exists but it would be good to link to docs (sorry if they exist, I didn't see anything)

For the plugin, it's failing as its using the incorrect package path. The broker.xml now contains:

<metrics><plugin class-name="com.redhat.amq_broker.broker.core.server.metrics.plugins.ArtemisPrometheusMetricsPlugin"/></metrics></core>

Incorrect com.redhat.amq_broker.broker.core.server.metrics.plugins.ArtemisPrometheusMetricsPlugin

Correct com.redhat.amq.broker.core.server.metrics.plugins.ArtemisPrometheusMetricsPlugin

See installed vars/main.yml

$ cat /home/ec2-user/.ansible/collections/ansible_collections/redhat/amq_broker/roles/amq_broker/vars/main.yml | grep "prometheus_package"
  prometheus_package: "{{ 'com.redhat.amq_broker.broker.' if amq_broker_enable is defined and amq_broker_enable and amq_broker_version.split('.')[1] | int >= 11 else 'org.apache.activemq.artemis.' }}"

Role manifest

$ cat /home/ec2-user/.ansible/collections/ansible_collections/redhat/amq_broker/MANIFEST.json
{
 "collection_info": {
  "namespace": "redhat",
  "name": "amq_broker",
  "version": "2.0.0",
  "authors": [
   "Guido Grazioli <ggraziol@redhat.com>"
  ],
  "readme": "README.md",
  "tags": [
   "broker",
   "messaging",
   "server",
   "messagebus",
   "infrastructure",
   "runtimes",
   "middleware",
   "a4mw"
  ],
  "description": "Install and configure activemq / AMQ broker services.",
  "license": [],
  "license_file": "LICENSE",
  "dependencies": {
   "redhat.runtimes_common": ">=1.1.0",
   "ansible.posix": ">=1.4.0"
  },
  "repository": "https://github.com/ansible-middleware/amq",
  "documentation": "https://access.redhat.com/documentation/en-us/red_hat_amq_broker",
  "homepage": "https://access.redhat.com/products/red-hat-amq",
  "issues": "https://github.com/ansible-middleware/amq/issues"
 },
 "file_manifest_file": {
  "name": "FILES.json",
  "ftype": "file",
  "chksum_type": "sha256",
  "chksum_sha256": "6684bdbd7550794223380289a82393ab8196073190fbd3c693ec66caacf65550",
  "format": 1
 },
 "format": 1
}
guidograzioli commented 6 months ago

I see now, nice find, it is likely a problem in the downstream collection build (since here seems correct). Fixing it, thanks