diff --git a/charts/kubedb-metrics/templates/clickhouse/kubedb-com-clickhouse.yaml b/charts/kubedb-metrics/templates/clickhouse/kubedb-com-clickhouse.yaml new file mode 100644 index 000000000..8864a3c91 --- /dev/null +++ b/charts/kubedb-metrics/templates/clickhouse/kubedb-com-clickhouse.yaml @@ -0,0 +1,175 @@ +apiVersion: metrics.appscode.com/v1alpha1 +kind: MetricsConfiguration +metadata: + name: kubedb-com-clickhouse +spec: + targetRef: + apiVersion: kubedb.com/v1alpha2 + kind: ClickHouse + commonLabels: + - key: app + valuePath: .metadata.name + - key: app_namespace + valuePath: .metadata.namespace + metrics: + - name: created + help: "Unix creation time stamp" + type: gauge + field: + path: .metadata.creationTimestamp + type: DateTime + metricValue: + valueFromPath: .metadata.creationTimestamp + + - name: replicas + help: "Number of replicas of clickhouse instance" + type: gauge + params: + - key: obj + valuePath: . + metricValue: + valueFromExpression: resource_replicas(obj) + + - name: status_phase + help: "ClickHouse 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: "ClickHouse instance information" + type: gauge + labels: + - key: version + valuePath: .spec.version + - key: storageType + valuePath: .spec.storageType + - key: deletionPolicy + valuePath: .spec.deletionPolicy + - key: requireSSL + valuePath: .spec.tls + metricValue: + value: 1 + + - name: status_conditions + help: "ClickHouse 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 ClickHouse 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 ClickHouse 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 ClickHouse 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 ClickHouse 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 ClickHouse 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 ClickHouse in byte" + type: gauge + labels: + - key: unit + value: byte + params: + - key: obj + valuePath: . + - key: resourceType + value: storage + metricValue: + valueFromExpression: total_resource_limits(obj, resourceType)