Kube-prometheus Deploy Prometheus

2024-05-15 05:20
文章标签 prometheus deploy kube

本文主要是介绍Kube-prometheus Deploy Prometheus,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

文章目录

  • Kube-prometheus Deploy Prometheus
    • 部署 Prometheus
      • 下载 Kube-prometheus
      • 查看镜像
      • 镜像 tag 重置及推送镜像到 harbor
      • 替换为 harbor 镜像仓库
      • 配置 Ingress
      • 安装
      • 访问
    • Kube-prometheus 集成 pushgateway
    • 监控 K8S 集群外节点
    • 集成 AlterManager

Kube-prometheus Deploy Prometheus

部署 Prometheus

下载 Kube-prometheus

wget -c https://github.com/prometheus-operator/kube-prometheus/archive/refs/tags/v0.11.0.tar.gz

查看镜像

grep -rn 'image: 'examples/example-app/example-app.yaml:36:        image: quay.io/fabxc/prometheus_demo_service
examples/thanos-sidecar.jsonnet:11:          image: 'quay.io/thanos/thanos:v0.19.0',
experimental/metrics-server/metrics-server-deployment.yaml:21:        image: gcr.io/google_containers/metrics-server-amd64:v0.2.0manifests/alertmanager-alertmanager.yaml:13:  image: quay.io/prometheus/alertmanager:v0.24.0
manifests/blackboxExporter-deployment.yaml:33:        image: quay.io/prometheus/blackbox-exporter:v0.21.0
manifests/blackboxExporter-deployment.yaml:60:        image: jimmidyson/configmap-reload:v0.5.0
manifests/blackboxExporter-deployment.yaml:88:        image: quay.io/brancz/kube-rbac-proxy:v0.12.0
manifests/grafana-deployment.yaml:33:        image: grafana/grafana:8.5.5
manifests/kubeStateMetrics-deployment.yaml:35:        image: k8s.gcr.io/kube-state-metrics/kube-state-metrics:v2.5.0
manifests/kubeStateMetrics-deployment.yaml:56:        image: quay.io/brancz/kube-rbac-proxy:v0.12.0
manifests/kubeStateMetrics-deployment.yaml:82:        image: quay.io/brancz/kube-rbac-proxy:v0.12.0
manifests/nodeExporter-daemonset.yaml:38:        image: quay.io/prometheus/node-exporter:v1.3.1
manifests/nodeExporter-daemonset.yaml:74:        image: quay.io/brancz/kube-rbac-proxy:v0.12.0
manifests/prometheus-prometheus.yaml:21:  image: quay.io/prometheus/prometheus:v2.36.1
manifests/prometheusAdapter-deployment.yaml:40:        image: k8s.gcr.io/prometheus-adapter/prometheus-adapter:v0.9.1
manifests/prometheusOperator-deployment.yaml:33:        image: quay.io/prometheus-operator/prometheus-operator:v0.57.0
manifests/prometheusOperator-deployment.yaml:56:        image: quay.io/brancz/kube-rbac-proxy:v0.12.0

镜像 tag 重置及推送镜像到 harbor

# docker pull gcr.io/google_containers/metrics-server-amd64:v0.2.0
# Error response from daemon: Get "https://gcr.io/v2/": dial tcp 74.125.203.82:443: connect: connection timed out
# 使用阿里云仓库
docker pull registry.aliyuncs.com/google_containers/metrics-server-amd64:v0.2.0docker pull quay.io/prometheus/alertmanager:v0.24.0
docker pull quay.io/prometheus/blackbox-exporter:v0.21.0
docker pull jimmidyson/configmap-reload:v0.5.0
docker pull quay.io/brancz/kube-rbac-proxy:v0.12.0
docker pull grafana/grafana:8.5.5# docker pull k8s.gcr.io/kube-state-metrics/kube-state-metrics:v2.5.0
# 使用阿里云仓库
# docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/kube-state-metrics/kube-state-metrics:v2.5.0
# docker pull registry.aliyuncs.com/google_containers/kube-state-metrics/kube-state-metrics:v2.5.0
# dockerhub 拉取
docker pull landv1001/kube-state-metrics:v2.5.0docker pull quay.io/brancz/kube-rbac-proxy:v0.12.0
docker pull quay.io/brancz/kube-rbac-proxy:v0.12.0
docker pull quay.io/prometheus/node-exporter:v1.3.1
docker pull quay.io/brancz/kube-rbac-proxy:v0.12.0
docker pull quay.io/prometheus/prometheus:v2.36.1# docker pull k8s.gcr.io/prometheus-adapter/prometheus-adapter:v0.9.1
# 使用阿里云仓库
# docker pull registry.aliyuncs.com/google_containers/prometheus-adapter/prometheus-adapter:v0.9.1
# dockerhub 拉取
docker pull v5cn/prometheus-adapter:v0.9.1docker pull quay.io/prometheus-operator/prometheus-operator:v0.57.0
docker pull quay.io/brancz/kube-rbac-proxy:v0.12.0docker tag registry.aliyuncs.com/google_containers/metrics-server-amd64:v0.2.0  10.83.195.8:1443/prometheus/metrics-server-amd64:v0.2.0
docker tag quay.io/prometheus/alertmanager:v0.24.0 10.83.195.8:1443/prometheus/alertmanager:v0.24.0
docker tag quay.io/prometheus/blackbox-exporter:v0.21.0 10.83.195.8:1443/prometheus/blackbox-exporter:v0.21.0
docker tag jimmidyson/configmap-reload:v0.5.0 10.83.195.8:1443/prometheus/configmap-reload:v0.5.0
docker tag quay.io/brancz/kube-rbac-proxy:v0.12.0 10.83.195.8:1443/prometheus/kube-rbac-proxy:v0.12.0
docker tag grafana/grafana:8.5.5 10.83.195.8:1443/prometheus/grafana:8.5.5
docker tag landv1001/kube-state-metrics:v2.5.0 10.83.195.8:1443/prometheus/kube-state-metrics:v2.5.0
docker tag quay.io/prometheus/node-exporter:v1.3.1 10.83.195.8:1443/prometheus/node-exporter:v1.3.1
docker tag quay.io/prometheus/prometheus:v2.36.1 10.83.195.8:1443/prometheus/prometheus:v2.36.1
docker tag v5cn/prometheus-adapter:v0.9.1 10.83.195.8:1443/prometheus/prometheus-adapter:v0.9.1
docker tag quay.io/prometheus-operator/prometheus-operator:v0.57.0 10.83.195.8:1443/prometheus/prometheus-operator:v0.57.0docker push 10.83.195.8:1443/prometheus/metrics-server-amd64:v0.2.0
docker push 10.83.195.8:1443/prometheus/alertmanager:v0.24.0
docker push 10.83.195.8:1443/prometheus/blackbox-exporter:v0.21.0
docker push 10.83.195.8:1443/prometheus/configmap-reload:v0.5.0
docker push 10.83.195.8:1443/prometheus/kube-rbac-proxy:v0.12.0
docker push 10.83.195.8:1443/prometheus/grafana:8.5.5
docker push 10.83.195.8:1443/prometheus/kube-state-metrics:v2.5.0
docker push 10.83.195.8:1443/prometheus/node-exporter:v1.3.1
docker push 10.83.195.8:1443/prometheus/prometheus:v2.36.1
docker push 10.83.195.8:1443/prometheus/prometheus-adapter:v0.9.1
docker push 10.83.195.8:1443/prometheus/prometheus-operator:v0.57.0docker pull bitnami/pushgateway:1.8.0
docker tag bitnami/pushgateway:1.8.0 10.83.195.8:1443/prometheus/pushgateway:1.8.0
docker push 10.83.195.8:1443/prometheus/pushgateway:1.8.0docker pull quay.io/prometheus-operator/prometheus-config-reloader:v0.57.0
docker tag quay.io/prometheus-operator/prometheus-config-reloader:v0.57.0 10.83.195.8:1443/prometheus/prometheus-config-reloader:v0.57.0
docker push 10.83.195.8:1443/prometheus/prometheus-config-reloader:v0.57.0

替换为 harbor 镜像仓库

# sed 's@quay.io/prometheus@10.83.195.8:1443/prometheus@g' manifests/alertmanager-alertmanager.yaml | grep '10.83.195.8:1443/prometheus
sed -i 's@quay.io/prometheus/alertmanager:v0.24.0@10.83.195.8:1443/prometheus/alertmanager:v0.24.0@g' manifests/alertmanager-alertmanager.yaml
sed -i 's@quay.io/prometheus/blackbox-exporter:v0.21.0@10.83.195.8:1443/prometheus/blackbox-exporter:v0.21.0@g' manifests/blackboxExporter-deployment.yaml
sed -i 's@jimmidyson/configmap-reload:v0.5.0@10.83.195.8:1443/prometheus/configmap-reload:v0.5.0@g' manifests/blackboxExporter-deployment.yaml
sed -i 's@quay.io/brancz/kube-rbac-proxy:v0.12.0@10.83.195.8:1443/prometheus/kube-rbac-proxy:v0.12.0@g' manifests/blackboxExporter-deployment.yaml
sed -i 's@grafana/grafana:8.5.5@10.83.195.8:1443/prometheus/grafana:8.5.5@g' manifests/grafana-deployment.yaml
sed -i 's@k8s.gcr.io/kube-state-metrics/kube-state-metrics:v2.5.0@10.83.195.8:1443/prometheus/kube-state-metrics:v2.5.0@g' manifests/kubeStateMetrics-deployment.yaml
sed -i 's@quay.io/brancz/kube-rbac-proxy:v0.12.0@10.83.195.8:1443/prometheus/kube-rbac-proxy:v0.12.0@g' manifests/kubeStateMetrics-deployment.yaml
sed -i 's@quay.io/prometheus/node-exporter:v1.3.1@10.83.195.8:1443/prometheus/node-exporter:v1.3.1@g' manifests/nodeExporter-daemonset.yaml
sed -i 's@quay.io/brancz/kube-rbac-proxy:v0.12.0@10.83.195.8:1443/prometheus/kube-rbac-proxy:v0.12.0@g' manifests/nodeExporter-daemonset.yaml
sed -i 's@quay.io/prometheus/prometheus:v2.36.1@10.83.195.8:1443/prometheus/prometheus:v2.36.1@g' manifests/prometheus-prometheus.yaml
sed -i 's@k8s.gcr.io/prometheus-adapter/prometheus-adapter:v0.9.1@10.83.195.8:1443/prometheus/prometheus-adapter:v0.9.1@g' manifests/prometheusAdapter-deployment.yaml
sed -i 's@quay.io/prometheus-operator/prometheus-operator:v0.57.0@10.83.195.8:1443/prometheus/prometheus-operator:v0.57.0@g' manifests/prometheusOperator-deployment.yaml
sed -i 's@quay.io/brancz/kube-rbac-proxy:v0.12.0@10.83.195.8:1443/prometheus/kube-rbac-proxy:v0.12.0@g' manifests/prometheusOperator-deployment.yaml
sed -i 's@quay.io/prometheus-operator/prometheus-config-reloader:v0.57.0@10.83.195.8:1443/prometheus/prometheus-config-reloader:v0.57.0@g' manifests/prometheusOperator-deployment.yaml
vim manifests/grafana-config.yaml
# 增加匿名访问,grafana数据存储到mysql
# 密码不需要base64编码grafana.ini: |[security]allow_embedding = true[date_formats]default_timezone = UTC[auth.anonymous]enabled = true[database]type = mysqlhost = xx:3306name = grafanauser = grafanapassword = xx
type: Opaque

配置 Ingress


# vim manifests/alertmanager-ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:name: alertmanager-ingressnamespace: monitoringannotations:kubernetes.io/ingress.class: "nginx"prometheus.io/http_probe: "true"
spec:rules:- host: bigdata-dev-alertmanager.ky-tech.com.cnhttp:paths:- path: /pathType: Prefixbackend:service:name: alertmanager-mainport:number: 9093tls:- hosts:- bigdata-dev-alertmanager.ky-tech.com.cn  # https域名secretName: prometheus-secret# vim manifests/grafana-ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:name: grafana-ingressnamespace: monitoringannotations:kubernetes.io/ingress.class: "nginx"prometheus.io/http_probe: "true"
spec:rules:- host: bigdata-dev-grafana.ky-tech.com.cn http:paths:- path: /pathType: Prefixbackend:service:name: grafanaport:number: 3000tls:- hosts:- bigdata-dev-grafana.ky-tech.com.cn  # https域名secretName: prometheus-secret# vim manifests/prometheus-ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:name: prometheus-ingressnamespace: monitoringannotations:kubernetes.io/ingress.class: "nginx"prometheus.io/http_probe: "true"
spec:rules:- host: bigdata-dev-prometheus.ky-tech.com.cnhttp:paths:- path: /pathType: Prefixbackend:service:name: prometheus-k8sport:number: 9090tls:- hosts:- bigdata-dev-prometheus.ky-tech.com.cn  # https域名secretName: prometheus-secret
kubectl create ns monitoringkubectl create secret tls prometheus-secret --key /data/harbor_helm/stl/ky-tech.com.cn_nginx/ky-tech.com.cn.key --cert /data/harbor_helm/stl/ky-tech.com.cn_nginx/ky-tech.com.cn_bundle.crt -n monitoring

一般Prometheus使用共享存储(如ceph等)

# 创建 StorageClass# 创建pvc
# vim prometheus-pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:name: prometheus-pvcnamespace: monitoring
spec:accessModes:- ReadWriteManyresources:requests:storage: 4TistorageClassName: bigdata-cephfsvolumeMode: Filesystem
status:accessModes:- ReadWriteManycapacity:storage: 4Tiphase: Boun
# vim prometheus-prometheus.yamlspec:retention: 90dstorage:volumeClaimTemplate:spec:storageClassName: bigdata-cephfsresources:requests:storage: 4Ti

安装

# 部署
kubectl apply --server-side -f manifests/setupkubectl wait \--for condition=Established \--all CustomResourceDefinition \--namespace=monitoringkubectl apply -f manifests/# 卸载
# kubectl delete --ignore-not-found=true -f manifests/ -f manifests/setup# 彻底删除namespace
kubectl get namespace monitoring -o json \
| tr -d "\n" | sed "s/\"finalizers\": \[[^]]\+\]/\"finalizers\": []/" \
| kubectl replace --raw /api/v1/namespaces/monitoring/finalize -f -# 报错查看日志 
kubectl describe po trino-dockerhub-coordinator-c4779585d-tdldt  -n monitoring 
kubectl logs node-exporter-fb6ql  -n monitoring  --all-containers# (combined from similar events): MountVolume.SetUp failed for volume "grafana-dashboard-persistentvolumesusage" : failed to sync configmap cache: timed out waiting for the condition
kubectl delete networkpolicy --all -n monitoring

访问

https://bigdata-dev-alertmanager.ky-tech.com.cn 
https://bigdata-dev-grafana.ky-tech.com.cn    admin/admin@13
https://bigdata-dev-prometheus.ky-tech.com.cn

Kube-prometheus 集成 pushgateway

apiVersion: apps/v1
kind: Deployment
metadata:labels:app.kubernetes.io/name: pushgateway-sdpname: pushgateway-sdpnamespace: monitoring
spec:replicas: 1selector:matchLabels:app.kubernetes.io/name: pushgateway-sdptemplate:metadata:labels:app.kubernetes.io/name: pushgateway-sdpapp: pushgatewayspec:nodeSelector:kubernetes.io/system: monitorcontainers:- args:- --web.enable-admin-api- --push.disable-consistency-checkimage: 10.83.195.8:1443/prometheus/pushgateway:1.8.0livenessProbe:failureThreshold: 10httpGet:path: /-/healthyport: 9091scheme: HTTPinitialDelaySeconds: 10periodSeconds: 10successThreshold: 1timeoutSeconds: 30name: pushgateway-sdpports:- containerPort: 9091name: httpreadinessProbe:failureThreshold: 15httpGet:path: /-/readyport: 9091scheme: HTTPinitialDelaySeconds: 10periodSeconds: 10successThreshold: 1timeoutSeconds: 30resources:limits:cpu: 16memory: 32Girequests:cpu: 4memory: 16GrestartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:labels:app.kubernetes.io/name: pushgateway-sdpname: pushgateway-sdpnamespace: monitoring
spec:type: NodePortports:- name: httpnodePort: 30091port: 9091protocol: TCPtargetPort: httpselector:app.kubernetes.io/name: pushgateway-sdp
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:labels:app.kubernetes.io/name: pushgateway-sdpname: pushgateway-sdpnamespace: monitoring
spec:endpoints:- interval: 60sscrapeTimeout: 50spath: /metricsport: httpscheme: httprelabelings:- sourceLabels:- pod targetLabel: podregex: "(.*)"replacement: pushgateway-sdp- sourceLabels:- instancetargetLabel: instanceregex: "(.*)"replacement: pushgateway-sdpselector:matchLabels:app.kubernetes.io/name: pushgateway-sdp

监控 K8S 集群外节点

---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:labels:app.kubernetes.io/name: node-exportercluster: hadoop-sdpname: hadoop-sdpnamespace: monitoring
spec:endpoints:- interval: 60sport: metrcisrelabelings:- sourceLabels:- __meta_kubernetes_service_label_dn_flagaction: replacetargetLabel: dn_flagregex: (.*)- sourceLabels:- __meta_kubernetes_service_label_nm_flagaction: replacetargetLabel: nm_flagregex: (.*)- sourceLabels:- __meta_kubernetes_service_label_clustertargetLabel: cluster- sourceLabels:- __address__targetLabel: ipregex: "(.*):(.*)"replacement: $1selector:matchLabels:app.kubernetes.io/name: node-exportercluster: hadoop-sdpnamespaceSelector:matchNames:- monitoring
---
apiVersion: v1
kind: Service
metadata:name: hadoop-sdp-dnlabels:app.kubernetes.io/name: node-exporterdn_flag: "1"cluster: hadoop-sdpnamespace: monitoring
spec:type: ClusterIPclusterIP: Noneports:- name: metrcisport: 9100targetPort: 9100protocol: TCP
---
apiVersion: v1
kind: Endpoints
metadata:name: hadoop-sdp-dnlabels:app.kubernetes.io/name: node-exporterdn_flag: "1"cluster: hadoop-sdpnamespace: monitoring
subsets:- addresses:- ip: 10.83.192.9ports:- name: metrcisport: 9100protocol: TCP
---
apiVersion: v1
kind: Service
metadata:name: hadoop-sdp-nmlabels:app.kubernetes.io/name: node-exporternm_flag: "1"cluster: hadoop-sdpnamespace: monitoring
spec:type: ClusterIPclusterIP: Noneports:- name: metrcisport: 9100targetPort: 9100protocol: TCP
---
apiVersion: v1
kind: Endpoints
metadata:name: hadoop-sdp-nmlabels:app.kubernetes.io/name: node-exporternm_flag: "1"cluster: hadoop-sdpnamespace: monitoring
subsets:- addresses:- ip: 10.83.192.9ports:- name: metrcisport: 9100protocol: TCP
---
apiVersion: v1
kind: Service
metadata:name: hadoop-sdp-nnlabels:app.kubernetes.io/name: node-exportercluster: hadoop-sdpnamespace: monitoring
spec:type: ClusterIPclusterIP: Noneports:- name: metrcisport: 9100targetPort: 9100protocol: TCP
---
apiVersion: v1
kind: Endpoints
metadata:name: hadoop-sdp-nnlabels:app.kubernetes.io/name: node-exportercluster: hadoop-sdpnamespace: monitoring
subsets:- addresses:- ip: 10.83.192.6- ip: 10.83.192.7ports:- name: metrcisport: 9100protocol: TCP

集成 AlterManager

python接收alertmanager告警服务

# !/usr/bin/env python
# -*-coding:utf-8 -*-"""
@ File       : 0513.py
@ Time       : 2024-05-13 15:43
@ Author     : Shylin Zhang
@ version    : python 3.6
@ Description:
"""
import logging
from flask import Flask, request
import json
logging.basicConfig(level=logging.INFO,format='%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s',filename="./alertmanager-webhook-run.log"
)app = Flask(__name__)@app.route("/send/", methods=["POST"])
def send():try:data = json.loads(request.data)logging.info(data)alerts = data['alerts']for i in alerts:logging.info('SEND SMS: ' + str(i))except Exception as e:logging.error(e)return 'ok'if __name__ == '__main__':app.run(host='0.0.0.0', port=8088)
# vim manifests/alertmanager-secret.yamlapiVersion: v1
kind: Secret
metadata:labels:app.kubernetes.io/component: alert-routerapp.kubernetes.io/instance: mainapp.kubernetes.io/name: alertmanagerapp.kubernetes.io/part-of: kube-prometheusapp.kubernetes.io/version: 0.24.0name: alertmanager-mainnamespace: monitoring
stringData:alertmanager.yaml: |-"global":"resolve_timeout": "5m""inhibit_rules":- "equal":- "namespace"- "alertname""source_matchers":- "severity = critical""target_matchers":- "severity =~ warning|info"- "equal":- "namespace"- "alertname""source_matchers":- "severity = warning""target_matchers":- "severity = info"- "equal":- "namespace""source_matchers":- "alertname = InfoInhibitor""target_matchers":- "severity = info""receivers":- "name": "alert-webhook""webhook_configs":- "url": "http://10.83.195.6:8088/send/"  # python接收alertmanager告警服务"send_resolved": true"max_alerts": 0- "name": "Default"- "name": "Watchdog"- "name": "Critical"- "name": "null""route":"group_by":- "namespace"- "alertname""group_interval": "5m""group_wait": "30s""receiver": "alert-webhook""repeat_interval": "24h""routes":- "matchers":- "severity = critical""receiver": "alert-webhook"- "matchers":- "severity = warning""receiver": "alert-webhook"- "matchers":- "alertname = Watchdog""receiver": "Watchdog"- "matchers":- "alertname = InfoInhibitor""receiver": "null"
type: Opaque

配置告警规则 rule

# vim manifests/rules/hadoop-server.ruleapiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:labels:prometheus: k8srole: alert-rulesname: prometheus-hadoop-rulesnamespace: monitoring
spec:groups:- name: hadoop.rulesrules:- alert: 服务器内存使用率 > 80%annotations:description: 集群[ {{ $labels.cluster}} ] 节点[ {{ $labels.ip}} ] 内存使用率 {{ printf "%.2f" $value }}%expr: |(1 - (node_memory_MemAvailable_bytes{cluster=~"hadoop-sdp"} / (node_memory_MemTotal_bytes{cluster=~"hadoop-sdp"}))) * 100 > 50for: 30slabels:severity: critical
kubectl -n monitoring logs -l 'alertmanager=main' -c alertmanager
# vim manifests/rules/hadoop-server.ruleapiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:labels:prometheus: k8srole: alert-rulesname: prometheus-hadoop-rulesnamespace: monitoring
spec:groups:- name: hadoop.rulesrules:- alert: 服务器内存使用率 > 80%annotations:description: 集群[ {{ $labels.cluster}} ] 节点[ {{ $labels.ip}} ] 内存使用率 {{ printf "%.2f" $value }}%expr: |(1 - (node_memory_MemAvailable_bytes{cluster=~"hadoop-sdp"} / (node_memory_MemTotal_bytes{cluster=~"hadoop-sdp"}))) * 100 > 50for: 30slabels:severity: critical
kubectl -n monitoring logs -l 'alertmanager=main' -c alertmanager

这篇关于Kube-prometheus Deploy Prometheus的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/990917

相关文章

【Prometheus】PromQL向量匹配实现不同标签的向量数据进行运算

✨✨ 欢迎大家来到景天科技苑✨✨ 🎈🎈 养成好习惯,先赞后看哦~🎈🎈 🏆 作者简介:景天科技苑 🏆《头衔》:大厂架构师,华为云开发者社区专家博主,阿里云开发者社区专家博主,CSDN全栈领域优质创作者,掘金优秀博主,51CTO博客专家等。 🏆《博客》:Python全栈,前后端开发,小程序开发,人工智能,js逆向,App逆向,网络系统安全,数据分析,Django,fastapi

Prometheus与Grafana在DevOps中的应用与最佳实践

Prometheus 与 Grafana 在 DevOps 中的应用与最佳实践 随着 DevOps 文化和实践的普及,监控和可视化工具已成为 DevOps 工具链中不可或缺的部分。Prometheus 和 Grafana 是其中最受欢迎的开源监控解决方案之一,它们的结合能够为系统和应用程序提供全面的监控、告警和可视化展示。本篇文章将详细探讨 Prometheus 和 Grafana 在 DevO

java后端服务监控与告警:Prometheus与Grafana集成

Java后端服务监控与告警:Prometheus与Grafana集成 大家好,我是微赚淘客返利系统3.0的小编,是个冬天不穿秋裤,天冷也要风度的程序猿! 在现代的微服务架构中,监控和告警是确保服务稳定性的关键组成部分。Prometheus和Grafana是两个强大的工具,它们可以集成在一起,为Java后端服务提供实时监控和可视化告警。 服务监控的重要性 服务监控可以帮助我们实时了解服务的健

如何使用Prometheus与Grafana监控Kubernetes集群

使用Prometheus与Grafana监控Kubernetes集群 一、引言 Kubernetes作为目前最受欢迎的容器编排工具,已经成为现代应用部署和管理的核心平台。然而,随着集群规模的扩大和复杂性的增加,对其进行有效的监控变得至关重要。Prometheus与Grafana是广泛使用的开源监控和可视化工具,能够提供强大的监控、报警和数据可视化功能。本文将详细介绍如何使用Prometheus

prometheus删除指定metrics下收集的值

Prometheus 删除指定 Metric 官方文档: ​ - https://prometheus.io/docs/prometheus/latest/querying/api/#tsdb-admin-apis Prometheus 的管理 API 接口,官方到现在一共提供了三个接口,对应的分别是快照功能、数据删除功能、数据清理功能,想要使用 API 需要先添加启动参数 --web.en

Grafana+prometheus+php 自动创建监控图

背景 在grafana+ prometheus+php 监控系统实践文章当中已经实现了我们的第一个监控图表,现在我们有了一个新需求,需要对多个节点实现不同的监控,以及一个汇总的监控; 按照我们之前手动创建仪表盘的方法,每新增一个节点都需要手动去修改prometheus配置,并且需要去grafana系统当中创建一个仪表盘,在节点很少的时候这种方式也能满足,但当节点数量多起来的时候,就会增加很大一

grafana+ prometheus+php 监控系统实践

背景 团队在开发流媒体服务,需要实现一个监控在线人数的功能,可以看到历史有多少人在线,当前有多少人在线的功能。 如果用mysql等关系型数据库来实现,可以用事件记录日志,然后通过PHP加上一些绘图的插件来实现,但这种方式并不好,首先用关系型数据库随着时间累积,会存在数据量越来越大,导致查询缓慢,再者需要编写这部分统计代码,因此并不是最佳选择。 我们很快找到了一个“时序性数据库”(promet

Prometheus异常处理

文章目录 Prometheus 的功能和使用场景功能使用场景 Docker 服务的创建和启动1. 安装 Docker2. 创建 Prometheus 配置文件3. 启动 Prometheus Docker 容器4. 访问 Prometheus 常见报错及解决方法1. 配置文件错误2. 端口冲突3. 容器无法启动4. 配置文件挂载失败5. 无法访问 Prometheus Web 界面6. 服务

干掉ELK | 使用Prometheus+Grafana搭建监控平台

点击上方蓝色字体,选择“设为星标” 回复”资源“获取更多资源 大数据技术与架构 点击右侧关注,大数据开发领域最强公众号! 暴走大数据 点击右侧关注,暴走大数据! 什么是Prometheus? Prometheus是由SoundCloud开发的开源监控报警系统和时序列数据库(TSDB)。Prometheus使用Go语言开发,是Google BorgMon监控系统的开源版本。 Promet

Flink实战(七十):监控(二)搭建flink可视化监控 Pushgateway+ Prometheus + Grafana (windows )

1 Flink 的配置: 在flink配置⽂件flink-conf.yaml中添加: metrics.reporter.promgateway.class:org.apache.flink.metrics.prometheus.PrometheusPushGatewayReportermetrics.reporter.promgateway.host: localhost # pr