exporter_type: sidecar
app_name_short: ActiveMQ
app_name: Apache {{app_name_short}}
app_site_name: ActiveMQ
app_site_url: https://activemq.apache.org/
exporter_name: the JMX exporter
exporter_pkg_name: jmx-exporter
exporter_repo_url: https://github.com/bitnami/containers/tree/main/bitnami/jmx-exporter#readme
dashboard_available: true
minimum_exporter_version: "0.17.0"
multiple_dashboards: false
dashboard_display_name: {{app_name_short}} Prometheus Overview
config_mods: |
  apiVersion: v1
  kind: ConfigMap
  metadata:
    name: activemq-exporter
  data:
    config.yaml: |
      hostPort: localhost:1099
      lowercaseOutputName: true
      lowercaseOutputLabelNames: true
      blacklistObjectNames:
        - "org.apache.activemq:clientId=*,*"
      whitelistObjectNames:
        - "org.apache.activemq:destinationType=Queue,*"
        - "org.apache.activemq:destinationType=Topic,*"
        - "org.apache.activemq:type=Broker,brokerName=*"
        - "org.apache.activemq:type=Topic,brokerName=*"

      rules:
      - pattern: org.apache.activemq<type=Broker, brokerName=(\S*), destinationType=Queue, destinationName=(\S*)><>(\w+)
        name: activemq_queue_$3
        attrNameSnakeCase: true
        labels:
          destination: $2

      - pattern: org.apache.activemq<type=Broker, brokerName=(\S*), destinationType=Topic, destinationName=(\S*)><>(\w+)
        name: activemq_topic_$3
        attrNameSnakeCase: true
        labels:
          destination: $2

      - pattern: org.apache.activemq<type=Broker, brokerName=(\S*)><>CurrentConnectionsCount
        name: activemq_connections
        type: GAUGE

      - pattern: org.apache.activemq<type=Broker, brokerName=(\S*)><>Total(.*)Count
        name: activemq_$2_total
        type: COUNTER

      - pattern: org.apache.activemq<type=Broker, brokerName=(\S*)><>(.*)PercentUsage
        name: activemq_$2_usage_ratio
        type: GAUGE
        valueFactor: 0.01
  ---
  apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: activemq
  spec:
    selector:
      matchLabels:
  +     app.kubernetes.io/name: activemq
    template:
      metadata:
        labels:
  +       app.kubernetes.io/name: activemq
      spec:
        containers:
        - name: activemq
          image: rmohr/activemq:5.15.9-alpine
  +       ports:
  +         - containerPort: 1099
  +           name: jmx
  +       env:
  +         - name: ACTIVEMQ_JMX
  +           value: "1099"
  +         - name: ACTIVEMQ_OPTS
  +           value: "-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.rmi.port=1099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
  +     - name: exporter
  +       image: bitnami/jmx-exporter:0.17.0
  +       command:
  +         - java
  +         - -jar
  +         - jmx_prometheus_httpserver.jar
  +       args:
  +         - "9000" 
  +         - config.yaml
  +       ports:
  +       - containerPort: 9000
  +         name: prometheus
  +       volumeMounts:
  +       - mountPath: /opt/bitnami/jmx-exporter/config.yaml
  +         subPath: config.yaml
  +         name: activemq-exporter
  +     volumes:
  +     - name: activemq-exporter
  +       configMap:
  +         name: activemq-exporter
  +         items:
  +         - key: config.yaml
  +           path: config.yaml
podmonitoring_config: |
  apiVersion: monitoring.googleapis.com/v1
  kind: PodMonitoring
  metadata:
    name: activemq
    labels:
      app.kubernetes.io/name: activemq
      app.kubernetes.io/part-of: google-cloud-managed-prometheus
  spec:
    endpoints:
    - port: prometheus
      scheme: http
      interval: 30s
      path: /metrics
    selector:
      matchLabels:
        app.kubernetes.io/name: activemq
additional_prereq_info: |
  ActiveMQ Brokers can be configured for [JMX](https://activemq.apache.org/jmx){:class=external} 
  by setting the `ACTIVEMQ_JMX` and `ACTIVEMQ_OPTS` environment variables.
sample_promql_query: up{job="activemq", cluster="{{cluster_name}}", namespace="{{namespace_name}}"}
alerts_config: |
  apiVersion: monitoring.googleapis.com/v1
  kind: Rules
  metadata:
    name: activemq-rules
    labels:
      app.kubernetes.io/component: rules
      app.kubernetes.io/name: activemq-rules
      app.kubernetes.io/part-of: google-cloud-managed-prometheus
  spec:
    groups:
    - name: activemq
      interval: 30s
      rules:
      - alert: ActiveMQNoConnections
        annotations:
          description: |-
            ActiveMQ no connections
              VALUE = {{ $value }}
              LABELS: {{ $labels }}
          summary: ActiveMQ down (instance {{ $labels.instance }})
        expr: activemq_connections_total{job="activemq"} == 0
        for: 5m
        labels:
          severity: warning
      - alert: ActiveMQHighStoreUsage
        annotations:
          description: |-
            ActiveMQ high store usage
              VALUE = {{ $value }}
              LABELS: {{ $labels }}
          summary: ActiveMQ high store usage (instance {{ $labels.instance }})
        expr: activemq_store_usage_ratio{job="activemq"} > 0.9
        for: 5m
        labels:
          severity: warning
      - alert: ActiveMQHighTempStoreUsage
        annotations:
          description: |-
            ActiveMQ high temp store usage
              VALUE = {{ $value }}
              LABELS: {{ $labels }}
          summary: ActiveMQ high temp store usage (instance {{ $labels.instance }})
        expr: activemq_temp_usage_ratio{job="activemq"} > 0.9
        for: 5m
        labels:
          severity: warning
additional_alert_info: You can adjust the alert thresholds to suit your application.
