diff --git a/charts/kubedb-metrics/templates/zookeeper/catalog-kubedb-com-zookeeperversion.yaml b/charts/kubedb-metrics/templates/zookeeper/catalog-kubedb-com-zookeeperversion.yaml new file mode 100644 index 000000000..4017dca63 --- /dev/null +++ b/charts/kubedb-metrics/templates/zookeeper/catalog-kubedb-com-zookeeperversion.yaml @@ -0,0 +1,30 @@ +apiVersion: metrics.appscode.com/v1alpha1 +kind: MetricsConfiguration +metadata: + name: catalog-kubedb-com-zookeeperversion +spec: + targetRef: + apiVersion: catalog.kubedb.com/v1alpha1 + kind: ZooKeeperVersion + metrics: + - name: created + help: "Unix creation timestamp" + type: gauge + field: + path: .metadata.creationTimestamp + type: DateTime + metricValue: + valueFromPath: .metadata.creationTimestamp + + - name: info + help: "ZooKeeper versions info" + type: gauge + labels: + - key: db_image + valuePath: .spec.db.image + - key: deprecated + valuePath: .spec.deprecated + - key: exporter_image + valuePath: .spec.exporter.image + metricValue: + value: 1 diff --git a/charts/kubedb-metrics/templates/zookeeper/kubedb-com-zookeeper.yaml b/charts/kubedb-metrics/templates/zookeeper/kubedb-com-zookeeper.yaml new file mode 100644 index 000000000..3ee3fbbdf --- /dev/null +++ b/charts/kubedb-metrics/templates/zookeeper/kubedb-com-zookeeper.yaml @@ -0,0 +1,173 @@ +apiVersion: metrics.appscode.com/v1alpha1 +kind: MetricsConfiguration +metadata: + name: kubedb-com-zookeeper +spec: + targetRef: + apiVersion: kubedb.com/v1alpha2 + kind: ZooKeeper + 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: "ZooKeeper 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: "ZooKeeper 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: "ZooKeeper 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 ZooKeeper 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 ZooKeeper 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 ZooKeeper 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 ZooKeeper 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 ZooKeeper 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 ZooKeeper 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 ZooKeeper" + type: gauge + field: + path: .spec.replicas + type: Integer + metricValue: + valueFromPath: .spec.replicas