mysql-export 监控

背景说明

prometheus 使用的是kube-prometheus 部署的,也就是通过servicemonitor 的方式监控新的监控项目。mysql export 插件通过helm 部署的 pod  service servicemonitor 等资源。

mysql-export 安装配置

通过helm 形式部署

添加仓库,下载包

helm repo add  azure http://mirror.azure.cn/kubernetes/charts/

helm repo update

helm pull azure/prometheus-mysql-exporter

tar -xvf prometheus-mysql-exporter-0.7.1.tgz

配置

cp prometheus-mysql-exporter/values.yaml  prometheus-mysql-exporter/values-117.yaml 

vi prometheus-mysql-exporter/values-117.yaml 

serviceMonitor:
  # enabled should be set to true to enable prometheus-operator discovery of this service
  enabled: true
  # interval is the interval at which metrics should be scraped
  interval: 30s
  # scrapeTimeout is the timeout after which the scrape is ended
  scrapeTimeout: 10s
  # additionalLabels is the set of additional labels to add to the ServiceMonitor
  additionalLabels: {}
  jobLabel: ""
  targetLabels: []
  podTargetLabels: []
  metricRelabelings: []

mysql:
  db: ""
  host: "52.13.22.91"
  param: ""
  pass: "xxxxxxx"
  port: 3306
  protocol: ""
  user: "root"
  existingSecret: false

部署


helm install m91 prometheus-mysql-exporter -f prometheus-mysql-exporter/values-91.yaml      ( 注意此时的命名空间是默认的)

deployment    pod   service  endpoint   servicemonitor  一并创建了

验证

原文地址:https://www.cnblogs.com/fanggege/p/13702715.html