Ad Widget

Collapse

Discussion thread for official Zabbix SMART Disk monitoring

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • anmg
    Junior Member
    • Sep 2021
    • 14

    #121
    Originally posted by PavelZ
    I thought that zabbix agent2 runs smarctl --scan -d several times according to the number of drivers it knows. Isn't that so?

    Let's update all programs, enable agent logs and see it.
    Thaaks for note
    I can not understand which arguments should I use, and suppose zabbix-agent same.

    Code:
    smartctl --scan -d aacraid,H,L,ID
    as described here https://www.smartmontools.org/wiki/S...Controllers#14

    trying something like this does not give results
    Code:
    smartctl --scan -d aacraid,H,L,ID /dev/sg3
    # scan_smart_devices: DEVICESCAN with pattern not implemented yet

    as to update, I see only this in zabbix-agent2
    Code:
    zabbix-agent2.service - Zabbix Agent 2
    Loaded: loaded (/usr/lib/systemd/system/zabbix-agent2.service; enabled; preset: enabled)
    Active: active (running) since Sat 2025-04-05 19:34:20 UTC; 12h ago
    Main PID: 804 (zabbix_agent2)
    Tasks: 20 (limit: 9405)
    Memory: 26.9M (peak: 47.3M)
    CPU: 1min 4.762s
    CGroup: /system.slice/zabbix-agent2.service
    └─804 /usr/sbin/zabbix_agent2 -c /etc/zabbix/zabbix_agent2.conf
    
    Apr 06 07:05:54 backup-data sudo[6871]: pam_unix(sudo:session): session closed for user root
    Apr 06 07:05:54 backup-data sudo[6883]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/sbin/smartctl -a /dev/sdb -d sat -j
    Apr 06 07:05:54 backup-data sudo[6884]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/sbin/smartctl -a /dev/sdb -d scsi -j
    Code:
    # smartctl
    smartctl 7.4 2023-08-01 r5530 [x86_64-linux-6.8.0-57-generic] (local build)
    Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org

    Comment

    • anmg
      Junior Member
      • Sep 2021
      • 14

      #122
      output from zabbix-agent2 debug log
      Code:
      2025/04/06 08:10:58.201837 [Smart] executed smartctl command: sudo -n smartctl -j -V Got output: "{\n \"json_format_version\": [\n 1,\n 0\n ],\n \"smartctl\": {\n \"version\": [\n 7,\n 4\n ],\n \"pre_release\": false,\n \"svn_revision\": \"5530\",\n \"platform_info\": \"x86_64-linux-6.8.0-57-generic\",\n \"build_info\": \"(local build)\",\n \"argv\": [\n \"smartctl\",\n \"-j\",\n \"-V\"\n ],\n \"exit_status\": 0\n }\n}\n"
      2025/04/06 08:10:58.230345 [Smart] executed smartctl command: sudo -n smartctl --scan -j Got output: "{\n \"json_format_version\": [\n 1,\n 0\n ],\n \"smartctl\": {\n \"version\": [\n 7,\n 4\n ],\n \"pre_release\": false,\n \"svn_revision\": \"5530\",\n \"platform_info\": \"x86_64-linux-6.8.0-57-generic\",\n \"build_info\": \"(local build)\",\n \"argv\": [\n \"smartctl\",\n \"--scan\",\n \"-j\"\n ],\n \"exit_status\": 0\n },\n \"devices\": [\n {\n \"name\": \"/dev/sda\",\n \"info_name\": \"/dev/sda\",\n \"type\": \"scsi\",\n \"protocol\": \"SCSI\"\n },\n {\n \"name\": \"/dev/sdb\",\n \"info_name\": \"/dev/sdb\",\n \"type\": \"scsi\",\n \"protocol\": \"SCSI\"\n }\n ]\n}\n"
      2025/04/06 08:10:58.258211 [Smart] executed smartctl command: sudo -n smartctl --scan -d sat -j Got output: "{\n \"json_format_version\": [\n 1,\n 0\n ],\n \"smartctl\": {\n \"version\": [\n 7,\n 4\n ],\n \"pre_release\": false,\n \"svn_revision\": \"5530\",\n \"platform_info\": \"x86_64-linux-6.8.0-57-generic\",\n \"build_info\": \"(local build)\",\n \"argv\": [\n \"smartctl\",\n \"--scan\",\n \"-d\",\n \"sat\",\n \"-j\"\n ],\n \"exit_status\": 0\n },\n \"devices\": [\n {\n \"name\": \"/dev/sda\",\n \"info_name\": \"/dev/sda\",\n \"type\": \"scsi\",\n \"protocol\": \"SCSI\"\n },\n {\n \"name\": \"/dev/sdb\",\n \"info_name\": \"/dev/sdb\",\n \"type\": \"scsi\",\n \"protocol\": \"SCSI\"\n }\n ]\n}\n"
      2025/04/06 08:10:58.286087 [Smart] failed to get device "/dev/sda" info by type "scsi": Failed to execute smartctl: "{\n \"json_format_version\": [\n 1,\n 0\n ],\n \"smartctl\": {\n \"version\": [\n 7,\n 4\n ],\n \"pre_release\": false,\n \"svn_revision\": \"5530\",\n \"platform_info\": \"x86_64-linux-6.8.0-57-generic\",\n \"build_info\": \"(local build)\",\n \"argv\": [\n \"smartctl\",\n \"-a\",\n \"-d\",\n \"scsi\",\n \"/dev/sda\",\n \"-j\"\n ],\n \"exit_status\": 4\n },\n \"local_time\": {\n \"time_t\": 1743927058,\n \"asctime\": \"Sun Apr 6 08:10:58 2025 UTC\"\n },\n \"device\": {\n \"name\": \"/dev/sda\",\n \"info_name\": \"/dev/sda\",\n \"type\": \"scsi\",\n \"protocol\": \"SCSI\"\n },\n \"scsi_vendor\": \"Adaptec\",\n \"scsi_product\": \"spegel\",\n \"scsi_model_name\": \"Adaptec spegel\",\n \"scsi_revision\": \"V1.0\",\n \"user_capacity\": {\n \"blocks\": 1952428032,\n \"bytes\": 999643152384\n },\n \"logical_block_size\": 512,\n \"physical_block_size\": 4096,\n \"rotation_rate\": 0,\n \"logical_unit_id\": \"0xa5280ce500d00000\",\n \"serial_number\": \"E50C28A5\",\n \"device_type\": {\n \"scsi_terminology\": \"Peripheral Device Type [PDT]\",\n \"scsi_value\": 0,\n \"name\": \"disk\"\n },\n \"smart_support\": {\n \"available\": true,\n \"enabled\": true\n },\n \"temperature_warning\": {\n \"enabled\": false\n },\n \"smart_status\": {\n \"passed\": true\n },\n \"temperature\": {\n \"current\": 0,\n \"drive_trip\": 0\n },\n \"seagate_farm_log\": {\n \"supported\": false\n }\n}": exit status 4.
      2025/04/06 08:10:58.293485 [Smart] failed to get device "/dev/sdb" info by type "areca": Failed to execute smartctl: "{\n \"json_format_version\": [\n 1,\n 0\n ],\n \"smartctl\": {\n \"version\": [\n 7,\n 4\n ],\n \"pre_release\": false,\n \"svn_revision\": \"5530\",\n \"platform_info\": \"x86_64-linux-6.8.0-57-generic\",\n \"build_info\": \"(local build)\",\n \"argv\": [\n \"smartctl\",\n \"-a\",\n \"-d\",\n \"areca,1\",\n \"/dev/sdb\",\n \"-j\"\n ],\n \"messages\": [\n {\n \"string\": \"Smartctl open device: /dev/sdb [areca_disk#01_enc#01] failed: Input/output error\",\n \"severity\": \"error\"\n }\n ],\n \"exit_status\": 2\n },\n \"local_time\": {\n \"time_t\": 1743927058,\n \"asctime\": \"Sun Apr 6 08:10:58 2025 UTC\"\n }\n}": exit status 2.
      2025/04/06 08:10:58.293565 [Smart] failed to get device "/dev/sda" info by type "cciss": Failed to execute smartctl: "{\n \"json_format_version\": [\n 1,\n 0\n ],\n \"smartctl\": {\n \"version\": [\n 7,\n 4\n ],\n \"pre_release\": false,\n \"svn_revision\": \"5530\",\n \"platform_info\": \"x86_64-linux-6.8.0-57-generic\",\n \"build_info\": \"(local build)\",\n \"argv\": [\n \"smartctl\",\n \"-a\",\n \"-d\",\n \"cciss,0\",\n \"/dev/sda\",\n \"-j\"\n ],\n \"messages\": [\n {\n \"string\": \"Smartctl open device: /dev/sda [cciss_disk_00] [SCSI/SAT] failed: INQUIRY [SAT]: No such device or address\",\n \"severity\": \"error\"\n }\n ],\n \"exit_status\": 2\n },\n \"local_time\": {\n \"time_t\": 1743927058,\n \"asctime\": \"Sun Apr 6 08:10:58 2025 UTC\"\n }\n}": exit status 2.
      2025/04/06 08:10:58.293707 [Smart] failed to get device "/dev/sda" info by type "3ware": Failed to execute smartctl: "{\n \"json_format_version\": [\n 1,\n 0\n ],\n \"smartctl\": {\n \"version\": [\n 7,\n 4\n ],\n \"pre_release\": false,\n \"svn_revision\": \"5530\",\n \"platform_info\": \"x86_64-linux-6.8.0-57-generic\",\n \"build_info\": \"(local build)\",\n \"argv\": [\n \"smartctl\",\n \"-a\",\n \"-d\",\n \"3ware,0\",\n \"/dev/sda\",\n \"-j\"\n ],\n \"exit_status\": 2\n },\n \"local_time\": {\n \"time_t\": 1743927058,\n \"asctime\": \"Sun Apr 6 08:10:58 2025 UTC\"\n },\n \"device\": {\n \"name\": \"/dev/sda\",\n \"info_name\": \"/dev/sda [3ware_disk_00]\",\n \"type\": \"3ware\",\n \"protocol\": \"ATA\"\n }\n}": exit status 2.
      2025/04/06 08:10:58.294501 [Smart] failed to get device "/dev/sdb" info by type "cciss": Failed to execute smartctl: "{\n \"json_format_version\": [\n 1,\n 0\n ],\n \"smartctl\": {\n \"version\": [\n 7,\n 4\n ],\n \"pre_release\": false,\n \"svn_revision\": \"5530\",\n \"platform_info\": \"x86_64-linux-6.8.0-57-generic\",\n \"build_info\": \"(local build)\",\n \"argv\": [\n \"smartctl\",\n \"-a\",\n \"-d\",\n \"cciss,0\",\n \"/dev/sdb\",\n \"-j\"\n ],\n \"messages\": [\n {\n \"string\": \"Smartctl open device: /dev/sdb [cciss_disk_00] [SCSI/SAT] failed: INQUIRY [SAT]: No such device or address\",\n \"severity\": \"error\"\n }\n ],\n \"exit_status\": 2\n },\n \"local_time\": {\n \"time_t\": 1743927058,\n \"asctime\": \"Sun Apr 6 08:10:58 2025 UTC\"\n }\n}": exit status 2.
      2025/04/06 08:10:58.295144 [Smart] failed to get device "/dev/sda" info by type "sat": Failed to execute smartctl: "{\n \"json_format_version\": [\n 1,\n 0\n ],\n \"smartctl\": {\n \"version\": [\n 7,\n 4\n ],\n \"pre_release\": false,\n \"svn_revision\": \"5530\",\n \"platform_info\": \"x86_64-linux-6.8.0-57-generic\",\n \"build_info\": \"(local build)\",\n \"argv\": [\n \"smartctl\",\n \"-a\",\n \"-d\",\n \"sat\",\n \"/dev/sda\",\n \"-j\"\n ],\n \"exit_status\": 2\n },\n \"local_time\": {\n \"time_t\": 1743927058,\n \"asctime\": \"Sun Apr 6 08:10:58 2025 UTC\"\n },\n \"device\": {\n \"name\": \"/dev/sda\",\n \"info_name\": \"/dev/sda [SAT]\",\n \"type\": \"sat\",\n \"protocol\": \"ATA\"\n }\n}": exit status 2.
      2025/04/06 08:10:58.304195 [Smart] failed to get device "/dev/sda" info by type "areca": Failed to execute smartctl: "{\n \"json_format_version\": [\n 1,\n 0\n ],\n \"smartctl\": {\n \"version\": [\n 7,\n 4\n ],\n \"pre_release\": false,\n \"svn_revision\": \"5530\",\n \"platform_info\": \"x86_64-linux-6.8.0-57-generic\",\n \"build_info\": \"(local build)\",\n \"argv\": [\n \"smartctl\",\n \"-a\",\n \"-d\",\n \"areca,1\",\n \"/dev/sda\",\n \"-j\"\n ],\n \"messages\": [\n {\n \"string\": \"Smartctl open device: /dev/sda [areca_disk#01_enc#01] failed: Input/output error\",\n \"severity\": \"error\"\n }\n ],\n \"exit_status\": 2\n },\n \"local_time\": {\n \"time_t\": 1743927058,\n \"asctime\": \"Sun Apr 6 08:10:58 2025 UTC\"\n }\n}": exit status 2.
      2025/04/06 08:10:58.305647 [Smart] failed to get device "/dev/sdb" info by type "3ware": Failed to execute smartctl: "{\n \"json_format_version\": [\n 1,\n 0\n ],\n \"smartctl\": {\n \"version\": [\n 7,\n 4\n ],\n \"pre_release\": false,\n \"svn_revision\": \"5530\",\n \"platform_info\": \"x86_64-linux-6.8.0-57-generic\",\n \"build_info\": \"(local build)\",\n \"argv\": [\n \"smartctl\",\n \"-a\",\n \"-d\",\n \"3ware,0\",\n \"/dev/sdb\",\n \"-j\"\n ],\n \"exit_status\": 2\n },\n \"local_time\": {\n \"time_t\": 1743927058,\n \"asctime\": \"Sun Apr 6 08:10:58 2025 UTC\"\n },\n \"device\": {\n \"name\": \"/dev/sdb\",\n \"info_name\": \"/dev/sdb [3ware_disk_00]\",\n \"type\": \"3ware\",\n \"protocol\": \"ATA\"\n }\n}": exit status 2.
      2025/04/06 08:10:58.313750 [Smart] failed to get device "/dev/sdb" info by type "sat": Failed to execute smartctl: "{\n \"json_format_version\": [\n 1,\n 0\n ],\n \"smartctl\": {\n \"version\": [\n 7,\n 4\n ],\n \"pre_release\": false,\n \"svn_revision\": \"5530\",\n \"platform_info\": \"x86_64-linux-6.8.0-57-generic\",\n \"build_info\": \"(local build)\",\n \"argv\": [\n \"smartctl\",\n \"-a\",\n \"-d\",\n \"sat\",\n \"/dev/sdb\",\n \"-j\"\n ],\n \"exit_status\": 2\n },\n \"local_time\": {\n \"time_t\": 1743927058,\n \"asctime\": \"Sun Apr 6 08:10:58 2025 UTC\"\n },\n \"device\": {\n \"name\": \"/dev/sdb\",\n \"info_name\": \"/dev/sdb [SAT]\",\n \"type\": \"sat\",\n \"protocol\": \"ATA\"\n }\n}": exit status 2.
      2025/04/06 08:10:58.321342 [Smart] failed to get device "/dev/sdb" info by type "scsi": Failed to execute smartctl: "{\n \"json_format_version\": [\n 1,\n 0\n ],\n \"smartctl\": {\n \"version\": [\n 7,\n 4\n ],\n \"pre_release\": false,\n \"svn_revision\": \"5530\",\n \"platform_info\": \"x86_64-linux-6.8.0-57-generic\",\n \"build_info\": \"(local build)\",\n \"argv\": [\n \"smartctl\",\n \"-a\",\n \"-d\",\n \"scsi\",\n \"/dev/sdb\",\n \"-j\"\n ],\n \"exit_status\": 4\n },\n \"local_time\": {\n \"time_t\": 1743927058,\n \"asctime\": \"Sun Apr 6 08:10:58 2025 UTC\"\n },\n \"device\": {\n \"name\": \"/dev/sdb\",\n \"info_name\": \"/dev/sdb\",\n \"type\": \"scsi\",\n \"protocol\": \"SCSI\"\n },\n \"scsi_vendor\": \"Adaptec\",\n \"scsi_product\": \"LogicalDrv 1\",\n \"scsi_model_name\": \"Adaptec LogicalDrv 1\",\n \"scsi_revision\": \"V1.0\",\n \"user_capacity\": {\n \"blocks\": 15623759872,\n \"bytes\": 7999365054464\n },\n \"logical_block_size\": 512,\n \"physical_block_size\": 16777216,\n \"rotation_rate\": 0,\n \"logical_unit_id\": \"0x3017d31e00d00000\",\n \"serial_number\": \"1ED31730\",\n \"device_type\": {\n \"scsi_terminology\": \"Peripheral Device Type [PDT]\",\n \"scsi_value\": 0,\n \"name\": \"disk\"\n },\n \"smart_support\": {\n \"available\": true,\n \"enabled\": true\n },\n \"temperature_warning\": {\n \"enabled\": false\n },\n \"smart_status\": {\n \"passed\": true\n },\n \"temperature\": {\n \"current\": 0,\n \"drive_trip\": 0\n },\n \"seagate_farm_log\": {\n \"supported\": false\n }\n}": exit status 4.

      as you can see aacraid is not tested

      Comment

      • anmg
        Junior Member
        • Sep 2021
        • 14

        #123
        I figured out the correct command. but it does not return SMART data
        Code:
        # smartctl -a -d aacraid,0,0,2 /dev/sdb
        smartctl 7.4 2023-08-01 r5530 [x86_64-linux-6.8.0-57-generic] (local build)
        Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org
        
        === START OF INFORMATION SECTION ===
        Vendor: WDC
        Product: WD8004FRYZ-01VAE
        Revision: 01.0
        Compliance: SPC-3
        User Capacity: 8,001,563,222,016 bytes [8.00 TB]
        Logical block size: 512 bytes
        Rotation Rate: 7200 rpm
        Form Factor: 3.5 inches
        Logical Unit id: 0x5000cca0c6c0c5fe
        Serial number: VYG1PS1S
        Device type: disk
        Local Time is: Sun Apr 6 08:21:44 2025 UTC
        SMART support is: Available - device has SMART capability.
        SMART support is: Enabled
        Temperature Warning: Disabled or Not Supported
        
        === START OF READ SMART DATA SECTION ===
        SMART Health Status: OK
        Current Drive Temperature: <not available>
        Drive Trip Temperature: 0 C
        
        Error Counter logging not supported
        
        Device does not support Self Test logging
        SMART returned by shorter way:
        Code:
        # smartctl -d sat --all /dev/sg2
        smartctl 7.4 2023-08-01 r5530 [x86_64-linux-6.8.0-57-generic] (local build)
        Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org
        
        === START OF INFORMATION SECTION ===
        Model Family:     Seagate Constellation ES (SATA 6Gb/s)
        Device Model:     ST1000NM0011
        Serial Number:    Z1N3PT9G
        LU WWN Device Id: 5 000c50 04ffd8372
        Firmware Version: SN03
        User Capacity:    1,000,204,886,016 bytes [1.00 TB]
        Sector Size:      512 bytes logical/physical
        Rotation Rate:    7202 rpm
        Form Factor:      3.5 inches
        Device is:        In smartctl database 7.3/5671
        ATA Version is:   ATA8-ACS T13/1699-D revision 4
        SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s)
        Local Time is:    Sun Apr  6 08:23:51 2025 UTC
        SMART support is: Available - device has SMART capability.
        SMART support is: Enabled
        
        === START OF READ SMART DATA SECTION ===
        SMART overall-health self-assessment test result: PASSED
        
        General SMART Values:
        Offline data collection status:  (0x82)    Offline data collection activity
                            was completed without error.
                            Auto Offline Data Collection: Enabled.
        Self-test execution status:      (   0)    The previous self-test routine completed
                            without error or no self-test has ever
                            been run.
        Total time to complete Offline
        data collection:         (  617) seconds.
        Offline data collection
        capabilities:              (0x7b) SMART execute Offline immediate.
                            Auto Offline data collection on/off support.
                            Suspend Offline collection upon new
                            command.
                            Offline surface scan supported.
                            Self-test supported.
                            Conveyance Self-test supported.
                            Selective Self-test supported.
        SMART capabilities:            (0x0003)    Saves SMART data before entering
                            power-saving mode.
                            Supports SMART auto save timer.
        Error logging capability:        (0x01)    Error logging supported.
                            General Purpose Logging supported.
        Short self-test routine
        recommended polling time:      (   1) minutes.
        Extended self-test routine
        recommended polling time:      ( 155) minutes.
        Conveyance self-test routine
        recommended polling time:      (   2) minutes.
        SCT capabilities:            (0x10bd)    SCT Status supported.
                            SCT Error Recovery Control supported.
                            SCT Feature Control supported.
                            SCT Data Table supported.
        
        SMART Attributes Data Structure revision number: 10
        Vendor Specific SMART Attributes with Thresholds:
        ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
          1 Raw_Read_Error_Rate     0x000f   082   063   044    Pre-fail  Always       -       179926209
          3 Spin_Up_Time            0x0003   094   094   000    Pre-fail  Always       -       0
          4 Start_Stop_Count        0x0032   100   100   020    Old_age   Always       -       13
          5 Reallocated_Sector_Ct   0x0033   100   100   036    Pre-fail  Always       -       8
          7 Seek_Error_Rate         0x000f   093   060   030    Pre-fail  Always       -       2300887577
          9 Power_On_Hours          0x0032   069   011   000    Old_age   Always       -       27971
         10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -       0
         12 Power_Cycle_Count       0x0032   100   100   020    Old_age   Always       -       13
        184 End-to-End_Error        0x0032   100   100   099    Old_age   Always       -       0
        187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       0
        188 Command_Timeout         0x0032   100   100   000    Old_age   Always       -       0
        189 High_Fly_Writes         0x003a   100   100   000    Old_age   Always       -       0
        190 Airflow_Temperature_Cel 0x0022   063   056   045    Old_age   Always       -       37 (Min/Max 37/37)
        191 G-Sense_Error_Rate      0x0032   100   100   000    Old_age   Always       -       0
        192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       12
        193 Load_Cycle_Count        0x0032   091   091   000    Old_age   Always       -       18547
        194 Temperature_Celsius     0x0022   037   044   000    Old_age   Always       -       37 (0 16 0 0 0)
        195 Hardware_ECC_Recovered  0x001a   118   099   000    Old_age   Always       -       179926209
        197 Current_Pending_Sector  0x0012   100   100   000    Old_age   Always       -       0
        198 Offline_Uncorrectable   0x0010   100   100   000    Old_age   Offline      -       0
        199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0
        
        SMART Error Log Version: 1
        No Errors Logged
        
        SMART Self-test log structure revision number 1
        Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
        # 1  Short offline       Completed without error       00%     27958         -
        # 2  Extended offline    Aborted by host               90%     27958         -
        # 3  Short offline       Aborted by host               80%     27958         -
        
        SMART Selective self-test log data structure revision number 1
         SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
            1        0        0  Not_testing
            2        0        0  Not_testing
            3        0        0  Not_testing
            4        0        0  Not_testing
            5        0        0  Not_testing
        Selective self-test flags (0x0):
          After scanning selected spans, do NOT read-scan remainder of disk.
        If Selective self-test is pending on power-up, resume after 0 minute delay.
        
        The above only provides legacy SMART information - try 'smartctl -x' for more
        ​

        Comment

        • PavelZ
          Senior Member
          • Dec 2024
          • 162

          #124
          as you can see aacraid is not tested
          You are right. The agent source code confirms this


          smartctl -a -d aacraid,0,0,2
          However, maybe the main reason is precisely that it requires specifying driver parameters with numbers?

          For now, I suggest using the technique with a workaround program (like this https://github.com/pavlozt/somezabbi...er/workarounds) You will need to write your own script

          Comment

          • anmg
            Junior Member
            • Sep 2021
            • 14

            #125
            Originally posted by PavelZ

            For now, I suggest using the technique with a workaround program (like this https://github.com/pavlozt/somezabbi...er/workarounds) You will need to write your own script
            this way is working
            Code:
            smartctl -d sat --all /dev/sg2
            , so I need to know how to make zabbix use this

            Comment

            • anmg
              Junior Member
              • Sep 2021
              • 14

              #126
              raid check logic i very simple.
              why not use lspci | grep RAID to check RAID adapter, then use the respective command strategy according to discovered RAID type?

              Comment

              • PavelZ
                Senior Member
                • Dec 2024
                • 162

                #127
                This is too complicated logic for small agent program.
                I think the existing scheme covers 95% of installations. We just don't see complaints from those for whom everything works.
                The rest can write a script or build a workaround.


                smartctl -d sat --all /dev/sg2
                The difficulties mainly lie in the correct operation of autodiscovery. If you make a template that would allow you to specify these keys manually, everything will work too.
                Last edited by PavelZ; 06-04-2025, 20:57.

                Comment

                • goegoegoe
                  Junior Member
                  • Apr 2025
                  • 1

                  #128
                  If smartctl exit-code is not 0,
                  I cannot get SMART DISK monitoring.


                  Zabbix Server 7.0.11
                  Zabbix Agent2 7.0.11
                  OS: Debian 12.10
                  smartmontools release 7.3

                  I can get Disk info. by smartctl
                  smartctl exit-code is 32

                  Code:
                  #smartctl -a /dev/sdc
                  smartctl 7.3 2022-02-28 r5338 [x86_64-linux-6.8.12-8-pve] (local build)
                  Copyright (C) 2002-22, Bruce Allen, Christian Franke, www.smartmontools.org
                  
                  === START OF INFORMATION SECTION ===
                  Model Family: Seagate BarraCuda 3.5 (SMR)
                  ........
                  Selective self-test flags (0x0):
                  After scanning selected spans, do NOT read-scan remainder of disk.
                  If Selective self-test is pending on power-up, resume after 0 minute delay.
                  # echo $?
                  32
                  By zabbix-get, I cannot get Disk info.
                  Code:
                  # zabbix_get -s 192.168.xx.xx -k smart.disk.get[/dev/sde,"sat"]
                  ZBX_NOTSUPPORTED: cannot parse response: cannot find pair with name "value"
                  Zabbix Agent2 7.0.11(Zabbix pkg) :NG
                  Zabbix Agent2 6.0.14(Debian repo): OK
                  Zabbix Agent2 6.0.39(Zabbix pkg) : OK
                  Zabbix Agent2 7.0.11 source modify and compile : OK
                  Code:
                  # zabbix_get -s 192.168.xx.xx -k smart.disk.get[/dev/sde,"sat"]
                  {"airflow_temperature_cel":{"value":258556035114," raw":"42 (Min/Max 36/51 #60)","normalized_value":58},
                  .....
                  ,"exit_status":32,"firmware_version":"0001",
                  .....
                  ,"udma_crc_error_count":{"value":0,"raw":"0","norm alized_value":200}}
                  Source modification details
                  Code:
                  # diff zabbix-7.0.11/src/go/plugins/smart/controller.go zabbix-7.0.11.org/src/go/plugins/smart/controller.go
                  90,91c90
                  < return out,nil
                  < //return nil, errs.Wrapf(err, "%q", strings.TrimSuffix(string(out), "\n"))
                  ---
                  > return nil, errs.Wrapf(err, "%q", strings.TrimSuffix(string(out), "\n"))
                  Modified by comparing with zabbix-6.0.39 source

                  Comment

                  • albertokg
                    Junior Member
                    • Feb 2023
                    • 6

                    #129
                    Hello,
                    I have a Zabbix Server 7.2.5 with a Zabbix Agent 2 (ver 7.2.5) in Debian 12 and Smartctl version 7.3.
                    The "SMART by Zabbix agent 2" template failed to collect the SMART metrics of my devices.

                    The agent logs reports:


                    Code:
                    2025/04/18 14:06:14.228372 [Smart] executed smartctl command: sudo -n smartctl --scan -j Got output: "{\n  \"json_format_version\": [\n    1,\n    0\n  ],\n  \"smartctl\": {\n    \"version\": [\n      7,\n      3\n    ],\n    \"svn_revision\": \"5338\",\n    \"platform_info\": \"x86_64-linux-6.1.0-32-amd64\",\n    \"build_info\": \"(local build)\",\n    \"argv\": [\n      \"smartctl\",\n      \"--scan\",\n      \"-j\"\n    ],\n    \"exit_status\": 0\n  },\n  \"devices\": [\n    {\n      \"name\": \"/dev/sda\",\n      \"info_name\": \"/dev/sda\",\n      \"type\": \"scsi\",\n      \"protocol\": \"SCSI\"\n    }\n  ]\n}\n"
                    2025/04/18 14:06:14.303393 [Smart] executed smartctl command: sudo -n smartctl --scan -d sat -j Got output: "{\n  \"json_format_version\": [\n    1,\n    0\n  ],\n  \"smartctl\": {\n    \"version\": [\n      7,\n      3\n    ],\n    \"svn_revision\": \"5338\",\n    \"platform_info\": \"x86_64-linux-6.1.0-32-amd64\",\n    \"build_info\": \"(local build)\",\n    \"argv\": [\n      \"smartctl\",\n      \"--scan\",\n      \"-d\",\n      \"sat\",\n      \"-j\"\n    ],\n    \"exit_status\": 0\n  },\n  \"devices\": [\n    {\n      \"name\": \"/dev/sda\",\n      \"info_name\": \"/dev/sda\",\n      \"type\": \"scsi\",\n      \"protocol\": \"SCSI\"\n    }\n  ]\n}\n"
                    2025/04/18 14:06:14.447455 [Smart] failed to get device "/dev/sda" info by type "3ware": Failed to execute smartctl: "{\n  \"json_format_version\": [\n    1,\n    0\n  ],\n  \"smartctl\": {\n    \"version\": [\n      7,\n      3\n    ],\n    \"svn_revision\": \"5338\",\n    \"platform_info\": \"x86_64-linux-6.1.0-32-amd64\",\n    \"build_info\": \"(local build)\",\n    \"argv\": [\n      \"smartctl\",\n      \"-a\",\n      \"-d\",\n      \"3ware,0\",\n      \"/dev/sda\",\n      \"-j\"\n    ],\n    \"exit_status\": 2\n  },\n  \"local_time\": {\n    \"time_t\": 1744977974,\n    \"asctime\": \"Fri Apr 18 14:06:14 2025 CEST\"\n  },\n  \"device\": {\n    \"name\": \"/dev/sda\",\n    \"info_name\": \"/dev/sda [3ware_disk_00]\",\n    \"type\": \"3ware\",\n    \"protocol\": \"ATA\"\n  }\n}": exit status 2.
                    2025/04/18 14:06:14.456057 [Smart] failed to get device "/dev/sda" info by type "areca": Failed to execute smartctl: "{\n  \"json_format_version\": [\n    1,\n    0\n  ],\n  \"smartctl\": {\n    \"version\": [\n      7,\n      3\n    ],\n    \"svn_revision\": \"5338\",\n    \"platform_info\": \"x86_64-linux-6.1.0-32-amd64\",\n    \"build_info\": \"(local build)\",\n    \"argv\": [\n      \"smartctl\",\n      \"-a\",\n      \"-d\",\n      \"areca,1\",\n      \"/dev/sda\",\n      \"-j\"\n    ],\n    \"messages\": [\n      {\n        \"string\": \"Smartctl open device: /dev/sda [areca_disk#01_enc#01] failed: Input/output error\",\n        \"severity\": \"error\"\n      }\n    ],\n    \"exit_status\": 2\n  },\n  \"local_time\": {\n    \"time_t\": 1744977974,\n    \"asctime\": \"Fri Apr 18 14:06:14 2025 CEST\"\n  }\n}": exit status 2.
                    2025/04/18 14:06:14.459970 [Smart] failed to get device "/dev/sda" info by type "cciss": Failed to execute smartctl: "{\n  \"json_format_version\": [\n    1,\n    0\n  ],\n  \"smartctl\": {\n    \"version\": [\n      7,\n      3\n    ],\n    \"svn_revision\": \"5338\",\n    \"platform_info\": \"x86_64-linux-6.1.0-32-amd64\",\n    \"build_info\": \"(local build)\",\n    \"argv\": [\n      \"smartctl\",\n      \"-a\",\n      \"-d\",\n      \"cciss,0\",\n      \"/dev/sda\",\n      \"-j\"\n    ],\n    \"messages\": [\n      {\n        \"string\": \"Smartctl open device: /dev/sda [cciss_disk_00] [SCSI/SAT] failed: INQUIRY [SAT]: No such device or address\",\n        \"severity\": \"error\"\n      }\n    ],\n    \"exit_status\": 2\n  },\n  \"local_time\": {\n    \"time_t\": 1744977974,\n    \"asctime\": \"Fri Apr 18 14:06:14 2025 CEST\"\n  }\n}": exit status 2.
                    2025/04/18 14:06:14.702737 [Smart] failed to get device "/dev/sda" info by type "scsi": Failed to execute smartctl: "{\n  \"json_format_version\": [\n    1,\n    0\n  ],\n  \"smartctl\": {\n    \"version\": [\n      7,\n      3\n    ],\n    \"svn_revision\": \"5338\",\n    \"platform_info\": \"x86_64-linux-6.1.0-32-amd64\",\n    \"build_info\": \"(local build)\",\n    \"argv\": [\n      \"smartctl\",\n      \"-a\",\n      \"-d\",\n      \"scsi\",\n      \"/dev/sda\",\n      \"-j\"\n    ],\n    \"exit_status\": 4\n  },\n  \"local_time\": {\n    \"time_t\": 1744977974,\n    \"asctime\": \"Fri Apr 18 14:06:14 2025 CEST\"\n  },\n  \"device\": {\n    \"name\": \"/dev/sda\",\n    \"info_name\": \"/dev/sda\",\n    \"type\": \"scsi\",\n    \"protocol\": \"SCSI\"\n  },\n  \"user_capacity\": {\n    \"blocks\": 1465149168,\n    \"bytes\": 750156374016\n  },\n  \"logical_block_size\": 512,\n  \"physical_block_size\": 4096,\n  \"scsi_lb_provisioning\": {\n    \"name\": \"fully provisioned\",\n    \"value\": 0,\n    \"management_enabled\": {\n      \"name\": \"LBPME\",\n      \"value\": 0\n    },\n    \"read_zeros\": {\n      \"name\": \"LBPRZ\",\n      \"value\": 0\n    }\n  },\n  \"rotation_rate\": 5400,\n  \"form_factor\": {\n    \"scsi_value\": 3,\n    \"name\": \"2.5 inches\"\n  },\n  \"logical_unit_id\": \"0x5000cca72bdb7201\",\n  \"serial_number\": \"J1140021DYBN6J\",\n  \"device_type\": {\n    \"scsi_terminology\": \"Peripheral Device Type [PDT]\",\n    \"scsi_value\": 0,\n    \"name\": \"disk\"\n  },\n  \"smart_support\": {\n    \"available\": false\n  },\n  \"temperature\": {\n    \"current\": 0\n  },\n  \"scsi_temperature\": {\n    \"drive_trip\": 0\n  }\n}": exit status 4.
                    What is wrong?

                    Regards,
                    Alberto

                    Comment

                    • anmg
                      Junior Member
                      • Sep 2021
                      • 14

                      #130
                      Originally posted by PavelZ
                      This is too complicated logic for small agent program.
                      I think the existing scheme covers 95% of installations. We just don't see complaints from those for whom everything works.
                      The rest can write a script or build a workaround.

                      The difficulties mainly lie in the correct operation of autodiscovery. If you make a template that would allow you to specify these keys manually, everything will work too.
                      I have access to about 100 of bare metal servers.
                      it's very hard to imagine bare metal with 512Mb of RAM.

                      Anyway I see auto discovery fail very often.
                      Here is one situation:
                      Smartctl --scan does not return anything, but zabbix-agent2 check the first drive only in RAID10 on Smart Array P410. (screenshot)
                      and such situation is very often.

                      another situation of wrong command is described above.

                      As you can understand discovery include/exclude filters on template is useless in such situation.

                      I would suggest to add auto discovery override for such cases.
                      eg. set the string to use for drive analysis like: `-d sat /dev/sg[2-6]` or `/dev/sda -d cciss,[0-5]`

                      more or less stable discovery is with drives without hardware RAID.
                      Attached Files

                      Comment

                      • PavelZ
                        Senior Member
                        • Dec 2024
                        • 162

                        #131
                        it's very hard to imagine bare metal with 512Mb of RAM.
                        Anyway I see auto discovery fail very often.
                        It seems you misunderstood both me and the developers' motives : every small line that works for decades has its own support cost.
                        Developer shouldn't rush to implement obvious features. He should think about how this will affect the entire product during its entire life cycle.

                        What specific change do you propose in smart plugin autodiscovery? Let's make your proposal as a ZBXNEXT (that's what requests that are not bugs are called),
                        and the developers will write to us.
                        I also think that sometimes the ability to customize SMART autodiscovery might be useful.But I have no vision.​ I and other people will support this ZBXNEXT by pressing button.

                        Comment

                        • VAXman65
                          Junior Member
                          • Sep 2022
                          • 3

                          #132
                          I cannot get my Hardware RAID drives to show up.

                          Zabbix Server. Zabbix 7.0.16 (revision e43512b75d0).

                          Host being monitored is named wort:
                          Plugin communication protocol version is 6.4.0
                          Zabbix Agent2 hostname: [wort.lan.kitsnet.us]
                          Starting Zabbix Agent 2 (7.0.16)
                          smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.14.0-570.23.1.el9_6.x86_64] (local build)
                          ​smartmontools release 7.2 dated 2020-12-30 at 16:48:30 UTC
                          smartmontools SVN rev 5155 dated 2020-12-30 at 16:49:18
                          smartmontools build host: x86_64-redhat-linux-gnu
                          smartmontools build with: C++17, GCC 11.4.1 20231218 (Red Hat 11.4.1-3)

                          Back when I was on Zabbix 5.4 infrastructure, this all worked great. Now, none of the RAID devices are shown. Odd thing is, Zabbix seems to eb doing the right queries and getting results. From journalctl -u zabbix-agent2 | grep smart

                          Code:
                          Jul 10 11:35:26 wort.lan.kitsnet.us sudo[886712]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix --scan -j
                          Jul 10 11:35:26 wort.lan.kitsnet.us sudo[886720]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix --scan -d sat -j
                          Jul 10 11:35:26 wort.lan.kitsnet.us sudo[886733]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sdc -d areca,1 -j
                          Jul 10 11:35:26 wort.lan.kitsnet.us sudo[886729]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sda -d areca,1 -j
                          Jul 10 11:35:26 wort.lan.kitsnet.us sudo[886737]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sdb -d scsi -j
                          Jul 10 11:35:26 wort.lan.kitsnet.us sudo[886726]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sdc -d scsi -j
                          Jul 10 11:35:26 wort.lan.kitsnet.us sudo[886740]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sdc -d sat -j
                          Jul 10 11:35:26 wort.lan.kitsnet.us sudo[886728]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sda -d cciss,0 -j
                          Jul 10 11:35:26 wort.lan.kitsnet.us sudo[886738]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sda -d scsi -j
                          Jul 10 11:35:26 wort.lan.kitsnet.us sudo[886730]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/nvme0 -j
                          Jul 10 11:35:26 wort.lan.kitsnet.us sudo[886741]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sdb -d cciss,0 -j
                          Jul 10 11:35:26 wort.lan.kitsnet.us sudo[886734]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sdb -d sat -j
                          Jul 10 11:35:26 wort.lan.kitsnet.us sudo[886739]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sdc -d 3ware,0 -j
                          Jul 10 11:35:26 wort.lan.kitsnet.us sudo[886732]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sda -d 3ware,0 -j
                          Jul 10 11:35:26 wort.lan.kitsnet.us sudo[886735]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sdb -d areca,1 -j
                          Jul 10 11:35:26 wort.lan.kitsnet.us sudo[886731]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sdb -d 3ware,0 -j
                          Jul 10 11:35:26 wort.lan.kitsnet.us sudo[886736]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sdc -d cciss,0 -j
                          Jul 10 11:35:26 wort.lan.kitsnet.us sudo[886727]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sda -d sat -j
                          Jul 10 11:35:27 wort.lan.kitsnet.us sudo[886800]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sdd -d sat -j
                          Jul 10 11:35:27 wort.lan.kitsnet.us sudo[886813]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/bus/0 -d megaraid,20 -j
                          Jul 10 11:35:27 wort.lan.kitsnet.us sudo[886802]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sdd -d scsi -j
                          Jul 10 11:35:27 wort.lan.kitsnet.us sudo[886806]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sde -d sat -j
                          Jul 10 11:35:27 wort.lan.kitsnet.us sudo[886797]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sdd -d 3ware,0 -j
                          Jul 10 11:35:27 wort.lan.kitsnet.us sudo[886808]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sde -d scsi -j
                          Jul 10 11:35:27 wort.lan.kitsnet.us sudo[886798]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sdd -d areca,1 -j
                          Jul 10 11:35:27 wort.lan.kitsnet.us sudo[886809]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/bus/0 -d megaraid,17 -j
                          Jul 10 11:35:27 wort.lan.kitsnet.us sudo[886799]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sdd -d cciss,0 -j
                          Jul 10 11:35:27 wort.lan.kitsnet.us sudo[886812]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/bus/0 -d megaraid,19 -j
                          Jul 10 11:35:27 wort.lan.kitsnet.us sudo[886814]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/bus/0 -d megaraid,21 -j
                          Jul 10 11:35:27 wort.lan.kitsnet.us sudo[886811]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/bus/0 -d megaraid,18 -j
                          Jul 10 11:35:27 wort.lan.kitsnet.us sudo[886805]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sde -d cciss,0 -j
                          Jul 10 11:35:27 wort.lan.kitsnet.us sudo[886815]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/bus/0 -d megaraid,23 -j
                          Jul 10 11:35:27 wort.lan.kitsnet.us sudo[886803]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sde -d 3ware,0 -j
                          Jul 10 11:35:27 wort.lan.kitsnet.us sudo[886804]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sde -d areca,1 -j
                          Jul 10 11:35:27 wort.lan.kitsnet.us sudo[886876]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/bus/0 -d megaraid,26 -j
                          Jul 10 11:35:27 wort.lan.kitsnet.us sudo[886875]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/bus/0 -d megaraid,25 -j
                          Jul 10 11:35:27 wort.lan.kitsnet.us sudo[886874]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/bus/0 -d megaraid,24 -j
                          Jul 10 11:35:58 wort.lan.kitsnet.us sudo[887119]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/nvme0 -j
                          Jul 10 11:36:08 wort.lan.kitsnet.us sudo[887180]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sdd -d sat -j
                          Jul 10 11:36:19 wort.lan.kitsnet.us sudo[887272]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sde -d sat -j
                          Jul 10 11:36:58 wort.lan.kitsnet.us sudo[887678]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/nvme0 -j
                          Jul 10 11:37:08 wort.lan.kitsnet.us sudo[887803]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sdd -d sat -j
                          Jul 10 11:37:19 wort.lan.kitsnet.us sudo[887894]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sde -d sat -j
                          Jul 10 11:37:58 wort.lan.kitsnet.us sudo[888214]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/nvme0 -j
                          Jul 10 11:38:08 wort.lan.kitsnet.us sudo[888286]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sdd -d sat -j
                          Jul 10 11:38:19 wort.lan.kitsnet.us sudo[888389]: zabbix : PWD=/ ; USER=root ; COMMAND=/usr/local/sbin/smartctl-zabbix -a /dev/sde -d sat -j
                          ​
                          The first scan reveals all the devices:
                          Code:
                          /usr/local/sbin/smartctl-zabbix --scan -j
                          {
                          "json_format_version": [
                          1,
                          0
                          ],
                          "smartctl": {
                          "version": [
                          7,
                          2
                          ],
                          "svn_revision": "5155",
                          "platform_info": "x86_64-linux-5.14.0-570.23.1.el9_6.x86_64",
                          "build_info": "(local build)",
                          "argv": [
                          "smartctl",
                          "--scan",
                          "-j"
                          ],
                          "exit_status": 0
                          },
                          "devices": [
                          {
                          "name": "/dev/sda",
                          "info_name": "/dev/sda",
                          "type": "scsi",
                          "protocol": "SCSI"
                          },
                          {
                          "name": "/dev/sdb",
                          "info_name": "/dev/sdb",
                          "type": "scsi",
                          "protocol": "SCSI"
                          },
                          {
                          "name": "/dev/sdc",
                          "info_name": "/dev/sdc",
                          "type": "scsi",
                          "protocol": "SCSI"
                          },
                          {
                          "name": "/dev/sdd",
                          "info_name": "/dev/sdd",
                          "type": "scsi",
                          "protocol": "SCSI"
                          },
                          {
                          "name": "/dev/sde",
                          "info_name": "/dev/sde",
                          "type": "scsi",
                          "protocol": "SCSI"
                          },
                          {
                          "name": "/dev/bus/0",
                          "info_name": "/dev/bus/0 [megaraid_disk_17]",
                          "type": "megaraid,17",
                          "protocol": "SCSI"
                          },
                          {
                          "name": "/dev/bus/0",
                          "info_name": "/dev/bus/0 [megaraid_disk_18]",
                          "type": "megaraid,18",
                          "protocol": "SCSI"
                          },
                          {
                          "name": "/dev/bus/0",
                          "info_name": "/dev/bus/0 [megaraid_disk_19]",
                          "type": "megaraid,19",
                          "protocol": "SCSI"
                          },
                          {
                          "name": "/dev/bus/0",
                          "info_name": "/dev/bus/0 [megaraid_disk_20]",
                          "type": "megaraid,20",
                          "protocol": "SCSI"
                          },
                          {
                          "name": "/dev/bus/0",
                          "info_name": "/dev/bus/0 [megaraid_disk_21]",
                          "type": "megaraid,21",
                          "protocol": "SCSI"
                          },
                          {
                          "name": "/dev/bus/0",
                          "info_name": "/dev/bus/0 [megaraid_disk_23]",
                          "type": "megaraid,23",
                          "protocol": "SCSI"
                          },
                          {
                          "name": "/dev/bus/0",
                          "info_name": "/dev/bus/0 [megaraid_disk_24]",
                          "type": "megaraid,24",
                          "protocol": "SCSI"
                          },
                          {
                          "name": "/dev/bus/0",
                          "info_name": "/dev/bus/0 [megaraid_disk_25]",
                          "type": "megaraid,25",
                          "protocol": "SCSI"
                          },
                          {
                          "name": "/dev/bus/0",
                          "info_name": "/dev/bus/0 [megaraid_disk_26]",
                          "type": "megaraid,26",
                          "protocol": "SCSI"
                          },
                          {
                          "name": "/dev/nvme0",
                          "info_name": "/dev/nvme0",
                          "type": "nvme",
                          "protocol": "NVMe"
                          }
                          ]
                          }
                          ​
                          and the commands that follow show the Zabbux agent digging out the data for all the devices (e.g. /usr/local/sbin/smartctl-zabbix -a /dev/bus/0 -d megaraid,24 -j). However, the Zabiix server tracks only nvme0, sdd and sde.

                          How do i convince Zabbix server to track the other devices?

                          Comment

                          • VAXman65
                            Junior Member
                            • Sep 2022
                            • 3

                            #133
                            Solved my own issue. Basically, i needed to force the exit status from smartctl to 0

                            I had set up Plugins.Smart.Path=/usr/local/sbin/smartctl-zabbix in the configuration already. I did this originally to stop a slew of bogus error coming out for impossible scans (refer to the if block). The fix i needed to get the MegaRAID devices reporting is at the end of the code

                            Code:
                            #!/usr/bin/env bash
                            
                            #
                            # case statement "eats" invocation of smartctl if -d for areca, 3ware, or cciss. Objective is to
                            # cut down on errors for "smartctl is using a deprecated SCSI ioctl". Older code sections in
                            # smartctl use the older ioctl and these are assoicated with these device types. One theory
                            # is the fact that these devices are no present on the system triggers a branch referencing the
                            # older ioctl.
                            #
                            # as of 7/10/2025, *3ware* calls seem OK
                            #
                            case "$@" in
                            
                            *areca*|*cciss* )
                            /usr/bin/logger "smartctl-zabbix ate it"
                            # echo "$@" >> /tmp/last-smartctl-zabbix-ate.txt
                            echo "{}"
                            ;;
                            *) /usr/bin/logger "smartctl-zabbix OK"
                            # echo "$@" >> /tmp/last-smartctl-zabbix.txt
                            /usr/sbin/smartctl "$@"
                            ;;
                            esac
                            
                            #
                            # Sometimes, smartctl returns perfectly good output, but with a non-zero exit code. Zabbix
                            # agent sees this then treats all the output as bad. As a result, MegaRAID devices may be
                            # enumerated, but no useful dartt is returned. Force return ststus to 0 to prevent this.
                            # 20250713 pas
                            #
                            exit 0


                            Comment

                            • Markku
                              Senior Member
                              Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
                              • Sep 2018
                              • 1781

                              #134
                              Originally posted by VAXman65
                              Solved my own issue. Basically, i needed to force the exit status from smartctl to 0
                              Is this because of the same issue as described in https://support.zabbix.com/browse/ZBX-26359 (Zabbix agent2 smart.disk.discovery fails due to strict exit status check on smartctl, preventing parsing of valid SMART data)?

                              Markku

                              Comment

                              • VAXman65
                                Junior Member
                                • Sep 2022
                                • 3

                                #135
                                Originally posted by Markku

                                Is this because of the same issue as described in https://support.zabbix.com/browse/ZBX-26359 (Zabbix agent2 smart.disk.discovery fails due to strict exit status check on smartctl, preventing parsing of valid SMART data)?
                                It does appear to be a match.

                                Comment

                                Working...