通过kube-prometheus
安装的k8s监控系统。
在targets页面,我们来分析一下monitoring/node-exporter/
的这个Targets。
node-exporter-serviceMonitor.yaml
内容:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: labels: k8s-app: node-exporter name: node-exporter namespace: monitoring spec: endpoints: - bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token interval: 30s port: https relabelings: - action: replace regex: (.*) replacment: $1 sourceLabels: - __meta_kubernetes_pod_node_name targetLabel: instance scheme: https tlsConfig: insecureSkipVerify: true jobLabel: k8s-app selector: matchLabels: k8s-app: node-exporter
|
monitoring/node-exporter/0
Endpoint: https://172.16.64.233:9100/metrics
查看Configuration页面,发现是以role endpoints
做为自动服务发现的
1 2 3 4 5 6 7 8 9
| - job_name: monitoring/node-exporter/0 honor_timestamps: true scrape_interval: 30s scrape_timeout: 10s metrics_path: /metrics scheme: https kubernetes_sd_configs: - role: endpoints ...
|
获取token
1
| kubectl get secret prometheus-k8s-token-sm6gd -n monitoring -o template={{.data.token}} | base64 -d
|
通过template获取secret里面的值,要通过base64解密一下的。
指标大部分以node_
开始
少许几个以promhttp_metric_
开始的指标。
指标node-exporter-node0.txt
点击查看