使用Prometheus+Grafana搭建监控系统实践

# 解压目录中的prometheus.yml # 简单验证,主要配置采用默认文件配置,有修改/新增处用红色标示 [root@prometheus prometheus]# vim prometheus.yml # 全局配置 global: scrape_interval: 15s # 设置抓取(pull)时间间隔,默认是1m evaluation_interval: 15s # 设置rules评估时间间隔,默认是1m # scrape_timeout is set to the global default (10s). # 告警管理配置,暂未使用,默认配置 alerting: alertmanagers: - static_configs: - targets: # - alertmanager:9093 # 加载rules,并根据设置的时间间隔定期评估,暂未使用,默认配置 rule_files: # - "first_rules.yml" # - "second_rules.yml" # 抓取(pull),即监控目标配置 # 默认只有主机本身的监控配置 scrape_configs: # 监控目标的label(这里的监控目标只是一个metric,而不是指某特定主机,可以在特定主机取多个监控目标),在抓取的每条时间序列表中都会添加此label - job_name: 'prometheus' # metrics_path defaults to '/metrics' # scheme defaults to 'http'. # 可覆盖全局配置设置的抓取间隔,由15秒重写成5秒。 scrape_interval: 5s # 静态指定监控目标,暂不涉及使用一些服务发现机制发现目标 static_configs: - targets: ['localhost:9090'] # (opentional)再添加一个label,标识了监控目标的主机 labels: instance: prometheus - job_name: 'linux' scrape_interval: 10s static_configs: # 采用node_exporter默认开放的端口 - targets: ['172.20.1.212:9100'] labels: instance: node1

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/853d86eaac8cee22cbcf2c52de84d7c3.html