制作公司网站视频网站哪里备案有区别么

张小明 2026/1/14 0:22:41
制作公司网站视频,网站哪里备案有区别么,计算机网络技术网站开发与设计,南宁网上房地产官网本文详解如何搭建Prometheus Grafana监控体系#xff0c;实现服务器、应用、数据库的全方位监控。前言 生产环境必须要有监控#xff1a; 及时发现问题追溯历史数据容量规划依据告警通知 Prometheus Grafana 是目前最流行的开源监控方案#xff1a; Prometheus#xff1a…本文详解如何搭建Prometheus Grafana监控体系实现服务器、应用、数据库的全方位监控。前言生产环境必须要有监控及时发现问题追溯历史数据容量规划依据告警通知Prometheus Grafana是目前最流行的开源监控方案Prometheus采集和存储指标Grafana可视化展示丰富的生态各种Exporter今天来搭建一套完整的监控体系。一、架构设计1.1 整体架构┌─────────────────────────────────────────────────────┐ │ Grafana │ │ (可视化展示) │ └─────────────────────────────────────────────────────┘ ↑ ┌─────────────────────────────────────────────────────┐ │ Prometheus │ │ (采集存储查询) │ └─────────────────────────────────────────────────────┘ ↑ ↑ ↑ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ Node Exporter│ │MySQL Exporter│ │Redis Exporter│ │ (主机监控) │ │ (MySQL监控) │ │ (Redis监控) │ └──────────────┘ └──────────────┘ └──────────────┘1.2 数据流1. Exporter采集指标 → 暴露HTTP接口:9100等 2. Prometheus定时拉取 → 存储时序数据 3. Grafana查询Prometheus → 展示图表 4. Alertmanager → 发送告警二、Prometheus部署2.1 Docker Compose部署# docker-compose.ymlversion:3.8services:prometheus:image:prom/prometheus:latestcontainer_name:prometheusports:-9090:9090volumes:-./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml-./prometheus/rules:/etc/prometheus/rules-prometheus_data:/prometheuscommand:---config.file/etc/prometheus/prometheus.yml---storage.tsdb.path/prometheus---storage.tsdb.retention.time30d---web.enable-lifecyclerestart:unless-stoppedgrafana:image:grafana/grafana:latestcontainer_name:grafanaports:-3000:3000environment:-GF_SECURITY_ADMIN_PASSWORDadmin123-GF_USERS_ALLOW_SIGN_UPfalsevolumes:-grafana_data:/var/lib/grafanarestart:unless-stoppedalertmanager:image:prom/alertmanager:latestcontainer_name:alertmanagerports:-9093:9093volumes:-./alertmanager/alertmanager.yml:/etc/alertmanager/alertmanager.ymlrestart:unless-stoppedvolumes:prometheus_data:grafana_data:2.2 Prometheus配置# prometheus/prometheus.ymlglobal:scrape_interval:15sevaluation_interval:15salerting:alertmanagers:-static_configs:-targets:-alertmanager:9093rule_files:-/etc/prometheus/rules/*.ymlscrape_configs:# Prometheus自身-job_name:prometheusstatic_configs:-targets:[localhost:9090]# 主机监控-job_name:nodestatic_configs:-targets:-192.168.1.101:9100-192.168.1.102:9100-192.168.1.103:9100# MySQL监控-job_name:mysqlstatic_configs:-targets:[192.168.1.101:9104]# Redis监控-job_name:redisstatic_configs:-targets:[192.168.1.101:9121]2.3 启动服务# 创建目录mkdir-p prometheus/rules alertmanager# 启动docker compose up -d# 访问# Prometheus: http://localhost:9090# Grafana: http://localhost:3000 (admin/admin123)三、Node Exporter主机监控3.1 安装部署# 方式1Dockerdocker run -d --name node_exporter\--nethost\--pidhost\-v/:/host:ro,rslave\prom/node-exporter:latest\--path.rootfs/host# 方式2二进制安装wgethttps://github.com/prometheus/node_exporter/releases/download/v1.6.1/node_exporter-1.6.1.linux-amd64.tar.gztarxvfz node_exporter-*.tar.gzcdnode_exporter-*/ ./node_exporter3.2 验证curlhttp://localhost:9100/metrics# 输出示例# node_cpu_seconds_total{cpu0,modeidle} 12345.67# node_memory_MemTotal_bytes 8.3e09# node_filesystem_size_bytes{device/dev/sda1} 1.0e113.3 常用指标指标说明node_cpu_seconds_totalCPU使用时间node_memory_MemTotal_bytes总内存node_memory_MemAvailable_bytes可用内存node_filesystem_size_bytes磁盘大小node_filesystem_avail_bytes磁盘可用node_network_receive_bytes_total网络接收node_network_transmit_bytes_total网络发送node_load1/5/15系统负载四、应用监控4.1 MySQL Exporter# 部署docker run -d --name mysql_exporter\-p9104:9104\-eDATA_SOURCE_NAMEexporter:password(mysql:3306)/\prom/mysqld-exporter# 创建监控用户CREATEUSERexporter%IDENTIFIED BYpassword;GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TOexporter%;FLUSH PRIVILEGES;常用指标mysql_upMySQL是否存活mysql_global_status_connections连接数mysql_global_status_slow_queries慢查询数mysql_global_status_questions查询总数4.2 Redis Exporterdocker run -d --name redis_exporter\-p9121:9121\-eREDIS_ADDRredis://192.168.1.101:6379\oliver006/redis_exporter常用指标redis_upRedis是否存活redis_connected_clients客户端连接数redis_used_memory内存使用redis_commands_processed_total命令处理数4.3 Nginx Exporter# 需要先启用Nginx状态模块# nginx.conf添加# location /nginx_status {# stub_status on;# }docker run -d --name nginx_exporter\-p9113:9113\nginx/nginx-prometheus-exporter\-nginx.scrape-urihttp://192.168.1.101/nginx_status4.4 Java应用Micrometer!-- pom.xml --dependencygroupIdio.micrometer/groupIdartifactIdmicrometer-registry-prometheus/artifactId/dependency# application.ymlmanagement:endpoints:web:exposure:include:prometheus,healthmetrics:export:prometheus:enabled:true访问http://localhost:8080/actuator/prometheus获取指标。五、Grafana配置5.1 添加数据源1. Configuration → Data Sources → Add data source 2. 选择Prometheus 3. URL: http://prometheus:9090Docker网络 或 http://192.168.1.100:9090外部 4. Save Test5.2 导入Dashboard推荐DashboardGrafana官网IDID名称用途1860Node Exporter Full主机监控7362MySQL OverviewMySQL监控763Redis DashboardRedis监控12708Nginx ExporterNginx监控导入方式 1. Dashboards → Import 2. 输入ID1860 3. Load → 选择数据源 → Import5.3 自定义面板# CPU使用率 100 - (avg(rate(node_cpu_seconds_total{modeidle}[5m])) * 100) # 内存使用率 (1 - (node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes)) * 100 # 磁盘使用率 (1 - (node_filesystem_avail_bytes / node_filesystem_size_bytes)) * 100 # 网络流量 rate(node_network_receive_bytes_total[5m]) rate(node_network_transmit_bytes_total[5m])六、告警配置6.1 告警规则# prometheus/rules/alert.ymlgroups:-name:主机告警rules:-alert:主机宕机expr:up{jobnode} 0for:1mlabels:severity:criticalannotations:summary:主机 {{ $labels.instance }} 宕机description:主机已超过1分钟无法访问-alert:CPU使用率过高expr:100-(avg(rate(node_cpu_seconds_total{modeidle}[5m])) by(instance) * 100)80for:5mlabels:severity:warningannotations:summary:主机 {{ $labels.instance }} CPU使用率过高description:CPU使用率超过80%当前值: {{ $value }}%-alert:内存使用率过高expr:(1-(node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes)) * 10080for:5mlabels:severity:warningannotations:summary:主机 {{ $labels.instance }} 内存使用率过高description:内存使用率超过80%当前值: {{ $value }}%-alert:磁盘空间不足expr:(1-(node_filesystem_avail_bytes / node_filesystem_size_bytes)) * 10085for:5mlabels:severity:warningannotations:summary:主机 {{ $labels.instance }} 磁盘空间不足description:磁盘使用率超过85%当前值: {{ $value }}%6.2 Alertmanager配置# alertmanager/alertmanager.ymlglobal:resolve_timeout:5mroute:group_by:[alertname,instance]group_wait:30sgroup_interval:5mrepeat_interval:4hreceiver:webhookreceivers:-name:webhookwebhook_configs:-url:http://your-webhook-url/alertsend_resolved:true# 或使用邮件# - name: email# email_configs:# - to: adminexample.com# from: alertexample.com# smarthost: smtp.example.com:587# auth_username: alertexample.com# auth_password: password6.3 告警测试# 查看告警状态curlhttp://localhost:9090/api/v1/alerts# 查看规则状态curlhttp://localhost:9090/api/v1/rules七、多站点监控7.1 场景监控需求 - 总部机房10台服务器 - 分部A机房5台服务器 - 分部B机房3台服务器 - 云上2台服务器 挑战各站点网络不通7.2 传统方案方案1每个站点部署Prometheus优点独立运行缺点无法统一查看告警分散方案2公网暴露Exporter优点中心化采集缺点安全风险高7.3 组网方案推荐使用组网软件如星空组网打通所有节点组网后的架构 ┌──────────────────────┐ │ 中心Prometheus │ │ 10.10.0.1 │ └──────────────────────┘ ↑ ┌─────────────────────┼─────────────────────┐ ↑ ↑ ↑ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ 总部 │ │ 分部A │ │ 分部B │ │ 10.10.0.2 │ │ 10.10.0.3 │ │ 10.10.0.4 │ │ Node Export │ │ Node Export │ │ Node Export │ │ :9100 │ │ :9100 │ │ :9100 │ └──────────────┘ └──────────────┘ └──────────────┘Prometheus配置scrape_configs:# 总部服务器组网IP-job_name:node-headquartersstatic_configs:-targets:-10.10.0.10:9100-10.10.0.11:9100-10.10.0.12:9100relabel_configs:-source_labels:[__address__]target_label:locationreplacement:总部# 分部A服务器组网IP-job_name:node-branch-astatic_configs:-targets:-10.10.0.20:9100-10.10.0.21:9100relabel_configs:-source_labels:[__address__]target_label:locationreplacement:分部A# 分部B服务器组网IP-job_name:node-branch-bstatic_configs:-targets:-10.10.0.30:9100relabel_configs:-source_labels:[__address__]target_label:locationreplacement:分部B优势统一监控入口所有数据集中展示告警统一管理无需公网暴露配置简单八、高可用部署8.1 Prometheus联邦# 中心Prometheus配置scrape_configs:-job_name:federatescrape_interval:15shonor_labels:truemetrics_path:/federateparams:match[]:-{job~.}static_configs:-targets:-10.10.0.2:9090# 总部Prometheus-10.10.0.3:9090# 分部Prometheus8.2 Grafana高可用# 使用外部MySQL存储services:grafana:image:grafana/grafana:latestenvironment:-GF_DATABASE_TYPEmysql-GF_DATABASE_HOSTmysql:3306-GF_DATABASE_NAMEgrafana-GF_DATABASE_USERgrafana-GF_DATABASE_PASSWORDpassword九、常见问题9.1 Prometheus内存占用高# 减少数据保留时间--storage.tsdb.retention.time15d# 减少采集频率global:scrape_interval:30s9.2 查询慢# 使用Recording Rules预计算groups:-name:recordingrules:-record:job:node_cpu_usage:avgexpr:avg(rate(node_cpu_seconds_total{mode!idle}[5m])) by (job)9.3 热重载配置curl-X POST http://localhost:9090/-/reload十、总结监控体系搭建要点基础架构Prometheus Grafana Alertmanager主机监控Node Exporter必装应用监控根据技术栈选ExporterDashboard导入现成的再自定义告警规则按优先级设置多站点组网打通后统一监控高可用联邦 外部存储我的监控清单必监控项 - CPU/内存/磁盘/网络 - 服务存活状态 - 数据库连接数和慢查询 - 应用响应时间和错误率监控是运维的眼睛没有监控的系统就是在裸奔。参考资料Prometheus官方文档https://prometheus.io/docs/Grafana官方文档https://grafana.com/docs/Awesome Prometheus Alertshttps://awesome-prometheus-alerts.grep.to/建议先监控核心指标逐步完善。告警不要太多否则容易麻木。
版权声明:本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!

网站建设从零开始教程专注网站建站

数据契约与消息契约全解析 1. 枚举成员属性与集合数据契约属性 EnumMemberAttribute 仅有一个属性 Value ,可用于控制枚举成员在架构中的命名。示例如下: [EnumMember(Value="Event"] Gig, [EnumMember(Value="Music"] MP3, [EnumMember(Value=&q…

张小明 2026/1/9 10:10:12 网站建设

wordpress 万能表单新网站怎么做seo 风享

Wan2.2-T2V-5B在健身房课程介绍视频中的动态动作生成表现 你有没有经历过这样的场景?市场部下午三点发来紧急需求:“今晚八点前必须上线一条‘燃脂搏击操’的短视频,要蹭上刘畊宏的热度!”——而你的摄影师还在外地拍外景&#x…

张小明 2026/1/10 4:52:38 网站建设

网站建设意味着什么移动网站的建设

发布单位:镜像视界(浙江)科技有限公司本白皮书由镜像视界(浙江)科技有限公司基于其在空间视频智能感知、多源信息融合与空间态势管控领域的持续技术研究与工程实践编制完成。白皮书面向高安全关键设施这一典型复杂应用…

张小明 2025/12/27 19:40:38 网站建设

广告制作公司网站国外家具设计网站大全

在生产环境Java应用运维领域,Arthas作为阿里巴巴开源的Java诊断工具,已经成为线上问题排查和性能优化的终极武器。这个革命性的工具通过字节码增强技术,无需修改代码或重启应用,即可实现实时的线上诊断和热修复。在电商大促期间&a…

张小明 2025/12/27 18:05:22 网站建设

知名网站域名被抢注镇江特色

当企业发生黑客入侵、系统崩溃或其它影响业务正常运行的安全事件时,急需第一时间进行处理,使企业的网络信息系统在最短时间内恢复正常工作,进一步查找入侵来源,还原入侵事故过程,同时给出解决方案与防范措施&#xff0…

张小明 2025/12/28 2:24:57 网站建设