From c8e1476e4d0637016918559edf87d75963c9ff63 Mon Sep 17 00:00:00 2001 From: raihankhan Date: Thu, 8 Feb 2024 14:56:50 +0600 Subject: [PATCH] Add RabbitMQ metrics configuration Signed-off-by: raihankhan --- .../catalog-kubedb-com-rabbitmqversion.yaml | 28 +++ .../rabbitmq/kubedb-com-rabbitmq.yaml | 176 ++++++++++++++++++ 2 files changed, 204 insertions(+) create mode 100644 charts/kubedb-metrics/templates/rabbitmq/catalog-kubedb-com-rabbitmqversion.yaml create mode 100644 charts/kubedb-metrics/templates/rabbitmq/kubedb-com-rabbitmq.yaml diff --git a/charts/kubedb-metrics/templates/rabbitmq/catalog-kubedb-com-rabbitmqversion.yaml b/charts/kubedb-metrics/templates/rabbitmq/catalog-kubedb-com-rabbitmqversion.yaml new file mode 100644 index 000000000..f145a41cc --- /dev/null +++ b/charts/kubedb-metrics/templates/rabbitmq/catalog-kubedb-com-rabbitmqversion.yaml @@ -0,0 +1,28 @@ +apiVersion: metrics.appscode.com/v1alpha1 +kind: MetricsConfiguration +metadata: + name: catalog-kubedb-com-rabbitmqversion +spec: + targetRef: + apiVersion: catalog.kubedb.com/v1alpha1 + kind: RabbitMQVersion + metrics: + - name: created + help: "Unix creation timestamp" + type: gauge + field: + path: .metadata.creationTimestamp + type: DateTime + metricValue: + valueFromPath: .metadata.creationTimestamp + + - name: info + help: "RabbitMQ versions info" + type: gauge + labels: + - key: db_image + valuePath: .spec.db.image + - key: deprecated + valuePath: .spec.deprecated + metricValue: + value: 1 diff --git a/charts/kubedb-metrics/templates/rabbitmq/kubedb-com-rabbitmq.yaml b/charts/kubedb-metrics/templates/rabbitmq/kubedb-com-rabbitmq.yaml new file mode 100644 index 000000000..0bbc229a3 --- /dev/null +++ b/charts/kubedb-metrics/templates/rabbitmq/kubedb-com-rabbitmq.yaml @@ -0,0 +1,176 @@ +apiVersion: metrics.appscode.com/v1alpha1 +kind: MetricsConfiguration +metadata: + name: kubedb-com-rabbitmq +spec: + targetRef: + apiVersion: kubedb.com/v1alpha2 + kind: RabbitMQ + commonLabels: + - key: app + valuePath: .metadata.name + - key: app_namespace + valuePath: .metadata.namespace + metrics: + - name: created + help: "Unix creation timestamp" + type: gauge + field: + path: .metadata.creationTimestamp + type: DateTime + metricValue: + valueFromPath: .metadata.creationTimestamp + + - name: status_phase + help: "RabbitMQ instance current phase" + type: gauge + field: + path: .status.phase + type: String + params: + - key: phase + valuePath: .status.phase + states: + labelKey: phase + values: + - labelValue: Ready + metricValue: + valueFromExpression: "int(phase == 'Ready')" + - labelValue: Halted + metricValue: + valueFromExpression: "int(phase == 'Halted')" + - labelValue: Provisioning + metricValue: + valueFromExpression: "int(phase == 'Provisioning')" + - labelValue: Critical + metricValue: + valueFromExpression: "int(phase == 'Critical')" + - labelValue: NotReady + metricValue: + valueFromExpression: "int(phase == 'NotReady')" + - labelValue: DataRestoring + metricValue: + valueFromExpression: "int(phase == 'DataRestoring')" + + - name: info + help: "RabbitMQ instance information" + type: gauge + labels: + - key: storageType + valuePath: .spec.storageType + - key: terminationPolicy + valuePath: .spec.terminationPolicy + - key: version + valuePath: .spec.version + metricValue: + value: 1 + + - name: status_conditions + help: "RabbitMQ instance status condition" + type: gauge + field: + path: .status.conditions + type: Array + labels: + - key: type + valuePath: .status.conditions[*].type + - key: status + valuePath: .status.conditions[*].status + metricValue: + value: 1 + + - name: resource_request_cpu + help: "Requested CPU by RabbitMQ in core" + type: gauge + labels: + - key: unit + value: core + params: + - key: obj + valuePath: . + - key: resourceType + value: cpu + metricValue: + valueFromExpression: total_resource_requests(obj, resourceType) + + - name: resource_request_memory + help: "Requested memory by RabbitMQ in byte" + type: gauge + labels: + - key: unit + value: byte + params: + - key: obj + valuePath: . + - key: resourceType + value: memory + metricValue: + valueFromExpression: total_resource_requests(obj, resourceType) + + - name: resource_request_storage + help: "Requested storage by RabbitMQ in byte" + type: gauge + labels: + - key: unit + value: byte + params: + - key: obj + valuePath: . + - key: resourceType + value: storage + metricValue: + valueFromExpression: total_resource_requests(obj, resourceType) + + - name: resource_limit_cpu + help: "CPU limit for RabbitMQ in core" + type: gauge + labels: + - key: unit + value: core + params: + - key: obj + valuePath: . + - key: resourceType + value: cpu + metricValue: + valueFromExpression: total_resource_limits(obj, resourceType) + + - name: resource_limit_memory + help: "Memory limit for RabbitMQ in byte" + type: gauge + labels: + - key: unit + value: byte + params: + - key: obj + valuePath: . + - key: resourceType + value: memory + metricValue: + valueFromExpression: total_resource_limits(obj, resourceType) + + - name: resource_limit_storage + help: "Storage limit for RabbitMQ in byte" + type: gauge + labels: + - key: unit + value: byte + params: + - key: obj + valuePath: . + - key: resourceType + value: storage + metricValue: + valueFromExpression: total_resource_limits(obj, resourceType) + + - name: replicas + help: "Number of replicas in the RabbitMQ replicaset" + type: gauge + field: + path: .spec.replicas + type: Integer + metricValue: + valueFromPath: .spec.replicas + + +