10个应该监控的指标[bak]


今天在逛V2EX(罪恶了,为什么又在网上漫无目的的闲逛?敢不敢有个目标/认真的看看书提升一下专业水平,而不是在网上闲逛?)的时候看到 Livid 在DevOps节点下分享的一个主题“10 个应该监控的指标,来自 Bitly 运维团队的分享”,然后去英文原文看了看,准备在晚上空闲的时候给翻译了(在没找到妹子吃饭/聊天的情况下),暂时先放上英文原文

10 Things We Forgot to Monitor

There is always a set of standard metrics that are universally monitored (Disk Usage, Memory Usage, Load, Pings, etc). Beyond that, there are a lot of lessons that we’ve learned from operating our production systems that have helped shape the breadth of monitoring that we perform at bitly.

One of my favorite all-time tweets is from @DevOps_Borat

“Law of Murphy for devops: if thing can able go wrong, is mean is already wrong but you not have Nagios alert of it yet.”

What follows is a small list of things we monitor at bitly that have grown out of those (sometimes painful!) experiences, and where possible little snippets of the stories behind those instances.

1 – Fork Rate

We once had a problem where IPv6 was intentionally disabled on a box via options ipv6 disable=1 and alias ipv6 off in /etc/modprobe.conf. This caused a large issue for us: each time a new curl object was created, modprobe would spawn, checking net-pf-10 to evaluate IPv6 status. This fork bombed the box, and we eventually tracked it down by noticing that the process counter in /proc/stat was increasing by several hundred a second. Normally you would only expect a fork rate of 1-10/sec on a production box with steady traffic.

check_fork_rate.sh

2 – flow control packets

TL;DR; If your network configuration honors flow control packets and isn’t configured to disable them, they can temporarily cause dropped traffic. (If this doesn’t sound like an outage, you need your head checked.)

$ /usr/sbin/ethtool -S eth0 | grep flow_control
rx_flow_control_xon: 0
rx_flow_control_xoff: 0
tx_flow_control_xon: 0
tx_flow_control_xoff: 0

Note: Read this to understand how these flow control frames can cascade to switch-wide loss of connectivity if you use certain Broadcom NIC’s. You should also trend these metrics on your switch gear. While at it, watch your dropped frames.

3 – Swap In/Out Rate

It’s common to check for swap usage above a threshold, but even if you have a small quantity of memory swapped, it’s actually the rate it’s swapped in/out that can impact performance, not the quantity. This is a much more direct check for that state.

check_swap_paging_rate.sh

4 – Server Boot Notification

Unexpected reboots are part of life. Do you know when they happen on your hosts? Most people don’t. We use a simple init script that triggers an ops email on system boot. This is valuable to communicate provisioning of new servers, and helps capture state change even if services handle the failure gracefully without alerting.

notify.sh

5 – NTP Clock Offset

If not monitored, yes, one of your servers is probably off. If you’ve never thought about clock skew you might not even be running ntpd on your servers. Generally there are 3 things to check for. 1) That ntpd is running, 2) Clock skew inside your datacenter, 3) Clock skew from your master time servers to an external source.

We use check_ntp_time for this check

6 – DNS Resolutions

Internal DNS – It’s a hidden part of your infrastructure that you rely on more than you realize. The things to check for are 1) Local resolutions from each server, 2) If you have local DNS servers in your datacenter, you want to check resolution, and quantity of queries, 3) Check availability of each upstream DNS resolver you use.

External DNS – It’s good to verify your external domains resolve correctly against each of your published external nameservers. At bitly we also rely on several CC TLD’s and we monitor those authoritative servers directly as well (yes, it’s happened that all authoritative nameservers for a TLD have been offline).

7 – SSL Expiration

It’s the thing everyone forgets about because it happens so infrequently. The fix is easy, just check it and get alerted with enough timeframe to renew your SSL certificates.

define command{
    command_name    check_ssl_expire
    command_line    $USER1$/check_http --ssl -C 14 -H $ARG1$
}
define service{
    host_name               virtual
    service_description     bitly_com_ssl_expiration
    use                     generic-service
    check_command           check_ssl_expire!bitly.com
    contact_groups          email_only
    normal_check_interval   720
    retry_check_interval    10
    notification_interval   720
}

8 – DELL OpenManage Server Administrator (OMSA)

We run bitly split across two data centers, one is a managed environment with DELL hardware, and the second is Amazon EC2. For our DELL hardware it’s important for us to monitor the outputs from OMSA. This alerts us to RAID status, failed disks (predictive or hard failures), RAM Issues, Power Supply states and more.

9 – Connection Limits

You probably run things like memcached and mysql with connection limits, but do you monitor how close you are to those limits as you scale out application tiers?

Related to this is addressing the issue of processes running into file descriptor limits. We make a regular practice of running services with ulimit -n 65535 in our run scripts to minimize this. We also set Nginx worker_rlimit_nofile.

10 – Load Balancer Status.

We configure our Load Balancers with a health check which we can easily force to fail in order to have any given server removed from rotation.We’ve found it important to have visibility into the health check state, so we monitor and alert based on the same health check. (If you use EC2 Load Balancers you can monitor the ELB state from Amazon API’s).

Various Other things to watch

New entries written to Nginx Error Logs, service restarts (assuming you have something in place to auto-restart them on failure), numa stats, new process core dumps (great if you run any C code).

EOL

This scratches the surface of how we keep bitly stable, but if that’s an itch you like scratching, we’re hiring.


希望译文能早点出来(不论是自己翻译的还是别人给翻译的)(☆_☆)/~~

, ,

《 “10个应该监控的指标[bak]” 》 有 28 条评论

  1. 深度剖析什么是 SLI、SLO和SLA?
    http://www.yunweipai.com/archives/10703.html
    `
    SLI(Service Level Indicator, 服务等级指标) # 经过仔细定义的测量指标
    SLO(Service Level Objective, 服务等级目标) # 指定了服务所提供功能的一种期望状态
    SLA(Service Level Agreement, 服务等级合约) # 是一个涉及2方的合约,双方必须都要同意并遵守这个合约
    `

  2. Linux服务器上的inode使用情况监控也是很有必要的
    `
    # 查看当前系统的inode使用情况
    df -hi
    # 在当前目录下查找包含最多文件的目录(消耗了最多的inode空间)
    sudo find . -xdev -type f | cut -d “/” -f 2 | sort | uniq -c | sort -n
    # 在根目录下进行查找
    for i in /*; do echo $i; find $i |wc -l; done
    find / -xdev -printf ‘%h\n’ | sort | uniq -c | sort -k1 -nr
    `
    ==
    如何释放 inode 使用
    http://stackoverflow.com/questions/653096/how-to-free-inode-usage

    查看 inode 主要是被哪些地方使用了
    http://unix.stackexchange.com/questions/117093/find-where-inodes-are-being-used
    http://stackoverflow.com/questions/347620/where-are-all-my-inodes-being-used
    http://stackoverflow.com/questions/tagged/inode?sort=votes&pageSize=15

  3. 震惊!原来Google这么玩运维?
    http://www.yunweipai.com/archives/12605.html
    `
    充满辩证的思想:
      服务太稳定不好(在内部程序质量没有达到一定标准的时候,服务太稳定会产生盲目的依赖,这种情况下,一旦出了问题,可能就是大地震)
      琐事也有好处(比如:可以适当的减压,因为做起来不用过多的思考,可以做为创造性工作的一种调剂,从中也能发现需要优化的问题)
      少即是多(比如:监控项不是越多越好)
      自动化的坏处(体会到了自动化带来的负面作用,谷歌希望使用自洽的方案解决问题,这样才诞生了Borg系统)
      故障演习(你是希望系统在星期六凌晨2点,公司大部分同事还在参加黑森林中的团建时出现故障,还是希望和最可靠和最聪明的同事一起仔细监控着他们上周详细评审过的测试时出现故障呢?)
    `

  4. 分分钟拯救监控知识体系
    http://mp.weixin.qq.com/s/TnhE_4afl0valv41V5ZFDA
    `
    0 监控目标
    1 监控方法
    2 监控核心
    3 监控工具
    4 监控流程
    5 监控指标
      5.1 硬件监控
      5.2 系统监控
      5.3 应用监控
      5.4 网络监控
      5.5 流量分析
      5.6 日志监控
      5.7 安全监控
      5.8 API监控
      5.9 性能监控
      5.10 业务监控
    6 监控报警
    7 报警处理
    8 面试监控
    9 监控总结
    `

  5. 云端的SRE发展与实践
    https://tech.meituan.com/meituanyun_sre.html
    `
    经验总结
    1、事故之前(比如标准SOP、容量评估、流量压测)的核心就是要「防范于未然」。
    2、事故之中的核心是「快速止损」,查找问题是一个相对来说难度比较大,也比较漫长的过程,因为这个时间是不可控的。但是如果我们提前有好的应急预案,就能达到快速的止损。此外,还要有服务的自我保护,还有一点,沟通也是很重要的。最开始出现问题的时候,其实是比较乱的,因为大家发现问题都很急,很多人都在问原因,这时候你问原因是没有用的,因为大家大部分是不知道,知道的话就能给出解决方案了。所以这时候需要一个完善的沟通机制,正确的时间反馈正确的消息,反馈的原则是少说表面现象,尽量说一些对于问题定位或者是对于止损方面能够有帮助的信息。
    3、事故之后,像TODO落实、完善预案之类的,核心就是「吃一堑长一智」,相同的问题不能发生第二次。
    `

  6. 谈谈高可用系统的运维设施建设
    https://mp.weixin.qq.com/s/OZNQ6YXAGBos2Y6Juu90eQ
    `
    简单来说,就是做好三件事:
    1、故障发现机制(报警的移动化、实时化、可视化)
    2、系统恢复机制(四项关键任务:回滚、重启、扩容、下机器)
    3、线上故障复盘机制(复盘不只是运维或者开发参加,而是相关技术团队(开发、测试、运维),拉上产品乃至运营人员,一起进行,从各个角度分析,出现线上故障很多时候都是多方面原因。)
    `

  7. 开源运维平台(cmdb)
    https://github.com/roncoo/roncoo-cmdb
    https://github.com/iyaoyao/Mebius

    蓝鲸智云配置平台(blueking cmdb)
    https://github.com/Tencent/bk-cmdb

    cmdb saltstack
    https://github.com/voilet/cmdb
    https://github.com/pengzihe/cmdb
    https://github.com/hequan2017/cmdb

    linux资产管理,cmdb,django, webssh,运维管理平台,数据库操作平台
    https://github.com/hequan2017/autoops

    Generate host overview from ansible fact gathering output
    https://github.com/fboender/ansible-cmdb

  8. B站监控体系
    https://opentalk.upyun.com/343.html
    `
    一、监控系统分层

    二、 B站监控系统演进
    理论
      B站监控系统改进步骤
      如何通过监控入口,研发找到系统问题
      将监控系统化整为零,分而治之
    应用
      Dapper系统
      Lancer系统
      Misaka系统
      Traceon系统

    三、监控系统展望
    `

  9. 监控什么?4个黄金指标/RED方法/USE方法
    http://yunlzheng.github.io/2018/02/02/monitor-best-praticase4-golden-signals/
    `
    1. 监控所有
    2. 监控模式
      2.1. 4个黄金指标
        Four Golden Signals是Google针对大量分布式监控的经验总结,4个黄金指标可以在服务级别帮助衡量终端用户体验、服务中断、业务影响等层面的问题。主要关注与以下四种类型的指标:延迟,通讯量,错误以及饱和度。
      2.2. RED方法
        (请求)速率:服务每秒接收的请求数。
        (请求)错误:每秒失败的请求数。
        (请求)耗时:每个请求的耗时。
      2.3. USE方法(Utilization Saturation and Errors Method)
        正如USE方法的名字所表示的含义,USE方法主要关注与资源的:使用率(Utilization)、饱和度(Saturation)以及错误(Errors)。
    `

  10. Google SRE出的书
    https://landing.google.com/sre/book.html
    https://landing.google.com/sre/book/index.html
    `
    Part I – 预览
    第1 章 介绍
    第2 章 Google 生产环境:SRE 视角

    Part II – 指导思想
    第3 章 拥抱风险
    第4 章 服务质量目标
    第5 章 减少琐事
    第6 章 分布式系统的监控
    第7 章 Google 的自动化系统的演进
    第8 章 发布工程
    第9 章 简单化

    Part III – 具体实践
    第10 章 基于时间序列数据进行有效报警
    第11 章 on-call 轮值
    第12 章 有效的故障排查手段
    第13 章 紧急事件响应
    第14 章 紧急事故管理
    第15 章 事后总结:从失败中学习
    第16 章 跟踪故障
    第17 章 测试可靠性
    第18 章 SRE 部门中的软件工程实践
    第19 章 前端服务器的负载均衡
    第20 章 数据中心内部的负载均衡系统
    第21 章 应对过载
    第22 章 处理连锁故障
    第23 章 管理关键状态:利用分布式共识来提高可靠性
    第24 章 分布式周期性任务系统
    第25 章 数据处理流水线
    第26 章 数据完整性:读写一致
    第27 章 可靠地进行产品的大规模发布

    Part IV – 管理
    第28 章 迅速培养SRE 加入on-call
    第29 章 处理中断性任务
    第30 章 通过嵌入SRE 的方式帮助团队从运维过载中恢复
    第32 章 SRE 参与模式的演进历程

    Part V – 结语
    第33 章 其他行业的实践经验
    第34 章 结语

    附录A 系统可用性
    附录B 生产环境运维过程中的最佳实践
    附录C 事故状态文档示范
    附录D 事后总结示范
    附录E 发布协调检查列表
    附录F 生产环境会议记录示范
    `

  11. 四款开源时序数据监控工具
    https://mp.weixin.qq.com/s/iWIjFahSoT-raGIz5S5vTg
    `
    时间序列数据的特征:

    计数器:计数器是表示仅增加的数值的度量。

    仪表:仪表类似于计数器,因为它表示单个数值,但它也可以减少。它本质上是某个时间点某些价值的表示。温度计是仪表的一个很好的例子:它随温度上下移动并提供时间点读数。其他用途包括CPU使用率,内存使用率,网络使用率和线程数。

    分位数:分位数不是一种度量标准,但它们与接下来的两个部分密切相关:直方图和汇总。让我们通过一个例子阐明我们对分位数的理解:百分位数是一种分位数。百分位是我们经常看到的东西,它们应该帮助我们更容易理解一般概念。百分位数有100个“桶”值。我们经常看到它们与测试或性能相关,并且通常表示为某人得分,例如,在第85百分位数或其他值内。这意味着在该百分位数内得分的人具有落在第85百分位数和第86百分位数之间的实际值。这个人在所有学生中排名前15%。我们根据此指标不知道存储桶中的分数,但可以根据存储桶中所有分数的总和除以这些分数的计数得出。分位数使我们能够比使用不考虑异常值和不均匀分布的均值或其他统计函数更好地理解我们的数据。

    直方图:直方图是从多个实例累积到中央服务器的聚合度量。这提供了一个整体理解系统的机会,而不是逐个节点地理解系统。

    1.Prometheus
    2.Graphite
    3.InfluxDB
    4.OpenTSDB
    `

  12. 面向SecDevOps七种武器
    https://mp.weixin.qq.com/s/NKpyLzHKBgnEYHr7ATJCXw
    `
    关键(Mission Critical):一个命令决定生杀大权,一个操作决定业务走向。面对问题时需要作出关键决策与判断,压力巨大
    数据驱动(Data Driven):坚持理性,天天与数据打交道,善于从数据中拿到客观公正结果
    高危(With Responsibilty):“人在江湖走,哪能不挨刀”,谁没经过几个故障?没处理过几个攻击?被撸过几手羊毛?

    1. 快速发展IT基础设施
    IT领域一方面受到成本降低的反对力量的挑战,另一方面运营的复杂性在不断增加。

    2. 业务稳定后的细节
    航空航天中有一条著名定律:海恩法则(Heinrich’s Law)指出: 每一起严重事故背后,必然有29次轻微事故和300起未遂先兆以及1000起事故隐患。按照海恩法则分析,当一件重大事故发生后,我们在处理事故本身的同时,还要及时对同类问题的“事故征兆”和“事故苗头”进行排查处理,把问题解决在萌芽状态。

    3. 对工具能力更高要求
    3.1 更快的响应
    3.2 更灵活的洞察

    典型问题背后的七种分析手段
    1. 查找:Grep大法好
    2. 上下文(Tail/Less/More):线索的串联
    3. 交互式分析:从统计中发现规律(AWK/SORT/SED/UNIQ)
    4. 异常发现(1)聚类:个体与群体
    5. 异常发现(2)预测与偏差:以史为镜
    6. 根因分析推导
    7.领域建模与推理:心中有图
    `

  13. 使用prometheus监控nginx
    https://mp.weixin.qq.com/s/O-IL5pDvKebkU0batLtoZQ
    `
    由于nginx的快速和高效,生产中的大部分应用都会选择使用nginx来做反向代理,这时对于nginx的监控就显得非常有必要,需要能够直观的显示出nginx实时的流量,访问量,响应时间,http状态码等指标。

    prometheus具有由度量名称和键/值对标识的时间序列数据的多维数据模型,能够很好的对nginx的这些指标进行收集,并配合grafana进行图像展示。

    收集nginx指标的较多采用的有nginx-vts模块,prometheus-lua两种方式进行采集,本文采用nginx-vts模块方式进行数据收集。
    `

  14. 基于Prometheus的K8S监控在小米的落地
    https://mp.weixin.qq.com/s/-4NKZdwZmBqrFTzZb2B-2A
    `
    小米的弹性调度平台(Ocean)以及容器平台主要基于开源容器自动化管理平台Kubernetes(简称k8s)来提供服务,完善的监控系统提高容器服务的质量的前提。

    不同于传统物理主机,每个容器相当于一个主机,导致一台物理主机上的系统指标数量成本增长,总的监控指标规模相当庞大(经线上统计,每node指标达到10000+)。

    此外,为了避免重复造轮,需要最大限度的利用公司的监控报警系统,需要把k8s的监控和报警融入其中。在小米现有的基础设施之上,落地该监控,是一个不小的挑战。

    一、当监控遇上K8S
    为了更方便的管理容器,k8s对Container进行了封装,拥有了Pod、Deployment、Namespace、Service等众多概念。与传统集群相比,k8s集群监控更加复杂:
    监控维度更多,除了传统物理集群的监控,还包括核心服务监控(API server,Etcd等)、容器监控、Pod监控、Namespace监控等;
    监控对象动态可变,在集群中容器的销毁创建十分频繁,无法提前预置;
    监控指标随着容器规模爆炸式增长,如何处理及展示大量监控数据;
    随着集群动态增长,监控系统必须具备动态扩缩的能力。

    除了k8s集群监控本身的特性外,具体监控方案的实现要考虑公司内部的实际情况。
    1、兼顾各种差异
    2、考虑开发和运维成本
    3、参考业界成熟方案

    二、监控方案及演进
    1、初始方案
    2、基于Prometheus的监控系统
    3、分区监控方案
    4、部署方式
    5、测试验证
    `

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注