如何使用docker部署grafana+prometheus配置

如何使用docker部署grafana+prometheus配置

这篇文章主要为大家展示了“如何使用docker部署grafana+prometheus配置”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“如何使用docker部署grafana+prometheus配置”这篇文章吧。

docker-compose-monitor.yml

如何使用docker部署grafana+prometheus配置

version:'2'networks:monitor:driver:bridgeservices:influxdb:image:influxdb:latestcontainer_name:tig-influxdbports:-"18083:8083"-"18086:8086"-"18090:8090"env_file:-'env.influxdb'volumes:#Datapersistency#sudomkdir-p./influxdb/data-./influxdb/data:/var/lib/influxdb#配置docker里的时间为东八区时间-./timezone:/etc/timezone:ro-./localtime:/etc/localtime:rorestart:unless-stopped#停止后自动telegraf:image:telegraf:latestcontainer_name:tig-telegraflinks:-influxdbvolumes:-./telegraf.conf:/etc/telegraf/telegraf.conf:ro-./timezone:/etc/timezone:ro-./localtime:/etc/localtime:rorestart:unless-stoppedprometheus:image:prom/prometheuscontainer_name:prometheushostname:prometheusrestart:alwaysvolumes:-/home/qa/docker/grafana/prometheus.yml:/etc/prometheus/prometheus.yml-/home/qa/docker/grafana/node_down.yml:/etc/prometheus/node_down.ymlports:-'9090:9090'networks:-monitoralertmanager:image:prom/alertmanagercontainer_name:alertmanagerhostname:alertmanagerrestart:alwaysvolumes:-/home/qa/docker/grafana/alertmanager.yml:/etc/alertmanager/alertmanager.ymlports:-'9093:9093'networks:-monitorgrafana:image:grafana/grafana:6.7.4container_name:grafanahostname:grafanarestart:alwaysports:-'13000:3000'networks:-monitornode-exporter:image:quay.io/prometheus/node-exportercontainer_name:node-exporterhostname:node-exporterrestart:alwaysports:-'9100:9100'networks:-monitorcadvisor:image:google/cadvisor:latestcontainer_name:cadvisorhostname:cadvisorrestart:alwaysvolumes:-/:/rootfs:ro-/var/run:/var/run:rw-/sys:/sys:ro-/var/lib/docker/:/var/lib/docker:roports:-'18080:8080'networks:-monitor

alertmanager.yml

global:resolve_timeout:5msmtp_from:'邮箱'smtp_smarthost:'smtp.exmail.qq.com:25'smtp_auth_username:'邮箱'smtp_auth_password:'密码'smtp_require_tls:falsesmtp_hello:'qq.com'route:group_by:['alertname']group_wait:5sgroup_interval:5srepeat_interval:5mreceiver:'email'receivers:-name:'email'email_configs:-to:'收件邮箱'send_resolved:trueinhibit_rules:-source_match:severity:'critical'target_match:severity:'warning'equal:['alertname','dev','instance']

prometheus.yml

global:scrape_interval:15s#Setthescrapeintervaltoevery15seconds.Defaultisevery1minute.evaluation_interval:15s#Evaluaterulesevery15seconds.Thedefaultisevery1minute.#scrape_timeoutissettotheglobaldefault(10s).#Alertmanagerconfigurationalerting:alertmanagers:-static_configs:-targets:['192.168.32.117:9093']#-alertmanager:9093#Loadrulesonceandperiodicallyevaluatethemaccordingtotheglobal'evaluation_interval'.rule_files:-"node_down.yml"#-"node-exporter-alert-rules.yml"#-"first_rules.yml"#-"second_rules.yml"#Ascrapeconfigurationcontainingexactlyoneendpointtoscrape:#Hereit'sPrometheusitself.scrape_configs:#IO存储节点组-job_name:'io'scrape_interval:8sstatic_configs:     #端口为node-exporter启动的端口 -targets:['192.168.32.117:9100']-targets:['192.168.32.196:9100']-targets:['192.168.32.136:9100']-targets:['192.168.32.193:9100']-targets:['192.168.32.153:9100']-targets:['192.168.32.185:9100']-targets:['192.168.32.190:19100']-targets:['192.168.32.192:9100']#Thejobnameisaddedasalabel`job=<job_name>`toanytimeseriesscrapedfromthisconfig.-job_name:'cadvisor'static_configs:     #端口为cadvisor启动的端口-targets:['192.168.32.117:18080']-targets:['192.168.32.193:8080']-targets:['192.168.32.153:8080']-targets:['192.168.32.185:8080']-targets:['192.168.32.190:18080']-targets:['192.168.32.192:18080']

node_down.yml

groups:-name:node_downrules:-alert:InstanceDownexpr:up==0for:1mlabels:user:testannotations:summary:'Instance{{$labels.instance}}down'description:'{{$labels.instance}}ofjob{{$labels.job}}hasbeendownformorethan1minutes.'#剩余内存小于10%-alert:剩余内存小于10%expr:node_memory_MemAvailable_bytes/node_memory_MemTotal_bytes*100<10for:2mlabels:severity:warningannotations:summary:Hostoutofmemory(instance{{$labels.instance}})description:"Nodememoryisfillingup(<10%left)\nVALUE={{$value}}\nLABELS={{$labels}}"#剩余磁盘小于10%-alert:剩余磁盘小于10%expr:(node_filesystem_avail_bytes*100)/node_filesystem_size_bytes<10andON(instance,device,mountpoint)node_filesystem_readonly==0for:2mlabels:severity:warningannotations:summary:Hostoutofdiskspace(instance{{$labels.instance}})description:"Diskisalmostfull(<10%left)\nVALUE={{$value}}\nLABELS={{$labels}}"#cpu负载>80%-alert:CPU负载>80%expr:100-(avgby(instance)(rate(node_cpu_seconds_total{mode="idle"}[2m]))*100)>80for:0mlabels:severity:warningannotations:summary:HosthighCPUload(instance{{$labels.instance}})description:"CPUloadis>80%\nVALUE={{$value}}\nLABELS={{$labels}}"

以上是“如何使用docker部署grafana+prometheus配置”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注恰卡编程网行业资讯频道!

发布于 2021-12-22 21:56:13
收藏
分享
海报
0 条评论
36
上一篇:Android如何实现流光和光影移动效果 下一篇:怎么使用Python下载抖音无水印视频
目录

    0 条评论

    本站已关闭游客评论,请登录或者注册后再评论吧~

    忘记密码?

    图形验证码