Skip to content

Commit

Permalink
add kafka monitor (#4349)
Browse files Browse the repository at this point in the history
  • Loading branch information
wallyxjh committed Nov 27, 2023
1 parent 5330a70 commit ba71f1d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions service/database/api/req.go
Expand Up @@ -118,4 +118,12 @@ var (
"minio_bucket_traffic_received_bytes": "sum(minio_bucket_traffic_received_bytes{bucket=\"@\"}) by (bucket, instance, job, namespace)",
"minio_bucket_traffic_sent_bytes": "sum(minio_bucket_traffic_sent_bytes{bucket=\"@\"}) by (bucket, instance, job, namespace)",
}

Kafka = map[string]string{
"cpu": "round(max by (pod) (rate(container_cpu_usage_seconds_total{namespace=~\"#\",pod=~\"@-kafka-\\\\d\" ,container=\"kafka\"}[5m])) / on (pod) (max by (pod) (container_spec_cpu_quota{namespace=~\"#\", pod=~\"@-kafka-\\\\d\",container=\"kafka\"} / 100000)) * 100,0.01)",
"memory": "round(max by (pod)(container_memory_usage_bytes{namespace=~\"#\",pod=~\"@-kafka-\\\\d\",container=\"kafka\" })/ on (pod) (max by (pod) (container_spec_memory_limit_bytes{namespace=~\"#\", pod=~\"@-kafka-\\\\d\",container=\"kafka\"})) * 100,0.01)",
"disk_capacity": "(max by (persistentvolumeclaim,namespace) (kubelet_volume_stats_capacity_bytes {namespace=~\"#\", persistentvolumeclaim=~\"data-@-kafka-\\\\d\"}))",
"disk": "round((max by (persistentvolumeclaim,namespace) (kubelet_volume_stats_used_bytes {namespace=~\"#\", persistentvolumeclaim=~\"data-@-kafka-\\\\d\"})) / (max by (persistentvolumeclaim,namespace) (kubelet_volume_stats_capacity_bytes {namespace=~\"#\", persistentvolumeclaim=~\"data-@-kafka-\\\\d\"})) * 100, 0.01)",
"disk_used": "(max by (persistentvolumeclaim,namespace) (kubelet_volume_stats_used_bytes {namespace=~\"#\", persistentvolumeclaim=~\"data-@-kafka-\\\\d\"}))",
}
)
2 changes: 2 additions & 0 deletions service/database/request/req.go
Expand Up @@ -77,6 +77,8 @@ func GetQuery(query *api.PromRequest) (string, error) {
result = api.Pgsql[query.Query]
case "minio":
result = api.Minio[query.Query]
case "kafka":
result = api.Kafka[query.Query]
default:
fmt.Println(query.Type)
}
Expand Down

0 comments on commit ba71f1d

Please sign in to comment.