ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

云原生监控系统Prometheus——Exporter(Elasticsearch监控)

2022-07-15 23:31:35  阅读:140  来源: 互联网

标签:Exporter name -- Prometheus exporter elasticsearch 监控 path es


Exporter(Elasticsearch监控)

一、部署 elasticsearch_exporter

  不多bb,直接上配置清单 yaml文件:

kind: Pod
apiVersion: v1
metadata:
  name: elastic-j9qoiy-elasticsearch-exporter-598c9b47b8-vnd2p
  generateName: elastic-j9qoiy-elasticsearch-exporter-598c9b47b8-
  namespace: devops-elasticsearch-test
  labels:
    app: elasticsearch-exporter
    pod-template-hash: 598c9b47b8
    release: elastic-j9qoiy
  annotations:
    cni.projectcalico.org/containerID: 7ff05e8f80d31f38d553f592430dfa0a364541bf454da5f628a1a0810d7dd6fd
    cni.projectcalico.org/podIP: 10.233.68.42/32
    cni.projectcalico.org/podIPs: 10.233.68.42/32
    k8s.v1.cni.cncf.io/network-status: |-
      [{
          "name": "k8s-pod-network",
          "ips": [
              "10.233.68.42"
          ],
          "default": true,
          "dns": {}
      }]
    k8s.v1.cni.cncf.io/networks-status: |-
      [{
          "name": "k8s-pod-network",
          "ips": [
              "10.233.68.42"
          ],
          "default": true,
          "dns": {}
      }]
    kubesphere.io/creator: admin
spec:
  volumes:
    - name: kube-api-access-jk9l6
      projected:
        sources:
          - serviceAccountToken:
              expirationSeconds: 3607
              path: token
          - configMap:
              name: kube-root-ca.crt
              items:
                - key: ca.crt
                  path: ca.crt
          - downwardAPI:
              items:
                - path: namespace
                  fieldRef:
                    apiVersion: v1
                    fieldPath: metadata.namespace
        defaultMode: 420
  containers:
    - name: elasticsearch-exporter
      image: 'justwatch/elasticsearch_exporter:1.1.0'
      command:
        - elasticsearch_exporter
        - '--es.uri=http://localhost:9200'
        - '--es.all'
        - '--es.indices'
        - '--es.indices_settings'
        - '--es.shards'
        - '--es.snapshots'
        - '--es.timeout=30s'
        - '--web.listen-address=:9108'
        - '--web.telemetry-path=/metrics'
      ports:
        - name: http
          containerPort: 9108
          protocol: TCP
      resources: {}
      volumeMounts:
        - name: kube-api-access-jk9l6
          readOnly: true
          mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      livenessProbe:
        httpGet:
          path: /healthz
          port: http
          scheme: HTTP
        initialDelaySeconds: 5
        timeoutSeconds: 5
        periodSeconds: 5
        successThreshold: 1
        failureThreshold: 3
      readinessProbe:
        httpGet:
          path: /healthz
          port: http
          scheme: HTTP
        initialDelaySeconds: 1
        timeoutSeconds: 5
        periodSeconds: 5
        successThreshold: 1
        failureThreshold: 3
      lifecycle:
        preStop:
          exec:
            command:
              - /bin/bash
              - '-c'
              - sleep 20
      terminationMessagePath: /dev/termination-log
      terminationMessagePolicy: File
      imagePullPolicy: IfNotPresent
      securityContext:
        capabilities:
          drop:
            - SETPCAP
            - MKNOD
            - AUDIT_WRITE
            - CHOWN
            - NET_RAW
            - DAC_OVERRIDE
            - FOWNER
            - FSETID
            - KILL
            - SETGID
            - SETUID
            - NET_BIND_SERVICE
            - SYS_CHROOT
            - SETFCAP
        readOnlyRootFilesystem: true
  restartPolicy: Always
  terminationGracePeriodSeconds: 30
  dnsPolicy: ClusterFirst
  serviceAccountName: default
  serviceAccount: default
  nodeName: k8s-workernode-2-128
  securityContext:
    runAsUser: 1000
    runAsNonRoot: true
  schedulerName: default-scheduler
  tolerations:
    - key: node.kubernetes.io/not-ready
      operator: Exists
      effect: NoExecute
      tolerationSeconds: 300
    - key: node.kubernetes.io/unreachable
      operator: Exists
      effect: NoExecute
      tolerationSeconds: 300
  priority: 0
  enableServiceLinks: true
  preemptionPolicy: PreemptLowerPriority  

二、与 Prometheus 集成

  与 Prometheus 的配置文件 prometheus.yaml 中的 static_configs 模块内,继续追加配置内容来采集 elasticsearch_exporter 提供的数据。添加的参考配置内容如下: 

scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: "prometheus"

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: ["localhost:9090"]
	
  - job_name: "elasticsearch_exporter"
    static_configs:
	  - targets: ["192.168.2.121:9108"]

标签:Exporter,name,--,Prometheus,exporter,elasticsearch,监控,path,es
来源: https://www.cnblogs.com/zuoyang/p/16483095.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有