# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

public_url: "https://cloud.google.com/stackdriver/docs/solutions/agents/ops-agent/third-party/rabbitmq"
app_url: "https://www.rabbitmq.com/"
short_name: RabbitMQ
long_name: RabbitMQ
logo_path: /stackdriver/images/rabbitmq.png # supplied by google technical writer
description: |-
  The RabbitMQ integration collects message metrics, such as the number of
  delivered, published, and dropped messages. The integration also collects
  RabbitMQ logs and parses them into a JSON payload. The result includes process
  ID, level, and message.
configure_integration: |-
  You must enable the RabbitMQ management plugin by following the [Getting
  started](https://www.rabbitmq.com/management.html#getting-started)
  instructions.

  You must configure a user with the [`monitoring`
  tag](https://www.rabbitmq.com/management.html#permissions).
minimum_supported_agent_version:
  metrics: 2.29.0
  logging: 2.12.0
supported_operating_systems: linux
platforms_to_skip:
  # RabbitMQ is not supported on various distros.
  - suse-cloud:sles-12
  - ubuntu-os-cloud:ubuntu-2410-amd64 # Possible support in the future
  - ubuntu-os-cloud:ubuntu-minimal-2410-amd64 # Possible support in the future
  - ubuntu-os-cloud:ubuntu-2410-arm64 # Possible support in the future
  - ubuntu-os-cloud:ubuntu-minimal-2410-arm64 # Possible support in the future
supported_app_version: ["3.8", "3.9"]
expected_metrics:
  - type: workload.googleapis.com/rabbitmq.consumer.count
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: node_name
        value_regex: .*
      - name: queue_name
        value_regex: .*
      - name: vhost_name
        value_regex: .*
  - type: workload.googleapis.com/rabbitmq.message.current
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: state
        value_regex: .*
      - name: node_name
        value_regex: .*
      - name: queue_name
        value_regex: .*
      - name: vhost_name
        value_regex: .*
    representative: true
expected_logs:
  - log_name: rabbitmq
    fields:
      - name: jsonPayload.process_id
        type: string
        description: The process ID issuing the log
        optional: true
      - name: jsonPayload.message
        type: string
        description: Log message, including detailed stacktrace where provided
      - name: jsonPayload.severity
        type: string
        description: Log entry level
        optional: true
      - name: severity
        type: string
        description: ''
configuration_options:
  logs:
    - type: rabbitmq
      fields:
        - name: type
          default: null
          description: This value must be `rabbitmq`.
        - name: include_paths
          default: '[var/log/rabbitmq/rabbit*.log]'
          description: A list of filesystem paths to read by tailing each file. A wild card (`*`) can be used in the paths; for example, `/var/log/rabbitmq/*.log`.
        - name: exclude_paths
          default: null
          description: A list of filesystem path patterns to exclude from the set matched by `include_paths`.
        - name: record_log_file_path
          default: false
          description: If set to `true`, then the path to the specific file from which the log record was obtained appears in the output log entry as the value of the `agent.googleapis.com/log_file_path` label. When using a wildcard, only the path of the file from which the record was obtained is recorded.
        - name: wildcard_refresh_interval
          default: 60s
          description: The interval at which wildcard file paths in `include_paths` are refreshed. Given as a [time duration](https://pkg.go.dev/time#ParseDuration), for example `30s` or `2m`. This property might be useful under high logging throughputs where log files are rotated faster than the default interval.
  metrics:
    - type: rabbitmq
      fields:
        - name: type
          default: null
          description: This value must be `rabbbitmq`.
        - name: endpoint
          default: http://localhost:15672
          description: The URL of the node to monitor.
        - name: collection_interval
          default: 60s
          description: A [time duration](https://pkg.go.dev/time#ParseDuration) value, such as `30s` or `5m`.
        - name: username
          default: null
          description: The username used to connect to the server.
        - name: password
          default: null
          description: The password used to connect to the server.
        - name: insecure
          default: true
          description: Sets whether or not to use a secure TLS connection. If set to `false`, then TLS is enabled.
        - name: insecure_skip_verify
          default: false
          description: Sets whether or not to skip verifying the certificate. If `insecure` is set to `true`, then the `insecure_skip_verify` value is not used.
        - name: cert_file
          default: null
          description: Path to the TLS certificate to use for mTLS-required connections.
        - name: key_file
          default: null
          description: Path to the TLS key to use for mTLS-required connections.
        - name: ca_file
          default: null
          description: Path to the CA certificate. As a client, this verifies the server certificate. If empty, the receiver uses the system root CA.
