夜莺-Nightingale
夜莺V6
项目介绍 架构介绍
快速开始
黄埔营
安装部署
升级
采集器
使用手册
API
数据库表结构
FAQ
开源生态
Prometheus
版权声明
第1章:天降奇兵
第2章:探索PromQL
第3章:Prometheus告警处理
第4章:Exporter详解
第5章:数据与可视化
第6章:集群与高可用
第7章:Prometheus服务发现
第8章:监控Kubernetes
第9章:Prometheus Operator
参考资料

S.M.A.R.T采集插件

应用场景

关注硬盘可靠性的场景

采集原理

利用smart工具, 采集硬盘指标。 依赖工具smartmontoolsnvme-cli

关于smart的介绍

S.M.A.R.T. (Self-Monitoring, Analysis and Reporting Technology) storage
devices. SMART is a monitoring system included in computer hard disk drives
(HDDs) and solid-state drives (SSDs) that detects and reports on various
indicators of drive reliability, with the intent of enabling the anticipation of
hardware failures.  See smartmontools (<https://www.smartmontools.org/>).

关于nvme的介绍

NVM Express® (NVMe®) technology has enabled a robust set of industry-standard 
software, drivers, and management tools that have been developed for storage.
The tool to manage NVMe SSDs in Linux is called NVMe Command Line Interface (NVMe-CLI). 
See nvme (<https://nvmexpress.org/open-source-nvme-management-utility-nvme-command-line-interface-nvme-cli/>)

获取指标的主要命令,替换<nocheck><device>为你的参数

smartctl --info --attributes --health -n <nocheck> --format=brief <device>

获取attribute, 依赖nvme-cli,命令如下

 nvme smart-log-add <device>
 or
 nvme smart-log <device> #新版本

配置

本地采集需要免密sudo

[[instances]]
    ## categraf默认会自动探测smartctl路径
    # path_smartctl = "/usr/bin/smartctl"

    ## 默认自动探测nvme-cli路径
    # path_nvme = "/usr/bin/nvme"

    ## 指定探测nvme磁盘厂商的attribute
    ## ["auto-on"] - automatically find and enable additional vendor specific disk info
    ## ["vendor1", "vendor2", ...] - e.g. "Intel" enable additional Intel specific disk info
    #  enable_extensions = ["auto-on"]

    # 免密sudo, 不配置为true几乎获取不到多少指标
    # use_sudo = true

    ## 磁盘检查模式
    ## Skip checking disks in this power mode. Defaults to
    ## "standby" 如果磁盘停止运行则不做磁盘检查
    ## 见 smartctl的 --nocheck 参数
    ## smartctl version 5.41 and 5.42 have faulty detection of
    ## power mode and might require changing this value to
    ## "never" depending on your disks.
    # nocheck = "standby"

    ## 获取 S.M.A.R.T. attribute 指标和细节信息 
    # attributes = true

    ## Optionally specify devices to exclude from reporting if disks auto-discovery is performed.
    ## 不需要采集的磁盘
    # excludes = [ "/dev/pass6" ]

    ## 指定需要采集的磁盘和类型
    ## 不配置,默认通过(smartctl --scan and smartctl --scan -d nvme) 扫描
    # devices = [ "/dev/ada0 -d atacam", "/dev/nvme0"]
    # devices = ["dev/nvme0 -d nvme", "/dev/nvme0"]

    ## 扫描超时时间
      timeout = "30s"

    ## 并发调用smartctl 和 nvme-cli
    ## 默认情况下是通过不同的协程(goroutine) 分别调用smartctl 和 nvme-clis获取磁盘信息
    ## 但是像RAID 有访问限制的场景下,需要设置为 sequential
    ## 可用选项: concurrent, sequential
    # read_method = "concurrent"

采集的指标

指标样例

smart_attribute_critical_warning agent_hostname=1.2.3.4 device=nvme0 model=INTEL_SSDPE2KX040T8 name=Critical_Warning serial_no=PHLJ830200CH4P0DGN 0
smart_attribute_temperature_celsius agent_hostname=1.2.3.4 device=nvme0 id=194 model=INTEL_SSDPE2KX040T8 name=Temperature_Celsius serial_no=PHLJ830200CH4P0DGN 53
smart_attribute_data_units_read agent_hostname=1.2.3.4 device=nvme0 model=INTEL_SSDPE2KX040T8 name=Data_Units_Read serial_no=PHLJ830200CH4P0DGN 16012020
smart_attribute_data_units_written agent_hostname=1.2.3.4 device=nvme0 model=INTEL_SSDPE2KX040T8 name=Data_Units_Written serial_no=PHLJ830200CH4P0DGN 24069427
smart_device_health_ok agent_hostname=1.2.3.4 device=nvme0 model=INTEL_SSDPE2KX040T8 serial_no=PHLJ830200CH4P0DGN 1
smart_device_temp_c agent_hostname=1.2.3.4 device=nvme0 model=INTEL_SSDPE2KX040T8 serial_no=PHLJ830200CH4P0DGN 53
开源版
Flashcat
Flashduty