配置prometheus监控业务容器
作者:互联网
前面我们部署的prometheus的配置是自动发现的,也即是后面不需要我们过多的去改动,如需监控新的业务容器,我们在deployment中添加相应注解annotations即可:
配置traefik容器监控:
我这里用的k8s的dashboard,在页面上直接修改deployment:
"annotations": { "prometheus_io_scheme": "traefik", "prometheus_io_path": "/metrics", "prometheus_io_port": "8080" }
然后重启POD,到prom页面的target中查看即可:
配置blackbox-exporter监控服务是否存活,即监控TCP服务:
同样,在我们想要监控的容器的deployment中添加注解:
"annotations": { "blackbox_port": "20880", "blackbox_scheme": "tcp" }
prometheus已经自动发现到了:
配置blackbox-exporter监控http服务:
"annotations": { "blackbox_path": "/", "blackbox_port": "8080", "blackbox_scheme": "http" }
配置jvm信息:
"annotations": { "prometheus_io_scrape": "true", "prometheus_io_port": "12346", "prometheus_io_path": "/" }
标签:容器,blackbox,监控,port,prometheus,io,annotations 来源: https://blog.51cto.com/13520772/2485116