consul

cm-consul-config

  1. {
  2. "acl": {
  3. "enabled": true,
  4. "default_policy": "deny",
  5. "enable_token_persistence": true,
  6. "tokens": {
  7. "master": "XlPxO1ei7E4BjAen"
  8. }
  9. }
  10. }

cm-consul-services

  1. {
  2. "services": [
  3. {
  4. "id": "腾讯云-重庆",
  5. "name": "node_exporter",
  6. "tags": [
  7. "prometheus"
  8. ],
  9. "address": "129.28.176.131",
  10. "port": 9745,
  11. "meta": {
  12. "group": "services",
  13. "env": "prod"
  14. },
  15. "token": "XlPxO1ei7E4BjAen"
  16. },
  17. {
  18. "id": "阿里云-演示",
  19. "name": "node_exporter",
  20. "tags": [
  21. "prometheus"
  22. ],
  23. "address": "8.130.25.139",
  24. "port": 9100,
  25. "meta": {
  26. "group": "services",
  27. "env": "prod"
  28. },
  29. "token": "XlPxO1ei7E4BjAen"
  30. },
  31. {
  32. "id": "阿里云-张家口-devops",
  33. "name": "node_exporter",
  34. "tags": [
  35. "prometheus"
  36. ],
  37. "address": "39.100.198.227",
  38. "port": 8253,
  39. "meta": {
  40. "group": "services",
  41. "env": "prod"
  42. },
  43. "token": "XlPxO1ei7E4BjAen"
  44. }
  45. ]
  46. }

deployment

  1. kind: Deployment
  2. apiVersion: apps/v1
  3. metadata:
  4. name: consul
  5. namespace: monitor
  6. labels:
  7. app: consul
  8. annotations:
  9. deployment.kubernetes.io/revision: '14'
  10. kubesphere.io/alias-name: ''
  11. kubesphere.io/creator: zhaowei
  12. spec:
  13. replicas: 1
  14. selector:
  15. matchLabels:
  16. app: consul
  17. template:
  18. metadata:
  19. creationTimestamp: null
  20. labels:
  21. app: consul
  22. annotations:
  23. kubesphere.io/restartedAt: '2022-02-07T06:38:59.797Z'
  24. logging.kubesphere.io/logsidecar-config: '{}'
  25. spec:
  26. volumes:
  27. - name: host-time
  28. hostPath:
  29. path: /etc/localtime
  30. type: ''
  31. - name: volume-92fcfw
  32. configMap:
  33. name: cm-consul-config
  34. defaultMode: 420
  35. - name: volume-escwev
  36. configMap:
  37. name: cm-consul-services
  38. defaultMode: 420
  39. containers:
  40. - name: container-consul
  41. image: consul
  42. ports:
  43. - name: tcp-8500
  44. containerPort: 8500
  45. protocol: TCP
  46. resources: {}
  47. volumeMounts:
  48. - name: host-time
  49. readOnly: true
  50. mountPath: /etc/localtime
  51. - name: volume-92fcfw
  52. readOnly: true
  53. mountPath: /consul/config/acl.json
  54. subPath: acl.json
  55. - name: volume-escwev
  56. readOnly: true
  57. mountPath: /consul/config/services.json
  58. subPath: services.json
  59. terminationMessagePath: /dev/termination-log
  60. terminationMessagePolicy: File
  61. imagePullPolicy: IfNotPresent
  62. restartPolicy: Always
  63. terminationGracePeriodSeconds: 30
  64. dnsPolicy: ClusterFirst
  65. serviceAccountName: default
  66. serviceAccount: default
  67. securityContext: {}
  68. affinity: {}
  69. schedulerName: default-scheduler
  70. strategy:
  71. type: RollingUpdate
  72. rollingUpdate:
  73. maxUnavailable: 25%
  74. maxSurge: 25%
  75. revisionHistoryLimit: 10
  76. progressDeadlineSeconds: 600

prometheus

cm-prometheus

对象采集改为为 consul 服务发现

  1. # my global config
  2. global:
  3. scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  4. evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  5. # scrape_timeout is set to the global default (10s).
  6. # Alertmanager configuration
  7. alerting:
  8. alertmanagers:
  9. - static_configs:
  10. - targets: ['svc-alertmanager.monitor:9093']
  11. basic_auth:
  12. username: prometheus
  13. password: XlPxO1ei7E4BjAen
  14. # Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
  15. rule_files:
  16. - /etc/prometheus/rules/*.yml
  17. # A scrape configuration containing exactly one endpoint to scrape:
  18. # 这里表示抓取对象的配置
  19. # Here it's Prometheus itself.
  20. # 这里是抓取promethues自身的配置
  21. scrape_configs:
  22. # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  23. # 这个配置是表示在这个配置内的时间序例,每一条都会自动添加上这个{job_name:"prometheus"}的标签。
  24. # - job_name: "腾讯云-重庆"
  25. # scrape_interval: 15s
  26. # static_configs:
  27. # - targets: ["129.28.176.131:9745"]
  28. # basic_auth:
  29. # username: prometheus
  30. # password: XlPxO1ei7E4BjAen
  31. # - job_name: "阿里云-演示"
  32. # scrape_interval: 15s
  33. # static_configs:
  34. # - targets: ["8.130.25.139:9100"]
  35. # basic_auth:
  36. # username: prometheus
  37. # password: XlPxO1ei7E4BjAen
  38. # - job_name: "阿里云-张家口-devops"
  39. # scrape_interval: 15s
  40. # static_configs:
  41. # - targets: ["39.100.198.227:8253"]
  42. # basic_auth:
  43. # username: prometheus
  44. # password: XlPxO1ei7E4BjAen
  45. - job_name: 'osvlab服务器'
  46. consul_sd_configs:
  47. - server: 'svc-consul.monitor:8500'
  48. token: 'XlPxO1ei7E4BjAen'
  49. services: ['node_exporter']
  50. relabel_configs:
  51. - regex: __meta_consul_service_metadata_(.+)
  52. action: labelmap
  53. - regex: __meta_consul_(service_id)
  54. action: labelmap
  55. - source_labels:
  56. - "__meta_consul_service_id"
  57. regex: "(.*)"
  58. target_label: "nodename"
  59. action: replace
  60. replacement: "$1"
  61. basic_auth:
  62. username: prometheus
  63. password: XlPxO1ei7E4BjAen

cm-prometheus-rules
包含了几个规则

  1. kind: ConfigMap
  2. apiVersion: v1
  3. metadata:
  4. name: cm-prometheus-rules
  5. namespace: monitor
  6. annotations:
  7. kubesphere.io/creator: mafei
  8. data:
  9. cpu_over.yml: |
  10. groups:
  11. - name: CPU报警规则
  12. rules:
  13. - alert: CPU使用率告警 # 警告名
  14. # 触发规则
  15. expr: 100 - (avg by(instance) (irate(node_cpu_seconds_total{mode="idle", service_id!="阿里云-张家口-devops"}[1m]))) * 100 > 80
  16. # 规则触发持续多长时间发送告警
  17. for: 30m
  18. # 告警附加标签
  19. labels:
  20. severity: warning
  21. # 告警附加注释
  22. annotations:
  23. summary: "CPU使用率正在飙升。"
  24. description: "CPU使用率超过80%(当前值:{{ humanize $value }}%)"
  25. cpu_over_aliyun-zhangjiakou-devops.yml: |
  26. groups:
  27. - name: CPU报警规则
  28. rules:
  29. - alert: CPU使用率告警 # 警告名
  30. # 触发规则
  31. expr: 100 - (avg by(instance) (irate(node_cpu_seconds_total{mode="idle", service_id="阿里云-张家口-devops"}[1m]))) * 100 > 90
  32. # 规则触发持续多长时间发送告警
  33. for: 30m
  34. # 告警附加标签
  35. labels:
  36. severity: warning
  37. # 告警附加注释
  38. annotations:
  39. summary: "CPU使用率正在飙升。"
  40. description: "CPU使用率超过90%(当前值:{{ humanize $value }}%)"
  41. disk_over.yml: |
  42. groups:
  43. - name: 磁盘使用率报警规则
  44. rules:
  45. - alert: 磁盘使用率告警
  46. expr: 100 - node_filesystem_free_bytes{fstype=~"xfs|ext4"} / node_filesystem_size_bytes{fstype=~"xfs|ext4"} * 100 > 80
  47. # 规则触发持续多长时间发送告警
  48. for: 30m
  49. labels:
  50. severity: warning
  51. annotations:
  52. summary: "硬盘分区使用率过高"
  53. description: "分区使用大于80%(当前值:{{ humanize $value }}%)"
  54. memory_over.yml: |
  55. groups:
  56. - name: 内存报警规则
  57. rules:
  58. - alert: 内存使用率告警
  59. expr: (1 - (node_memory_MemAvailable_bytes{service_id!="阿里云-张家口-devops"} / (node_memory_MemTotal_bytes{service_id!="阿里云-张家口-devops"}))) * 100 > 80
  60. for: 30m
  61. labels:
  62. severity: warning
  63. annotations:
  64. summary: "服务器可用内存不足。"
  65. description: "内存使用率已超过80%(当前值:{{ humanize $value }}%)"
  66. memory_over_aliyun-zhangjiakou-devops.yml: |
  67. groups:
  68. - name: 内存报警规则
  69. rules:
  70. - alert: 内存使用率告警
  71. expr: (1 - (node_memory_MemAvailable_bytes{service_id="阿里云-张家口-devops"} / (node_memory_MemTotal_bytes{service_id="阿里云-张家口-devops"}))) * 100 > 90
  72. for: 30m
  73. labels:
  74. severity: warning
  75. annotations:
  76. summary: "服务器可用内存不足。"
  77. description: "内存使用率已超过90%(当前值:{{ humanize $value }}%)"
  78. node_alived.yml: |
  79. groups:
  80. - name: 实例存活告警规则
  81. rules:
  82. - alert: 实例存活告警
  83. expr: up == 0
  84. for: 1m
  85. labels:
  86. user: prometheus
  87. severity: critical
  88. annotations:
  89. summary: "主机宕机 !!!"
  90. description: "该实例主机已经宕机超过一分钟了。"

deployment

  1. kind: Deployment
  2. apiVersion: apps/v1
  3. metadata:
  4. name: prometheus
  5. namespace: monitor
  6. labels:
  7. app: prometheus
  8. annotations:
  9. deployment.kubernetes.io/revision: '13'
  10. kubesphere.io/creator: mafei
  11. spec:
  12. replicas: 1
  13. selector:
  14. matchLabels:
  15. app: prometheus
  16. template:
  17. metadata:
  18. creationTimestamp: null
  19. labels:
  20. app: prometheus
  21. annotations:
  22. kubesphere.io/restartedAt: '2022-02-07T06:41:00.436Z'
  23. logging.kubesphere.io/logsidecar-config: '{}'
  24. spec:
  25. volumes:
  26. - name: host-time
  27. hostPath:
  28. path: /etc/localtime
  29. type: ''
  30. - name: volume-main-config
  31. configMap:
  32. name: cm-prometheus
  33. defaultMode: 420
  34. - name: volume-rules
  35. configMap:
  36. name: cm-prometheus-rules
  37. defaultMode: 420
  38. - name: volume-data
  39. persistentVolumeClaim:
  40. claimName: pvc-prometheus
  41. - name: volume-web-config
  42. configMap:
  43. name: cm-prometheus-web-config
  44. defaultMode: 420
  45. containers:
  46. - name: container-2mxqgu
  47. image: 'prom/prometheus:v2.32.0-rc.1'
  48. command:
  49. - /bin/prometheus
  50. args:
  51. - '--config.file=/etc/prometheus/prometheus.yml'
  52. - '--web.config.file=/etc/prometheus/web-config.yml'
  53. - '--web.external-url=http://shinetechzz.tpddns.cn:32177/'
  54. - '--web.enable-lifecycle'
  55. - '--storage.tsdb.retention.time=7d'
  56. - '--storage.tsdb.retention.size=10GB'
  57. ports:
  58. - name: tcp-9090
  59. containerPort: 9090
  60. protocol: TCP
  61. resources: {}
  62. volumeMounts:
  63. - name: host-time
  64. readOnly: true
  65. mountPath: /etc/localtime
  66. - name: volume-main-config
  67. readOnly: true
  68. mountPath: /etc/prometheus/prometheus.yml
  69. subPath: prometheus.yml
  70. - name: volume-rules
  71. readOnly: true
  72. mountPath: /etc/prometheus/rules
  73. - name: volume-data
  74. mountPath: /data
  75. - name: volume-web-config
  76. readOnly: true
  77. mountPath: /etc/prometheus/web-config.yml
  78. subPath: web-config.yml
  79. terminationMessagePath: /dev/termination-log
  80. terminationMessagePolicy: File
  81. imagePullPolicy: IfNotPresent
  82. restartPolicy: Always
  83. terminationGracePeriodSeconds: 30
  84. dnsPolicy: ClusterFirst
  85. serviceAccountName: default
  86. serviceAccount: default
  87. securityContext: {}
  88. affinity: {}
  89. schedulerName: default-scheduler
  90. strategy:
  91. type: RollingUpdate
  92. rollingUpdate:
  93. maxUnavailable: 25%
  94. maxSurge: 25%
  95. revisionHistoryLimit: 10
  96. progressDeadlineSeconds: 600

cm-prometheus-web-config

  1. kind: ConfigMap
  2. apiVersion: v1
  3. metadata:
  4. name: cm-prometheus-web-config
  5. namespace: monitor
  6. annotations:
  7. kubesphere.io/creator: mafei
  8. data:
  9. cm-prometheus-web-config: ''
  10. web-config.yml: |-
  11. basic_auth_users:
  12. prometheus: $2y$10$Os6PjwgYFiKspBMPw5uRXu2zagy96E.dFqhZywaUphuNSEjzfN742

alertmanger

  1. kind: ConfigMap
  2. apiVersion: v1
  3. metadata:
  4. name: cm-alertmanger
  5. namespace: monitor
  6. annotations:
  7. kubesphere.io/creator: mafei
  8. data:
  9. alertmanager.yml: |-
  10. global:
  11. # 每一分钟检查一次是否恢复
  12. resolve_timeout: 1m
  13. smtp_from: 'mafei7@126.com'
  14. # The default hostname to identify to the SMTP server.
  15. smtp_hello: '126.com'
  16. smtp_smarthost: 'smtp.126.com:465'
  17. smtp_auth_username: 'mafei7@126.com'
  18. smtp_auth_password: 'RNPEBMEVLKMEAJUW'
  19. smtp_require_tls: false
  20. # 所有报警信息进入后的根路由,用来设置报警的分发策略
  21. route:
  22. # 进来的报警信息会带有标签,指定根据哪些标签进行分组
  23. group_by: [alertname]
  24. # 组告警等待时间。也就是告警产生后等待30s,如果有同组告警一起发出
  25. group_wait: 30s
  26. # 两组告警的间隔时间
  27. group_interval: 3m
  28. # 重复告警的间隔时间,减少相同告警的发送频率
  29. repeat_interval: 3h
  30. #设置默认接收人
  31. receiver: 'webhook'
  32. # 子路由, 用来覆盖配置
  33. routes:
  34. - receiver: webhook
  35. continue: true
  36. group_wait: 30s
  37. group_interval: 3m
  38. repeat_interval: 3h
  39. - receiver: email
  40. continue: true
  41. group_wait: 30s
  42. group_interval: 3m
  43. repeat_interval: 3h
  44. matchers:
  45. - severity = critical
  46. receivers:
  47. - name: 'webhook'
  48. webhook_configs:
  49. - url: http://svc-prometheus-alert.monitor:8080/prometheusalert?type=dd&tpl=prometheus-dd
  50. #警报被解决之后是否通知
  51. send_resolved: true
  52. - name: 'email'
  53. email_configs:
  54. - to: 'mafeifan@qq.com, maf@shinetechsoftware.com, zhaowe1@shinetechsoftware.com'
  55. send_resolved: true
  1. kind: Deployment
  2. apiVersion: apps/v1
  3. metadata:
  4. name: alertmanager
  5. namespace: monitor
  6. labels:
  7. app: alertmanager
  8. annotations:
  9. deployment.kubernetes.io/revision: '6'
  10. kubesphere.io/creator: mafei
  11. spec:
  12. replicas: 1
  13. selector:
  14. matchLabels:
  15. app: alertmanager
  16. template:
  17. metadata:
  18. creationTimestamp: null
  19. labels:
  20. app: alertmanager
  21. annotations:
  22. kubesphere.io/restartedAt: '2022-02-07T06:42:18.778Z'
  23. logging.kubesphere.io/logsidecar-config: '{}'
  24. spec:
  25. volumes:
  26. - name: host-time
  27. hostPath:
  28. path: /etc/localtime
  29. type: ''
  30. - name: volume-config
  31. configMap:
  32. name: cm-alertmanger
  33. defaultMode: 420
  34. - name: volume-web-config
  35. configMap:
  36. name: cm-prometheus-web-config
  37. defaultMode: 420
  38. containers:
  39. - name: container-alertmanager
  40. image: 'prom/alertmanager:v0.23.0'
  41. command:
  42. - /bin/alertmanager
  43. args:
  44. - '--config.file=/etc/alertmanager/alertmanager.yml'
  45. - '--web.config.file=/etc/alertmanager/web-config.yml'
  46. - '--web.external-url=http://shinetechzz.tpddns.cn:32178/'
  47. - '--storage.path=/alertmanager'
  48. ports:
  49. - name: tcp-9093
  50. containerPort: 9093
  51. protocol: TCP
  52. resources: {}
  53. volumeMounts:
  54. - name: host-time
  55. readOnly: true
  56. mountPath: /etc/localtime
  57. - name: volume-config
  58. readOnly: true
  59. mountPath: /etc/alertmanager/alertmanager.yml
  60. subPath: alertmanager.yml
  61. - name: volume-web-config
  62. readOnly: true
  63. mountPath: /etc/alertmanager/web-config.yml
  64. subPath: web-config.yml
  65. terminationMessagePath: /dev/termination-log
  66. terminationMessagePolicy: File
  67. imagePullPolicy: IfNotPresent
  68. restartPolicy: Always
  69. terminationGracePeriodSeconds: 30
  70. dnsPolicy: ClusterFirst
  71. serviceAccountName: default
  72. serviceAccount: default
  73. securityContext: {}
  74. affinity: {}
  75. schedulerName: default-scheduler
  76. strategy:
  77. type: RollingUpdate
  78. rollingUpdate:
  79. maxUnavailable: 25%
  80. maxSurge: 25%
  81. revisionHistoryLimit: 10
  82. progressDeadlineSeconds: 600

prometheus-alert

自带界面,可以配置钉钉模板
image.png

  1. kind: Deployment
  2. apiVersion: apps/v1
  3. metadata:
  4. name: prometheus-alert
  5. namespace: monitor
  6. labels:
  7. app: prometheus-alert
  8. annotations:
  9. deployment.kubernetes.io/revision: '2'
  10. kubesphere.io/creator: zhaowei
  11. spec:
  12. replicas: 1
  13. selector:
  14. matchLabels:
  15. app: prometheus-alert
  16. template:
  17. metadata:
  18. creationTimestamp: null
  19. labels:
  20. app: prometheus-alert
  21. annotations:
  22. logging.kubesphere.io/logsidecar-config: '{}'
  23. spec:
  24. volumes:
  25. - name: host-time
  26. hostPath:
  27. path: /etc/localtime
  28. type: ''
  29. - name: volume-5t19zf
  30. configMap:
  31. name: cm-prometheus-alert
  32. defaultMode: 420
  33. containers:
  34. - name: prometheus-alert
  35. image: feiyu563/prometheus-alert
  36. ports:
  37. - name: http-8080
  38. containerPort: 8080
  39. protocol: TCP
  40. resources: {}
  41. volumeMounts:
  42. - name: host-time
  43. readOnly: true
  44. mountPath: /etc/localtime
  45. - name: volume-5t19zf
  46. readOnly: true
  47. mountPath: /app/conf/app.conf
  48. subPath: app.conf
  49. terminationMessagePath: /dev/termination-log
  50. terminationMessagePolicy: File
  51. imagePullPolicy: IfNotPresent
  52. restartPolicy: Always
  53. terminationGracePeriodSeconds: 30
  54. dnsPolicy: ClusterFirst
  55. serviceAccountName: default
  56. serviceAccount: default
  57. securityContext: {}
  58. affinity: {}
  59. schedulerName: default-scheduler
  60. strategy:
  61. type: RollingUpdate
  62. rollingUpdate:
  63. maxUnavailable: 25%
  64. maxSurge: 25%
  65. revisionHistoryLimit: 10
  66. progressDeadlineSeconds: 600

cm-prometheus-alert

  1. kind: ConfigMap
  2. apiVersion: v1
  3. metadata:
  4. name: cm-prometheus-alert
  5. namespace: monitor
  6. annotations:
  7. kubesphere.io/creator: zhaowei
  8. data:
  9. app.conf: >-
  10. #---------------------↓全局配置-----------------------
  11. appname = PrometheusAlert
  12. #登录用户名
  13. login_user=prometheus
  14. #登录密码
  15. login_password=XlPxO1ei7E4BjAen
  16. #监听地址
  17. httpaddr = "0.0.0.0"
  18. #监听端口
  19. httpport = 8080
  20. runmode = dev
  21. #设置代理 proxy = http://123.123.123.123:8080
  22. proxy =
  23. #开启JSON请求
  24. copyrequestbody = true
  25. #告警消息标题
  26. title=Prometheus
  27. #链接到告警平台地址
  28. GraylogAlerturl=http://graylog.org
  29. #钉钉告警 告警logo图标地址
  30. logourl=https://raw.githubusercontent.com/feiyu563/PrometheusAlert/master/doc/alert-center.png
  31. #钉钉告警 恢复logo图标地址
  32. rlogourl=https://raw.githubusercontent.com/feiyu563/PrometheusAlert/master/doc/alert-center.png
  33. #短信告警级别(等于3就进行短信告警) 告警级别定义 0 信息,1 警告,2 一般严重,3 严重,4 灾难
  34. messagelevel=3
  35. #电话告警级别(等于4就进行语音告警) 告警级别定义 0 信息,1 警告,2 一般严重,3 严重,4 灾难
  36. phonecalllevel=4
  37. #默认拨打号码(页面测试短信和电话功能需要配置此项)
  38. defaultphone=xxxxxxxx
  39. #故障恢复是否启用电话通知0为关闭,1为开启
  40. phonecallresolved=0
  41. #自动告警抑制(自动告警抑制是默认同一个告警源的告警信息只发送告警级别最高的第一条告警信息,其他消息默认屏蔽,这么做的目的是为了减少相同告警来源的消息数量,防止告警炸弹,0为关闭,1为开启)
  42. silent=0
  43. #是否前台输出file or console
  44. logtype=file
  45. #日志文件路径
  46. logpath=logs/prometheusalertcenter.log
  47. #转换Prometheus,graylog告警消息的时区为CST时区(如默认已经是CST时区,请勿开启)
  48. prometheus_cst_time=0
  49. #数据库驱动,支持sqlite3,mysql,postgres如使用mysql或postgres,请开启db_host,db_port,db_user,db_password,db_name的注释
  50. db_driver=sqlite3
  51. #db_host=127.0.0.1
  52. #db_port=3306
  53. #db_user=root
  54. #db_password=root
  55. #db_name=prometheusalert
  56. #是否开启告警记录 0为关闭,1为开启
  57. AlertRecord=0
  58. #---------------------↓webhook-----------------------
  59. #是否开启钉钉告警通道,可同时开始多个通道0为关闭,1为开启
  60. open-dingding=1
  61. #默认钉钉机器人地址
  62. ddurl=https://oapi.dingtalk.com/robot/send?access_token=1c3bfef63f32e4ee6a4e38f2f3ad8c321af108b0b4fe4efcef8c8498a0689cf3
  63. #是否开启 @所有人(0为关闭,1为开启)
  64. dd_isatall=1
  65. #是否开启微信告警通道,可同时开始多个通道0为关闭,1为开启
  66. open-weixin=0
  67. #默认企业微信机器人地址
  68. wxurl=https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxxxx
  69. #是否开启飞书告警通道,可同时开始多个通道0为关闭,1为开启
  70. open-feishu=0
  71. #默认飞书机器人地址
  72. fsurl=https://open.feishu.cn/open-apis/bot/hook/xxxxxxxxx
  73. #---------------------↓腾讯云接口-----------------------
  74. #是否开启腾讯云短信告警通道,可同时开始多个通道0为关闭,1为开启
  75. open-txdx=0
  76. #腾讯云短信接口key
  77. TXY_DX_appkey=xxxxx
  78. #腾讯云短信模版ID 腾讯云短信模版配置可参考 prometheus告警:{1}
  79. TXY_DX_tpl_id=xxxxx
  80. #腾讯云短信sdk app id
  81. TXY_DX_sdkappid=xxxxx
  82. #腾讯云短信签名 根据自己审核通过的签名来填写
  83. TXY_DX_sign=腾讯云
  84. #是否开启腾讯云电话告警通道,可同时开始多个通道0为关闭,1为开启
  85. open-txdh=0
  86. #腾讯云电话接口key
  87. TXY_DH_phonecallappkey=xxxxx
  88. #腾讯云电话模版ID
  89. TXY_DH_phonecalltpl_id=xxxxx
  90. #腾讯云电话sdk app id
  91. TXY_DH_phonecallsdkappid=xxxxx
  92. #---------------------↓华为云接口-----------------------
  93. #是否开启华为云短信告警通道,可同时开始多个通道0为关闭,1为开启
  94. open-hwdx=0
  95. #华为云短信接口key
  96. HWY_DX_APP_Key=xxxxxxxxxxxxxxxxxxxxxx
  97. #华为云短信接口Secret
  98. HWY_DX_APP_Secret=xxxxxxxxxxxxxxxxxxxxxx
  99. #华为云APP接入地址(端口接口地址)
  100. HWY_DX_APP_Url=https://rtcsms.cn-north-1.myhuaweicloud.com:10743
  101. #华为云短信模板ID
  102. HWY_DX_Templateid=xxxxxxxxxxxxxxxxxxxxxx
  103. #华为云签名名称,必须是已审核通过的,与模板类型一致的签名名称,按照自己的实际签名填写
  104. HWY_DX_Signature=华为云
  105. #华为云签名通道号
  106. HWY_DX_Sender=xxxxxxxxxx
  107. #---------------------↓阿里云接口-----------------------
  108. #是否开启阿里云短信告警通道,可同时开始多个通道0为关闭,1为开启
  109. open-alydx=0
  110. #阿里云短信主账号AccessKey的ID
  111. ALY_DX_AccessKeyId=xxxxxxxxxxxxxxxxxxxxxx
  112. #阿里云短信接口密钥
  113. ALY_DX_AccessSecret=xxxxxxxxxxxxxxxxxxxxxx
  114. #阿里云短信签名名称
  115. ALY_DX_SignName=阿里云
  116. #阿里云短信模板ID
  117. ALY_DX_Template=xxxxxxxxxxxxxxxxxxxxxx
  118. #是否开启阿里云电话告警通道,可同时开始多个通道0为关闭,1为开启
  119. open-alydh=0
  120. #阿里云电话主账号AccessKey的ID
  121. ALY_DH_AccessKeyId=xxxxxxxxxxxxxxxxxxxxxx
  122. #阿里云电话接口密钥
  123. ALY_DH_AccessSecret=xxxxxxxxxxxxxxxxxxxxxx
  124. #阿里云电话被叫显号,必须是已购买的号码
  125. ALY_DX_CalledShowNumber=xxxxxxxxx
  126. #阿里云电话文本转语音(TTS)模板ID
  127. ALY_DH_TtsCode=xxxxxxxx
  128. #---------------------↓容联云接口-----------------------
  129. #是否开启容联云电话告警通道,可同时开始多个通道0为关闭,1为开启
  130. RLY_DH_open-rlydh=0
  131. #容联云基础接口地址
  132. RLY_URL=https://app.cloopen.com:8883/2013-12-26/Accounts/
  133. #容联云后台SID
  134. RLY_ACCOUNT_SID=xxxxxxxxxxx
  135. #容联云api-token
  136. RLY_ACCOUNT_TOKEN=xxxxxxxxxx
  137. #容联云app_id
  138. RLY_APP_ID=xxxxxxxxxxxxx
  139. #---------------------↓邮件配置-----------------------
  140. #是否开启邮件
  141. open-email=0
  142. #邮件发件服务器地址
  143. Email_host=smtp.qq.com
  144. #邮件发件服务器端口
  145. Email_port=465
  146. #邮件帐号
  147. Email_user=xxxxxxx@qq.com
  148. #邮件密码
  149. Email_password=xxxxxx
  150. #邮件标题
  151. Email_title=运维告警
  152. #默认发送邮箱
  153. Default_emails=xxxxx@qq.com,xxxxx@qq.com
  154. #---------------------↓七陌云接口-----------------------
  155. #是否开启七陌短信告警通道,可同时开始多个通道0为关闭,1为开启
  156. open-7moordx=0
  157. #七陌账户ID
  158. 7MOOR_ACCOUNT_ID=Nxxx
  159. #七陌账户APISecret
  160. 7MOOR_ACCOUNT_APISECRET=xxx
  161. #七陌账户短信模板编号
  162. 7MOOR_DX_TEMPLATENUM=n
  163. #注意:七陌短信变量这里只用一个var1,在代码里写死了。
  164. #-----------
  165. #是否开启七陌webcall语音通知告警通道,可同时开始多个通道0为关闭,1为开启
  166. open-7moordh=0
  167. #请在七陌平台添加虚拟服务号、文本节点
  168. #七陌账户webcall的虚拟服务号
  169. 7MOOR_WEBCALL_SERVICENO=xxx
  170. # 文本节点里被替换的变量,我配置的是text。如果被替换的变量不是text,请修改此配置
  171. 7MOOR_WEBCALL_VOICE_VAR=text
  172. #---------------------↓telegram接口-----------------------
  173. #是否开启telegram告警通道,可同时开始多个通道0为关闭,1为开启
  174. open-tg=0
  175. #tg机器人token
  176. TG_TOKEN=xxxxx
  177. #tg消息模式 个人消息或者频道消息 0为关闭(推送给个人),1为开启(推送给频道)
  178. TG_MODE_CHAN=0
  179. #tg用户ID
  180. TG_USERID=xxxxx
  181. #tg频道name或者id, 频道name需要以@开始
  182. TG_CHANNAME=xxxxx
  183. #tg api地址, 可以配置为代理地址
  184. #TG_API_PROXY="https://api.telegram.org/bot%s/%s"
  185. #---------------------↓workwechat接口-----------------------
  186. #是否开启workwechat告警通道,可同时开始多个通道0为关闭,1为开启
  187. open-workwechat=0
  188. # 企业ID
  189. WorkWechat_CropID=xxxxx
  190. # 应用ID
  191. WorkWechat_AgentID=xxxx
  192. # 应用secret
  193. WorkWechat_AgentSecret=xxxx
  194. # 接受用户
  195. WorkWechat_ToUser="zhangsan|lisi"
  196. # 接受部门
  197. WorkWechat_ToParty="ops|dev"
  198. # 接受标签
  199. WorkWechat_ToTag=""
  200. # 消息类型, 暂时只支持markdown
  201. # WorkWechat_Msgtype = "markdown"
  202. #---------------------↓百度云接口-----------------------
  203. #是否开启百度云短信告警通道,可同时开始多个通道0为关闭,1为开启
  204. open-baidudx=0
  205. #百度云短信接口AK(ACCESS_KEY_ID)
  206. BDY_DX_AK=xxxxx
  207. #百度云短信接口SK(SECRET_ACCESS_KEY)
  208. BDY_DX_SK=xxxxx
  209. #百度云短信ENDPOINT(ENDPOINT参数需要用指定区域的域名来进行定义,如服务所在区域为北京,则为)
  210. BDY_DX_ENDPOINT=http://smsv3.bj.baidubce.com
  211. #百度云短信模版ID,根据自己审核通过的模版来填写(模版支持一个参数code:如prometheus告警:{code})
  212. BDY_DX_TEMPLATE_ID=xxxxx
  213. #百度云短信签名ID,根据自己审核通过的签名来填写
  214. TXY_DX_SIGNATURE_ID=xxxxx
  215. #---------------------↓百度Hi(如流)-----------------------
  216. #是否开启百度Hi(如流)告警通道,可同时开始多个通道0为关闭,1为开启
  217. open-ruliu=0
  218. #默认百度Hi(如流)机器人地址
  219. BDRL_URL=https://api.im.baidu.com/api/msg/groupmsgsend?access_token=xxxxxxxxxxxxxx
  220. #百度Hi(如流)群ID
  221. BDRL_ID=123456
  222. #---------------------↓bark接口-----------------------
  223. #是否开启telegram告警通道,可同时开始多个通道0为关闭,1为开启
  224. open-bark=0
  225. #bark默认地址, 建议自行部署bark-server
  226. BARK_URL=https://api.day.app
  227. #bark key, 多个key使用分割
  228. BARK_KEYS=xxxxx
  229. # 复制, 推荐开启
  230. BARK_COPY=1
  231. # 历史记录保存,推荐开启
  232. BARK_ARCHIVE=1
  233. # 消息分组
  234. BARK_GROUP=PrometheusAlert

Grafana

  1. kind: ConfigMap
  2. apiVersion: v1
  3. metadata:
  4. name: cm-grafana
  5. namespace: monitor
  6. annotations:
  7. kubesphere.io/creator: mafei
  8. data:
  9. grafana.ini: >-
  10. ##################### Grafana Configuration Example #####################
  11. #
  12. # Everything has defaults so you only need to uncomment things you want to
  13. # change
  14. # possible values : production, development
  15. ;app_mode = production
  16. # instance name, defaults to HOSTNAME environment variable value or hostname
  17. if HOSTNAME var is empty
  18. ;instance_name = ${HOSTNAME}
  19. #################################### Paths
  20. ####################################
  21. [paths]
  22. # Path to where grafana can store temp files, sessions, and the sqlite3 db
  23. (if that is used)
  24. ;data = /var/lib/grafana
  25. # Temporary files in `data` directory older than given duration will be
  26. removed
  27. ;temp_data_lifetime = 24h
  28. # Directory where grafana can store logs
  29. ;logs = /var/log/grafana
  30. # Directory where grafana will automatically scan and look for plugins
  31. ;plugins = /var/lib/grafana/plugins
  32. # folder that contains provisioning config files that grafana will apply on
  33. startup and while running.
  34. ;provisioning = conf/provisioning
  35. #################################### Server
  36. ####################################
  37. [server]
  38. # Protocol (http, https, h2, socket)
  39. ;protocol = http
  40. # The ip address to bind to, empty will bind to all interfaces
  41. ;http_addr =
  42. # The http port to use
  43. ;http_port = 3000
  44. # The public facing domain name used to access grafana from a browser
  45. ;domain = localhost
  46. # Redirect to correct domain if host header does not match domain
  47. # Prevents DNS rebinding attacks
  48. ;enforce_domain = false
  49. # The full public facing url you use in browser, used for redirects and
  50. emails
  51. # If you use reverse proxy and sub path specify full url (with sub path)
  52. ;root_url = %(protocol)s://%(domain)s:%(http_port)s/
  53. # Serve Grafana from subpath specified in `root_url` setting. By default it
  54. is set to `false` for compatibility reasons.
  55. ;serve_from_sub_path = false
  56. # Log web requests
  57. ;router_logging = false
  58. # the path relative working path
  59. ;static_root_path = public
  60. # enable gzip
  61. ;enable_gzip = false
  62. # https certs & key file
  63. ;cert_file =
  64. ;cert_key =
  65. # Unix socket path
  66. ;socket =
  67. # CDN Url
  68. ;cdn_url =
  69. # Sets the maximum time using a duration format (5s/5m/5ms) before timing
  70. out read of an incoming request and closing idle connections.
  71. # `0` means there is no timeout for reading the request.
  72. ;read_timeout = 0
  73. #################################### Database
  74. ####################################
  75. [database]
  76. # You can configure the database connection by specifying type, host, name,
  77. user and password
  78. # as separate properties or as on string using the url properties.
  79. # Either "mysql", "postgres" or "sqlite3", it's your choice
  80. ;type = sqlite3
  81. ;host = 127.0.0.1:3306
  82. ;name = grafana
  83. ;user = root
  84. # If the password contains # or ; you have to wrap it with triple quotes. Ex
  85. """#password;"""
  86. ;password =
  87. # Use either URL or the previous fields to configure the database
  88. # Example: mysql://user:secret@host:port/database
  89. ;url =
  90. # For "postgres" only, either "disable", "require" or "verify-full"
  91. ;ssl_mode = disable
  92. ;ca_cert_path =
  93. ;client_key_path =
  94. ;client_cert_path =
  95. ;server_cert_name =
  96. # For "sqlite3" only, path relative to data_path setting
  97. ;path = grafana.db
  98. # Max idle conn setting default is 2
  99. ;max_idle_conn = 2
  100. # Max conn setting default is 0 (mean not set)
  101. ;max_open_conn =
  102. # Connection Max Lifetime default is 14400 (means 14400 seconds or 4 hours)
  103. ;conn_max_lifetime = 14400
  104. # Set to true to log the sql calls and execution times.
  105. ;log_queries =
  106. # For "sqlite3" only. cache mode setting used for connecting to the
  107. database. (private, shared)
  108. ;cache_mode = private
  109. ################################### Data sources #########################
  110. [datasources]
  111. # Upper limit of data sources that Grafana will return. This limit is a
  112. temporary configuration and it will be deprecated when pagination will be
  113. introduced on the list data sources API.
  114. ;datasource_limit = 5000
  115. #################################### Cache server
  116. #############################
  117. [remote_cache]
  118. # Either "redis", "memcached" or "database" default is "database"
  119. ;type = database
  120. # cache connectionstring options
  121. # database: will use Grafana primary database.
  122. # redis: config like redis server e.g.
  123. `addr=127.0.0.1:6379,pool_size=100,db=0,ssl=false`. Only addr isrequired.
  124. ssl may be 'true', 'false', or 'insecure'.
  125. # memcache: 127.0.0.1:11211
  126. ;connstr =
  127. #################################### Data proxy ###########################
  128. [dataproxy]
  129. # This enables data proxy logging, default is false
  130. ;logging = false
  131. # How long the data proxy waits before timing out, default is 30 seconds.
  132. # This setting also applies to core backend HTTP data sources where query
  133. requests use an HTTP client with timeout set.
  134. ;timeout = 30
  135. # How many seconds the data proxy waits before sending a keepalive probe
  136. request.
  137. ;keep_alive_seconds = 30
  138. # How many seconds the data proxy waits for a successful TLS Handshake
  139. before timing out.
  140. ;tls_handshake_timeout_seconds = 10
  141. # How many seconds the data proxy will wait for a server's first response
  142. headers after
  143. # fully writing the request headers if the request has an "Expect:
  144. 100-continue"
  145. # header. A value of 0 will result in the body being sent immediately,
  146. without
  147. # waiting for the server to approve.
  148. ;expect_continue_timeout_seconds = 1
  149. # The maximum number of idle connections that Grafana will keep alive.
  150. ;max_idle_connections = 100
  151. # How many seconds the data proxy keeps an idle connection open before
  152. timing out.
  153. ;idle_conn_timeout_seconds = 90
  154. # If enabled and user is not anonymous, data proxy will add X-Grafana-User
  155. header with username into the request, default is false.
  156. ;send_user_header = false
  157. #################################### Analytics
  158. ####################################
  159. [analytics]
  160. # Server reporting, sends usage counters to stats.grafana.org every 24
  161. hours.
  162. # No ip addresses are being tracked, only simple counters to track
  163. # running instances, dashboard and error counts. It is very helpful to us.
  164. # Change this option to false to disable reporting.
  165. ;reporting_enabled = true
  166. # The name of the distributor of the Grafana instance. Ex hosted-grafana,
  167. grafana-labs
  168. ;reporting_distributor = grafana-labs
  169. # Set to false to disable all checks to https://grafana.net
  170. # for new versions (grafana itself and plugins), check is used
  171. # in some UI views to notify that grafana or plugin update exists
  172. # This option does not cause any auto updates, nor send any information
  173. # only a GET request to http://grafana.com to get latest versions
  174. ;check_for_updates = true
  175. # Google Analytics universal tracking code, only enabled if you specify an
  176. id here
  177. ;google_analytics_ua_id =
  178. # Google Tag Manager ID, only enabled if you specify an id here
  179. ;google_tag_manager_id =
  180. #################################### Security
  181. ####################################
  182. [security]
  183. # disable creation of admin user on first start of grafana
  184. ;disable_initial_admin_creation = false
  185. # default admin user, created on startup
  186. ;admin_user = admin
  187. # default admin password, can be changed before first start of grafana, or
  188. in profile settings
  189. ;admin_password = admin
  190. # used for signing
  191. ;secret_key = SW2YcwTIb9zpOOhoPsMm
  192. # disable gravatar profile images
  193. ;disable_gravatar = false
  194. # data source proxy whitelist (ip_or_domain:port separated by spaces)
  195. ;data_source_proxy_whitelist =
  196. # disable protection against brute force login attempts
  197. ;disable_brute_force_login_protection = false
  198. # set to true if you host Grafana behind HTTPS. default is false.
  199. ;cookie_secure = false
  200. # set cookie SameSite attribute. defaults to `lax`. can be set to "lax",
  201. "strict", "none" and "disabled"
  202. ;cookie_samesite = lax
  203. # set to true if you want to allow browsers to render Grafana in a <frame>,
  204. <iframe>, <embed> or <object>. default is false.
  205. ;allow_embedding = false
  206. # Set to true if you want to enable http strict transport security (HSTS)
  207. response header.
  208. # This is only sent when HTTPS is enabled in this configuration.
  209. # HSTS tells browsers that the site should only be accessed using HTTPS.
  210. ;strict_transport_security = false
  211. # Sets how long a browser should cache HSTS. Only applied if
  212. strict_transport_security is enabled.
  213. ;strict_transport_security_max_age_seconds = 86400
  214. # Set to true if to enable HSTS preloading option. Only applied if
  215. strict_transport_security is enabled.
  216. ;strict_transport_security_preload = false
  217. # Set to true if to enable the HSTS includeSubDomains option. Only applied
  218. if strict_transport_securityis enabled.
  219. ;strict_transport_security_subdomains = false
  220. # Set to true to enable the X-Content-Type-Options response header.
  221. # The X-Content-Type-Options response HTTP header is a marker used by the
  222. server to indicate that the MIME types advertised
  223. # in the Content-Type headers should not be changed and be followed.
  224. ;x_content_type_options = true
  225. # Set to true to enable the X-XSS-Protection header, which tells browsers to
  226. stop pages from loading
  227. # when they detect reflected cross-site scripting (XSS) attacks.
  228. ;x_xss_protection = true
  229. # Enable adding the Content-Security-Policy header to your requests.
  230. # CSP allows to control resources the user agent is allowed to load and
  231. helps prevent XSS attacks.
  232. ;content_security_policy = false
  233. # Set Content Security Policy template used when adding the
  234. Content-Security-Policy header to your requests.
  235. # $NONCE in the template includes a random nonce.
  236. ;content_security_policy_template = """script-src 'unsafe-eval'
  237. 'strict-dynamic' $NONCE;object-src 'none';font-src 'self';style-src 'self'
  238. 'unsafe-inline';img-src 'self' data:;base-uri 'self';connect-src 'self'
  239. grafana.com;manifest-src 'self';media-src 'none';form-action 'self';"""
  240. #################################### Snapshots ###########################
  241. [snapshots]
  242. # snapshot sharing options
  243. ;external_enabled = true
  244. ;external_snapshot_url = https://snapshots-origin.raintank.io
  245. ;external_snapshot_name = Publish to snapshot.raintank.io
  246. # Set to true to enable this Grafana instance act as an external snapshot
  247. server and allow unauthenticated requests for
  248. # creating and deleting snapshots.
  249. ;public_mode = false
  250. # remove expired snapshot
  251. ;snapshot_remove_expired = true
  252. #################################### Dashboards History ##################
  253. [dashboards]
  254. # Number dashboard versions to keep (per dashboard). Default: 20, Minimum: 1
  255. ;versions_to_keep = 20
  256. # Minimum dashboard refresh interval. When set, this will restrict users to
  257. set the refresh interval ofa dashboard lower than given interval. Per
  258. default this is 5 seconds.
  259. # The interval string is a possibly signed sequence of decimal numbers,
  260. followed by a unit suffix (ms, s, m, h, d), e.g. 30s or 1m.
  261. ;min_refresh_interval = 5s
  262. # Path to the default home dashboard. If this value is empty, then Grafana
  263. uses StaticRootPath + "dashboards/home.json"
  264. ;default_home_dashboard_path =
  265. #################################### Users ###############################
  266. [users]
  267. # disable user signup / registration
  268. ;allow_sign_up = true
  269. # Allow non admin users to create organizations
  270. ;allow_org_create = true
  271. # Set to true to automatically assign new users to the default organization
  272. (id 1)
  273. ;auto_assign_org = true
  274. # Set this value to automatically add new users to the provided organization
  275. (if auto_assign_org above is set to true)
  276. ;auto_assign_org_id = 1
  277. # Default role new users will be automatically assigned (if disabled above
  278. is set to true)
  279. ;auto_assign_org_role = Viewer
  280. # Require email validation before sign up completes
  281. ;verify_email_enabled = false
  282. # Background text for the user field on the login page
  283. ;login_hint = email or username
  284. ;password_hint = password
  285. # Default UI theme ("dark" or "light")
  286. ;default_theme = dark
  287. # External user management, these options affect the organization users view
  288. ;external_manage_link_url =
  289. ;external_manage_link_name =
  290. ;external_manage_info =
  291. # Viewers can edit/inspect dashboard settings in the browser. But not save
  292. the dashboard.
  293. ;viewers_can_edit = false
  294. # Editors can administrate dashboard, folders and teams they create
  295. ;editors_can_admin = false
  296. # The duration in time a user invitation remains valid before expiring. This
  297. setting should be expressed as a duration. Examples: 6h (hours), 2d (days),
  298. 1w (week). Default is 24h (24 hours). The minimum supported duration is 15m
  299. (15 minutes).
  300. ;user_invite_max_lifetime_duration = 24h
  301. # Enter a comma-separated list of users login to hide them in the Grafana
  302. UI. These users are shown to Grafana admins and themselves.
  303. ; hidden_users =
  304. [auth]
  305. # Login cookie name
  306. ;login_cookie_name = grafana_session
  307. # The maximum lifetime (duration) an authenticated user can be inactive
  308. before being required to login at next visit. Default is 7 days (7d). This
  309. setting should be expressed as a duration, e.g. 5m (minutes), 6h (hours),
  310. 10d (days), 2w (weeks), 1M (month). The lifetime resets at each successful
  311. token rotation.
  312. ;login_maximum_inactive_lifetime_duration =
  313. # The maximum lifetime (duration) an authenticated user can be logged in
  314. since login time before being required to login. Default is 30 days (30d).
  315. This setting should be expressed as a duration, e.g. 5m (minutes), 6h
  316. (hours), 10d (days), 2w (weeks), 1M (month).
  317. ;login_maximum_lifetime_duration =
  318. # How often should auth tokens be rotated for authenticated users when being
  319. active. The default is each 10 minutes.
  320. ;token_rotation_interval_minutes = 10
  321. # Set to true to disable (hide) the login form, useful if you use OAuth,
  322. defaults to false
  323. ;disable_login_form = false
  324. # Set to true to disable the signout link in the side menu. useful if you
  325. use auth.proxy, defaults to false
  326. ;disable_signout_menu = false
  327. # URL to redirect the user to after sign out
  328. ;signout_redirect_url =
  329. # Set to true to attempt login with OAuth automatically, skipping the login
  330. screen.
  331. # This setting is ignored if multiple OAuth providers are configured.
  332. ;oauth_auto_login = false
  333. # OAuth state max age cookie duration in seconds. Defaults to 600 seconds.
  334. ;oauth_state_cookie_max_age = 600
  335. # limit of api_key seconds to live before expiration
  336. ;api_key_max_seconds_to_live = -1
  337. # Set to true to enable SigV4 authentication option for HTTP-based
  338. datasources.
  339. ;sigv4_auth_enabled = false
  340. #################################### Anonymous Auth ######################
  341. [auth.anonymous]
  342. # enable anonymous access
  343. ;enabled = false
  344. # specify organization name that should be used for unauthenticated users
  345. ;org_name = Main Org.
  346. # specify role for unauthenticated users
  347. ;org_role = Viewer
  348. # mask the Grafana version number for unauthenticated users
  349. ;hide_version = false
  350. #################################### GitHub Auth ##########################
  351. [auth.github]
  352. ;enabled = false
  353. ;allow_sign_up = true
  354. ;client_id = some_id
  355. ;client_secret = some_secret
  356. ;scopes = user:email,read:org
  357. ;auth_url = https://github.com/login/oauth/authorize
  358. ;token_url = https://github.com/login/oauth/access_token
  359. ;api_url = https://api.github.com/user
  360. ;allowed_domains =
  361. ;team_ids =
  362. ;allowed_organizations =
  363. #################################### GitLab Auth #########################
  364. [auth.gitlab]
  365. ;enabled = false
  366. ;allow_sign_up = true
  367. ;client_id = some_id
  368. ;client_secret = some_secret
  369. ;scopes = api
  370. ;auth_url = https://gitlab.com/oauth/authorize
  371. ;token_url = https://gitlab.com/oauth/token
  372. ;api_url = https://gitlab.com/api/v4
  373. ;allowed_domains =
  374. ;allowed_groups =
  375. #################################### Google Auth ##########################
  376. [auth.google]
  377. ;enabled = false
  378. ;allow_sign_up = true
  379. ;client_id = some_client_id
  380. ;client_secret = some_client_secret
  381. ;scopes = https://www.googleapis.com/auth/userinfo.profile
  382. https://www.googleapis.com/auth/userinfo.email
  383. ;auth_url = https://accounts.google.com/o/oauth2/auth
  384. ;token_url = https://accounts.google.com/o/oauth2/token
  385. ;api_url = https://www.googleapis.com/oauth2/v1/userinfo
  386. ;allowed_domains =
  387. ;hosted_domain =
  388. #################################### Grafana.com Auth ####################
  389. [auth.grafana_com]
  390. ;enabled = false
  391. ;allow_sign_up = true
  392. ;client_id = some_id
  393. ;client_secret = some_secret
  394. ;scopes = user:email
  395. ;allowed_organizations =
  396. #################################### Azure AD OAuth #######################
  397. [auth.azuread]
  398. ;name = Azure AD
  399. ;enabled = false
  400. ;allow_sign_up = true
  401. ;client_id = some_client_id
  402. ;client_secret = some_client_secret
  403. ;scopes = openid email profile
  404. ;auth_url =
  405. https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/authorize
  406. ;token_url = https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/token
  407. ;allowed_domains =
  408. ;allowed_groups =
  409. #################################### Okta OAuth #######################
  410. [auth.okta]
  411. ;name = Okta
  412. ;enabled = false
  413. ;allow_sign_up = true
  414. ;client_id = some_id
  415. ;client_secret = some_secret
  416. ;scopes = openid profile email groups
  417. ;auth_url = https://<tenant-id>.okta.com/oauth2/v1/authorize
  418. ;token_url = https://<tenant-id>.okta.com/oauth2/v1/token
  419. ;api_url = https://<tenant-id>.okta.com/oauth2/v1/userinfo
  420. ;allowed_domains =
  421. ;allowed_groups =
  422. ;role_attribute_path =
  423. #################################### Generic OAuth
  424. ##########################
  425. [auth.generic_oauth]
  426. ;enabled = false
  427. ;name = OAuth
  428. ;allow_sign_up = true
  429. ;client_id = some_id
  430. ;client_secret = some_secret
  431. ;scopes = user:email,read:org
  432. ;email_attribute_name = email:primary
  433. ;email_attribute_path =
  434. ;login_attribute_path =
  435. ;name_attribute_path =
  436. ;id_token_attribute_name =
  437. ;auth_url = https://foo.bar/login/oauth/authorize
  438. ;token_url = https://foo.bar/login/oauth/access_token
  439. ;api_url = https://foo.bar/user
  440. ;allowed_domains =
  441. ;team_ids =
  442. ;allowed_organizations =
  443. ;role_attribute_path =
  444. ;tls_skip_verify_insecure = false
  445. ;tls_client_cert =
  446. ;tls_client_key =
  447. ;tls_client_ca =
  448. #################################### Basic Auth ##########################
  449. [auth.basic]
  450. ;enabled = true
  451. #################################### Auth Proxy ##########################
  452. [auth.proxy]
  453. ;enabled = false
  454. ;header_name = X-WEBAUTH-USER
  455. ;header_property = username
  456. ;auto_sign_up = true
  457. ;sync_ttl = 60
  458. ;whitelist = 192.168.1.1, 192.168.2.1
  459. ;headers = Email:X-User-Email, Name:X-User-Name
  460. # Read the auth proxy docs for details on what the setting below enables
  461. ;enable_login_token = false
  462. #################################### Auth LDAP ##########################
  463. [auth.ldap]
  464. ;enabled = false
  465. ;config_file = /etc/grafana/ldap.toml
  466. ;allow_sign_up = true
  467. # LDAP background sync (Enterprise only)
  468. # At 1 am every day
  469. ;sync_cron = "0 0 1 * * *"
  470. ;active_sync_enabled = true
  471. #################################### AWS ###########################
  472. [aws]
  473. # Enter a comma-separated list of allowed AWS authentication providers.
  474. # Options are: default (AWS SDK Default), keys (Access && secret key),
  475. credentials (Credentials field),ec2_iam_role (EC2 IAM Role)
  476. ; allowed_auth_providers = default,keys,credentials
  477. # Allow AWS users to assume a role using temporary security credentials.
  478. # If true, assume role will be enabled for all AWS authentication providers
  479. that are specified in aws_auth_providers
  480. ; assume_role_enabled = true
  481. #################################### SMTP / Emailing
  482. ##########################
  483. [smtp]
  484. enabled = true
  485. host = smtp.126.com:465
  486. user = mafei7@126.com
  487. # If the password contains # or ; you have to wrap it with triple quotes. Ex
  488. """#password;"""
  489. password = RNPEBMEVLKMEAJUW
  490. ;cert_file =
  491. ;key_file =
  492. skip_verify = true
  493. from_address = mafei7@126.com
  494. from_name = Grafana
  495. # EHLO identity in SMTP dialog (defaults to instance_name)
  496. ;ehlo_identity = dashboard.example.com
  497. # SMTP startTLS policy (defaults to 'OpportunisticStartTLS')
  498. ;startTLS_policy = NoStartTLS
  499. [emails]
  500. ;welcome_email_on_sign_up = false
  501. ;templates_pattern = emails/*.html
  502. #################################### Logging ##########################
  503. [log]
  504. # Either "console", "file", "syslog". Default is console and file
  505. # Use space to separate multiple modes, e.g. "console file"
  506. ;mode = console file
  507. # Either "debug", "info", "warn", "error", "critical", default is "info"
  508. ;level = info
  509. # optional settings to set different levels for specific loggers. Ex filters
  510. = sqlstore:debug
  511. ;filters =
  512. # For "console" mode only
  513. [log.console]
  514. ;level =
  515. # log line format, valid options are text, console and json
  516. ;format = console
  517. # For "file" mode only
  518. [log.file]
  519. ;level =
  520. # log line format, valid options are text, console and json
  521. ;format = text
  522. # This enables automated log rotate(switch of following options), default is
  523. true
  524. ;log_rotate = true
  525. # Max line number of single file, default is 1000000
  526. ;max_lines = 1000000
  527. # Max size shift of single file, default is 28 means 1 << 28, 256MB
  528. ;max_size_shift = 28
  529. # Segment log daily, default is true
  530. ;daily_rotate = true
  531. # Expired days of log file(delete after max days), default is 7
  532. ;max_days = 7
  533. [log.syslog]
  534. ;level =
  535. # log line format, valid options are text, console and json
  536. ;format = text
  537. # Syslog network type and address. This can be udp, tcp, or unix. If left
  538. blank, the default unix endpoints will be used.
  539. ;network =
  540. ;address =
  541. # Syslog facility. user, daemon and local0 through local7 are valid.
  542. ;facility =
  543. # Syslog tag. By default, the process' argv[0] is used.
  544. ;tag =
  545. [log.frontend]
  546. # Should Sentry javascript agent be initialized
  547. ;enabled = false
  548. # Sentry DSN if you want to send events to Sentry.
  549. ;sentry_dsn =
  550. # Custom HTTP endpoint to send events captured by the Sentry agent to.
  551. Default will log the events to stdout.
  552. ;custom_endpoint = /log
  553. # Rate of events to be reported between 0 (none) and 1 (all), float
  554. ;sample_rate = 1.0
  555. # Requests per second limit enforced an extended period, for Grafana backend
  556. log ingestion endpoint (/log).
  557. ;log_endpoint_requests_per_second_limit = 3
  558. # Max requests accepted per short interval of time for Grafana backend log
  559. ingestion endpoint (/log).
  560. ;log_endpoint_burst_limit = 15
  561. #################################### Usage Quotas ########################
  562. [quota]
  563. ; enabled = false
  564. #### set quotas to -1 to make unlimited. ####
  565. # limit number of users per Org.
  566. ; org_user = 10
  567. # limit number of dashboards per Org.
  568. ; org_dashboard = 100
  569. # limit number of data_sources per Org.
  570. ; org_data_source = 10
  571. # limit number of api_keys per Org.
  572. ; org_api_key = 10
  573. # limit number of orgs a user can create.
  574. ; user_org = 10
  575. # Global limit of users.
  576. ; global_user = -1
  577. # global limit of orgs.
  578. ; global_org = -1
  579. # global limit of dashboards
  580. ; global_dashboard = -1
  581. # global limit of api_keys
  582. ; global_api_key = -1
  583. # global limit on number of logged in users.
  584. ; global_session = -1
  585. #################################### Alerting ############################
  586. [alerting]
  587. # Disable alerting engine & UI features
  588. enabled = true
  589. # Makes it possible to turn off alert rule execution but alerting UI is
  590. visible
  591. execute_alerts = true
  592. # Default setting for new alert rules. Defaults to categorize error and
  593. timeouts as alerting. (alerting, keep_state)
  594. ;error_or_timeout = alerting
  595. # Default setting for how Grafana handles nodata or null values in alerting.
  596. (alerting, no_data, keep_state, ok)
  597. ;nodata_or_nullvalues = no_data
  598. # Alert notifications can include images, but rendering many images at the
  599. same time can overload the server
  600. # This limit will protect the server from render overloading and make sure
  601. notifications are sent out quickly
  602. ;concurrent_render_limit = 5
  603. # Default setting for alert calculation timeout. Default value is 30
  604. ;evaluation_timeout_seconds = 30
  605. # Default setting for alert notification timeout. Default value is 30
  606. ;notification_timeout_seconds = 30
  607. # Default setting for max attempts to sending alert notifications. Default
  608. value is 3
  609. ;max_attempts = 3
  610. # Makes it possible to enforce a minimal interval between evaluations, to
  611. reduce load on the backend
  612. ;min_interval_seconds = 1
  613. # Configures for how long alert annotations are stored. Default is 0, which
  614. keeps them forever.
  615. # This setting should be expressed as a duration. Examples: 6h (hours), 10d
  616. (days), 2w (weeks), 1M (month).
  617. ;max_annotation_age =
  618. # Configures max number of alert annotations that Grafana stores. Default
  619. value is 0, which keeps all alert annotations.
  620. ;max_annotations_to_keep =
  621. #################################### Annotations #########################
  622. [annotations]
  623. # Configures the batch size for the annotation clean-up job. This setting is
  624. used for dashboard, API, and alert annotations.
  625. ;cleanupjob_batchsize = 100
  626. [annotations.dashboard]
  627. # Dashboard annotations means that annotations are associated with the
  628. dashboard they are created on.
  629. # Configures how long dashboard annotations are stored. Default is 0, which
  630. keeps them forever.
  631. # This setting should be expressed as a duration. Examples: 6h (hours), 10d
  632. (days), 2w (weeks), 1M (month).
  633. ;max_age =
  634. # Configures max number of dashboard annotations that Grafana stores.
  635. Default value is 0, which keeps all dashboard annotations.
  636. ;max_annotations_to_keep =
  637. [annotations.api]
  638. # API annotations means that the annotations have been created using the API
  639. without any
  640. # association with a dashboard.
  641. # Configures how long Grafana stores API annotations. Default is 0, which
  642. keeps them forever.
  643. # This setting should be expressed as a duration. Examples: 6h (hours), 10d
  644. (days), 2w (weeks), 1M (month).
  645. ;max_age =
  646. # Configures max number of API annotations that Grafana keeps. Default value
  647. is 0, which keeps all API annotations.
  648. ;max_annotations_to_keep =
  649. #################################### Explore #############################
  650. [explore]
  651. # Enable the Explore section
  652. ;enabled = true
  653. #################################### Internal Grafana Metrics
  654. ##########################
  655. # Metrics available at HTTP API Url /metrics
  656. [metrics]
  657. # Disable / Enable internal metrics
  658. ;enabled = true
  659. # Graphite Publish interval
  660. ;interval_seconds = 10
  661. # Disable total stats (stat_totals_*) metrics to be generated
  662. ;disable_total_stats = false
  663. #If both are set, basic auth will be required for the metrics endpoint.
  664. ; basic_auth_username =
  665. ; basic_auth_password =
  666. # Metrics environment info adds dimensions to the `grafana_environment_info`
  667. metric, which
  668. # can expose more information about the Grafana instance.
  669. [metrics.environment_info]
  670. #exampleLabel1 = exampleValue1
  671. #exampleLabel2 = exampleValue2
  672. # Send internal metrics to Graphite
  673. [metrics.graphite]
  674. # Enable by setting the address setting (ex localhost:2003)
  675. ;address =
  676. ;prefix = prod.grafana.%(instance_name)s.
  677. #################################### Grafana.com integration
  678. ##########################
  679. # Url used to import dashboards directly from Grafana.com
  680. [grafana_com]
  681. ;url = https://grafana.com
  682. #################################### Distributed tracing ############
  683. [tracing.jaeger]
  684. # Enable by setting the address sending traces to jaeger (ex localhost:6831)
  685. ;address = localhost:6831
  686. # Tag that will always be included in when creating new spans. ex
  687. (tag1:value1,tag2:value2)
  688. ;always_included_tag = tag1:value1
  689. # Type specifies the type of the sampler: const, probabilistic,
  690. rateLimiting, or remote
  691. ;sampler_type = const
  692. # jaeger samplerconfig param
  693. # for "const" sampler, 0 or 1 for always false/true respectively
  694. # for "probabilistic" sampler, a probability between 0 and 1
  695. # for "rateLimiting" sampler, the number of spans per second
  696. # for "remote" sampler, param is the same as for "probabilistic"
  697. # and indicates the initial sampling rate before the actual one
  698. # is received from the mothership
  699. ;sampler_param = 1
  700. # sampling_server_url is the URL of a sampling manager providing a sampling
  701. strategy.
  702. ;sampling_server_url =
  703. # Whether or not to use Zipkin propagation (x-b3- HTTP headers).
  704. ;zipkin_propagation = false
  705. # Setting this to true disables shared RPC spans.
  706. # Not disabling is the most common setting when using Zipkin elsewhere in
  707. your infrastructure.
  708. ;disable_shared_zipkin_spans = false
  709. #################################### External image storage
  710. ##########################
  711. [external_image_storage]
  712. # Used for uploading images to public servers so they can be included in
  713. slack/email messages.
  714. # you can choose between (s3, webdav, gcs, azure_blob, local)
  715. ;provider =
  716. [external_image_storage.s3]
  717. ;endpoint =
  718. ;path_style_access =
  719. ;bucket =
  720. ;region =
  721. ;path =
  722. ;access_key =
  723. ;secret_key =
  724. [external_image_storage.webdav]
  725. ;url =
  726. ;public_url =
  727. ;username =
  728. ;password =
  729. [external_image_storage.gcs]
  730. ;key_file =
  731. ;bucket =
  732. ;path =
  733. [external_image_storage.azure_blob]
  734. ;account_name =
  735. ;account_key =
  736. ;container_name =
  737. [external_image_storage.local]
  738. # does not require any configuration
  739. [rendering]
  740. # Options to configure a remote HTTP image rendering service, e.g. using
  741. https://github.com/grafana/grafana-image-renderer.
  742. # URL to a remote HTTP image renderer service, e.g.
  743. http://localhost:8081/render, will enable Grafana to render panels and
  744. dashboards to PNG-images using HTTP requests to an external service.
  745. ;server_url =
  746. # If the remote HTTP image renderer service runs on a different server than
  747. the Grafana server you may have to configure this to a URL where Grafana is
  748. reachable, e.g. http://grafana.domain/.
  749. ;callback_url =
  750. # Concurrent render request limit affects when the /render HTTP endpoint is
  751. used. Rendering many imagesat the same time can overload the server,
  752. # which this setting can help protect against by only allowing a certain
  753. amount of concurrent requests.
  754. ;concurrent_render_request_limit = 30
  755. [panels]
  756. # If set to true Grafana will allow script tags in text panels. Not
  757. recommended as it enable XSS vulnerabilities.
  758. ;disable_sanitize_html = false
  759. [plugins]
  760. ;enable_alpha = false
  761. ;app_tls_skip_verify_insecure = false
  762. # Enter a comma-separated list of plugin identifiers to identify plugins
  763. that are allowed to be loaded even if they lack a valid signature.
  764. ;allow_loading_unsigned_plugins =
  765. ;marketplace_url = https://grafana.com/grafana/plugins/
  766. #################################### Grafana Image Renderer Plugin
  767. ##########################
  768. [plugin.grafana-image-renderer]
  769. # Instruct headless browser instance to use a default timezone when not
  770. provided by Grafana, e.g. when rendering panel image of alert.
  771. # See ICU’s metaZones.txt
  772. (https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt)
  773. for a list of supported
  774. # timezone IDs. Fallbacks to TZ environment variable if not set.
  775. ;rendering_timezone =
  776. # Instruct headless browser instance to use a default language when not
  777. provided by Grafana, e.g. when rendering panel image of alert.
  778. # Please refer to the HTTP header Accept-Language to understand how to
  779. format this value, e.g. 'fr-CH, fr;q=0.9, en;q=0.8, de;q=0.7, *;q=0.5'.
  780. ;rendering_language =
  781. # Instruct headless browser instance to use a default device scale factor
  782. when not provided by Grafana,e.g. when rendering panel image of alert.
  783. # Default is 1. Using a higher value will produce more detailed images
  784. (higher DPI), but will require more disk space to store an image.
  785. ;rendering_viewport_device_scale_factor =
  786. # Instruct headless browser instance whether to ignore HTTPS errors during
  787. navigation. Per default HTTPS errors are not ignored. Due to
  788. # the security risk it's not recommended to ignore HTTPS errors.
  789. ;rendering_ignore_https_errors =
  790. # Instruct headless browser instance whether to capture and log verbose
  791. information when rendering an image. Default is false and will
  792. # only capture and log error messages. When enabled, debug messages are
  793. captured and logged as well.
  794. # For the verbose information to be included in the Grafana server log you
  795. have to adjust the renderinglog level to debug, configure
  796. # [log].filter = rendering:debug.
  797. ;rendering_verbose_logging =
  798. # Instruct headless browser instance whether to output its debug and error
  799. messages into running process of remote rendering service.
  800. # Default is false. This can be useful to enable (true) when
  801. troubleshooting.
  802. ;rendering_dumpio =
  803. # Additional arguments to pass to the headless browser instance. Default is
  804. --no-sandbox. The list of Chromium flags can be found
  805. # here (https://peter.sh/experiments/chromium-command-line-switches/).
  806. Multiple arguments is separated with comma-character.
  807. ;rendering_args =
  808. # You can configure the plugin to use a different browser binary instead of
  809. the pre-packaged version ofChromium.
  810. # Please note that this is not recommended, since you may encounter problems
  811. if the installed version of Chrome/Chromium is not
  812. # compatible with the plugin.
  813. ;rendering_chrome_bin =
  814. # Instruct how headless browser instances are created. Default is 'default'
  815. and will create a new browser instance on each request.
  816. # Mode 'clustered' will make sure that only a maximum of browsers/incognito
  817. pages can execute concurrently.
  818. # Mode 'reusable' will have one browser instance and will create a new
  819. incognito page on each request.
  820. ;rendering_mode =
  821. # When rendering_mode = clustered you can instruct how many browsers or
  822. incognito pages can execute concurrently. Default is 'browser'
  823. # and will cluster using browser instances.
  824. # Mode 'context' will cluster using incognito pages.
  825. ;rendering_clustering_mode =
  826. # When rendering_mode = clustered you can define maximum number of browser
  827. instances/incognito pages that can execute concurrently..
  828. ;rendering_clustering_max_concurrency =
  829. # Limit the maximum viewport width, height and device scale factor that can
  830. be requested.
  831. ;rendering_viewport_max_width =
  832. ;rendering_viewport_max_height =
  833. ;rendering_viewport_max_device_scale_factor =
  834. # Change the listening host and port of the gRPC server. Default host is
  835. 127.0.0.1 and default port is 0 and will automatically assign
  836. # a port not in use.
  837. ;grpc_host =
  838. ;grpc_port =
  839. [enterprise]
  840. # Path to a valid Grafana Enterprise license.jwt file
  841. ;license_path =
  842. [feature_toggles]
  843. # enable features, separated by spaces
  844. ;enable =
  845. [date_formats]
  846. # For information on what formatting patterns that are supported
  847. https://momentjs.com/docs/#/displaying/
  848. # Default system date format used in time range picker and other places
  849. where full time is displayed
  850. ;full_date = YYYY-MM-DD HH:mm:ss
  851. # Used by graph and other places where we only show small intervals
  852. ;interval_second = HH:mm:ss
  853. ;interval_minute = HH:mm
  854. ;interval_hour = MM/DD HH:mm
  855. ;interval_day = MM/DD
  856. ;interval_month = YYYY-MM
  857. ;interval_year = YYYY
  858. # Experimental feature
  859. ;use_browser_locale = false
  860. # Default timezone for user preferences. Options are 'browser' for the
  861. browser local timezone or a timezone name from IANA Time Zone database, e.g.
  862. 'UTC' or 'Europe/Amsterdam' etc.
  863. ;default_timezone = browser
  864. [expressions]
  865. # Enable or disable the expressions functionality.
  866. ;enabled = true

deployment

kind: Deployment
apiVersion: apps/v1
metadata:
  name: grafana
  namespace: monitor
  labels:
    app: grafana
  annotations:
    deployment.kubernetes.io/revision: '5'
    kubesphere.io/creator: mafei
spec:
  replicas: 1
  selector:
    matchLabels:
      app: grafana
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: grafana
      annotations:
        kubesphere.io/restartedAt: '2022-01-18T05:48:42.695Z'
    spec:
      volumes:
        - name: volume-data
          persistentVolumeClaim:
            claimName: pvc-grafana
        - name: volume-x6fx99
          configMap:
            name: cm-grafana
            defaultMode: 420
      containers:
        - name: grafana
          image: 'grafana/grafana:7.5.2'
          ports:
            - name: tcp-3000
              containerPort: 3000
              protocol: TCP
          resources: {}
          volumeMounts:
            - name: volume-data
              mountPath: /var/lib/grafana
            - name: volume-x6fx99
              readOnly: true
              mountPath: /etc/grafana/grafana.ini
              subPath: grafana.ini
          livenessProbe:
            tcpSocket:
              port: 3000
            initialDelaySeconds: 30
            timeoutSeconds: 1
            periodSeconds: 10
            successThreshold: 1
            failureThreshold: 3
          readinessProbe:
            httpGet:
              path: /robots.txt
              port: 3000
              scheme: HTTP
            initialDelaySeconds: 10
            timeoutSeconds: 2
            periodSeconds: 30
            successThreshold: 1
            failureThreshold: 3
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: IfNotPresent
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      dnsPolicy: ClusterFirst
      serviceAccountName: default
      serviceAccount: default
      securityContext:
        supplementalGroups:
          - 0
        fsGroup: 472
      schedulerName: default-scheduler
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 25%
      maxSurge: 25%
  revisionHistoryLimit: 10
  progressDeadlineSeconds: 600