SMART Data Dashboard with Node Exporter & Grafana

Started by Jwidess, January 30, 2026, 03:23:42 AM

Previous topic - Next topic
Hi all,
I was looking for a way to monitor my router's NVMe drive statistics, but didn't find anything I liked, so I created a little shell script and a configd action to collect SMART data and expose it to Prometheus via the Node Exporter plugin and textfile collector. I also created a nice Grafana dashboard that displays all these metrics, image below. I liked this approach as it meant I just needed two plugins (I already had installed), a small script, and a configd action to schedule it with cron. Currently, the script only supports NVMe drives as it uses the nvme_smart_health_information_log object of Smartctl, but I plan to add SATA drive support down the line. Please let me know if anyone has a better way of monitoring these stats that I didn't find while researching this, thanks!

More info in the repo here: https://github.com/jwidess/OPNsense-node-exporter-smartctl-collect



Looks great, looking forward to the Smartctl version.

Thanks for sharing

Quote from: FraLem on January 30, 2026, 08:13:22 AMLooks great, looking forward to the Smartctl version.

Thanks for sharing

Thanks, FraLem, for the kind words! However, I'm not sure what you mean by "looking forward to the Smartctl version." as the script uses smartctl to collect its metrics. If you meant looking forward to the SATA version, I'd appreciate it if you, or anyone, could provide a few sample outputs of `smartctl -j -a` on a SATA drive so I can make the required changes, thanks! I've added a file for logging these to the repo here: smartctl-outputs.md

Late reply, sorry.

looking forward to the SATA version, sorry again.

**************************************

Output from  smartctl -j -a /dev/ada0
{
  "json_format_version": [
    1,
    0
  ],
  "smartctl": {
    "version": [
      7,
      5
    ],
    "pre_release": false,
    "svn_revision": "5714",
    "platform_info": "FreeBSD 15.1-RELEASE-p1 amd64",
    "build_info": "(local build)",
    "argv": [
      "smartctl",
      "-j",
      "-a",
      "/dev/ada0"
    ],
    "drive_database_version": {
      "string": "7.5/5706"
    },
    "exit_status": 0
  },
  "local_time": {
    "time_t": 1789535327,
    "asctime": "Wed Sep 16 07:08:47 2026 CEST"
  },
  "device": {
    "name": "/dev/ada0",
    "info_name": "/dev/ada0",
    "type": "atacam",
    "protocol": "ATA"
  },
  "model_name": "KingFast",
  "serial_number": "SZHT2002017020801902",
  "wwn": {
    "naa": 0,
    "oui": 0,
    "id": 0
  },
  "firmware_version": "P0831A",
  "user_capacity": {
    "blocks": 31277232,
    "bytes": 16013942784
  },
  "logical_block_size": 512,
  "physical_block_size": 512,
  "rotation_rate": 0,
  "form_factor": {
    "ata_value": 3,
    "name": "2.5 inches"
  },
  "trim": {
    "supported": true,
    "deterministic": false,
    "zeroed": false
  },
  "in_smartctl_database": false,
  "ata_version": {
    "string": "ACS-2 (minor revision not indicated)",
    "major_value": 1020,
    "minor_value": 0
  },
  "sata_version": {
    "string": "SATA 3.1",
    "value": 127
  },
  "interface_speed": {
    "max": {
      "sata_value": 14,
      "string": "6.0 Gb/s",
      "units_per_second": 60,
      "bits_per_unit": 100000000
    },
    "current": {
      "sata_value": 3,
      "string": "6.0 Gb/s",
      "units_per_second": 60,
      "bits_per_unit": 100000000
    }
  },
  "smart_support": {
    "available": true,
    "enabled": true
  },
  "smart_status": {
    "passed": true
  },
  "ata_smart_data": {
    "offline_data_collection": {
      "status": {
        "value": 0,
        "string": "was never started"
      },
      "completion_seconds": 0
    },
    "self_test": {
      "status": {
        "value": 0,
        "string": "completed without error",
        "passed": true
      },
      "polling_minutes": {
        "short": 1,
        "extended": 1
      }
    },
    "capabilities": {
      "values": [
        17,
        2
      ],
      "exec_offline_immediate_supported": true,
      "offline_is_aborted_upon_new_cmd": false,
      "offline_surface_scan_supported": false,
      "self_tests_supported": true,
      "conveyance_self_test_supported": false,
      "selective_self_test_supported": false,
      "attribute_autosave_enabled": false,
      "error_logging_supported": true,
      "gp_logging_supported": true
    }
  },
  "ata_smart_attributes": {
    "revision": 1,
    "table": [
      {
        "id": 1,
        "name": "Raw_Read_Error_Rate",
        "value": 100,
        "worst": 100,
        "thresh": 50,
        "when_failed": "",
        "flags": {
          "value": 0,
          "string": "------ ",
          "prefailure": false,
          "updated_online": false,
          "performance": false,
          "error_rate": false,
          "event_count": false,
          "auto_keep": false
        },
        "raw": {
          "value": 0,
          "string": "0"
        }
      },
      {
        "id": 5,
        "name": "Reallocated_Sector_Ct",
        "value": 100,
        "worst": 100,
        "thresh": 50,
        "when_failed": "",
        "flags": {
          "value": 2,
          "string": "-O---- ",
          "prefailure": false,
          "updated_online": true,
          "performance": false,
          "error_rate": false,
          "event_count": false,
          "auto_keep": false
        },
        "raw": {
          "value": 0,
          "string": "0"
        }
      },
      {
        "id": 9,
        "name": "Power_On_Hours",
        "value": 100,
        "worst": 100,
        "thresh": 50,
        "when_failed": "",
        "flags": {
          "value": 0,
          "string": "------ ",
          "prefailure": false,
          "updated_online": false,
          "performance": false,
          "error_rate": false,
          "event_count": false,
          "auto_keep": false
        },
        "raw": {
          "value": 2658,
          "string": "2658"
        }
      },
      {
        "id": 12,
        "name": "Power_Cycle_Count",
        "value": 100,
        "worst": 100,
        "thresh": 50,
        "when_failed": "",
        "flags": {
          "value": 0,
          "string": "------ ",
          "prefailure": false,
          "updated_online": false,
          "performance": false,
          "error_rate": false,
          "event_count": false,
          "auto_keep": false
        },
        "raw": {
          "value": 97,
          "string": "97"
        }
      },
      {
        "id": 160,
        "name": "Unknown_Attribute",
        "value": 100,
        "worst": 100,
        "thresh": 50,
        "when_failed": "",
        "flags": {
          "value": 0,
          "string": "------ ",
          "prefailure": false,
          "updated_online": false,
          "performance": false,
          "error_rate": false,
          "event_count": false,
          "auto_keep": false
        },
        "raw": {
          "value": 0,
          "string": "0"
        }
      },
      {
        "id": 161,
        "name": "Unknown_Attribute",
        "value": 100,
        "worst": 100,
        "thresh": 50,
        "when_failed": "",
        "flags": {
          "value": 0,
          "string": "------ ",
          "prefailure": false,
          "updated_online": false,
          "performance": false,
          "error_rate": false,
          "event_count": false,
          "auto_keep": false
        },
        "raw": {
          "value": 58,
          "string": "58"
        }
      },
      {
        "id": 162,
        "name": "Unknown_Attribute",
        "value": 100,
        "worst": 100,
        "thresh": 50,
        "when_failed": "",
        "flags": {
          "value": 0,
          "string": "------ ",
          "prefailure": false,
          "updated_online": false,
          "performance": false,
          "error_rate": false,
          "event_count": false,
          "auto_keep": false
        },
        "raw": {
          "value": 1,
          "string": "1"
        }
      },
      {
        "id": 163,
        "name": "Unknown_Attribute",
        "value": 100,
        "worst": 100,
        "thresh": 50,
        "when_failed": "",
        "flags": {
          "value": 0,
          "string": "------ ",
          "prefailure": false,
          "updated_online": false,
          "performance": false,
          "error_rate": false,
          "event_count": false,
          "auto_keep": false
        },
        "raw": {
          "value": 27,
          "string": "27"
        }
      },
      {
        "id": 164,
        "name": "Unknown_Attribute",
        "value": 100,
        "worst": 100,
        "thresh": 50,
        "when_failed": "",
        "flags": {
          "value": 0,
          "string": "------ ",
          "prefailure": false,
          "updated_online": false,
          "performance": false,
          "error_rate": false,
          "event_count": false,
          "auto_keep": false
        },
        "raw": {
          "value": 4441594,
          "string": "4441594"
        }
      },
      {
        "id": 165,
        "name": "Unknown_Attribute",
        "value": 100,
        "worst": 100,
        "thresh": 50,
        "when_failed": "",
        "flags": {
          "value": 0,
          "string": "------ ",
          "prefailure": false,
          "updated_online": false,
          "performance": false,
          "error_rate": false,
          "event_count": false,
          "auto_keep": false
        },
        "raw": {
          "value": 4401,
          "string": "4401"
        }
      },
      {
        "id": 166,
        "name": "Unknown_Attribute",
        "value": 100,
        "worst": 100,
        "thresh": 50,
        "when_failed": "",
        "flags": {
          "value": 0,
          "string": "------ ",
          "prefailure": false,
          "updated_online": false,
          "performance": false,
          "error_rate": false,
          "event_count": false,
          "auto_keep": false
        },
        "raw": {
          "value": 4347,
          "string": "4347"
        }
      },
      {
        "id": 167,
        "name": "Unknown_Attribute",
        "value": 100,
        "worst": 100,
        "thresh": 50,
        "when_failed": "",
        "flags": {
          "value": 0,
          "string": "------ ",
          "prefailure": false,
          "updated_online": false,
          "performance": false,
          "error_rate": false,
          "event_count": false,
          "auto_keep": false
        },
        "raw": {
          "value": 4350,
          "string": "4350"
        }
      },
      {
        "id": 168,
        "name": "Unknown_Attribute",
        "value": 100,
        "worst": 100,
        "thresh": 50,
        "when_failed": "",
        "flags": {
          "value": 0,
          "string": "------ ",
          "prefailure": false,
          "updated_online": false,
          "performance": false,
          "error_rate": false,
          "event_count": false,
          "auto_keep": false
        },
        "raw": {
          "value": 3000,
          "string": "3000"
        }
      },
      {
        "id": 169,
        "name": "Unknown_Attribute",
        "value": 211,
        "worst": 211,
        "thresh": 50,
        "when_failed": "",
        "flags": {
          "value": 0,
          "string": "------ ",
          "prefailure": false,
          "updated_online": false,
          "performance": false,
          "error_rate": false,
          "event_count": false,
          "auto_keep": false
        },
        "raw": {
          "value": 4294967251,
          "string": "4294967251"
        }
      },
      {
        "id": 192,
        "name": "Power-Off_Retract_Count",
        "value": 100,
        "worst": 100,
        "thresh": 50,
        "when_failed": "",
        "flags": {
          "value": 0,
          "string": "------ ",
          "prefailure": false,
          "updated_online": false,
          "performance": false,
          "error_rate": false,
          "event_count": false,
          "auto_keep": false
        },
        "raw": {
          "value": 32,
          "string": "32"
        }
      },
      {
        "id": 194,
        "name": "Temperature_Celsius",
        "value": 100,
        "worst": 100,
        "thresh": 50,
        "when_failed": "",
        "flags": {
          "value": 0,
          "string": "------ ",
          "prefailure": false,
          "updated_online": false,
          "performance": false,
          "error_rate": false,
          "event_count": false,
          "auto_keep": false
        },
        "raw": {
          "value": 40,
          "string": "40"
        }
      },
      {
        "id": 195,
        "name": "Hardware_ECC_Recovered",
        "value": 100,
        "worst": 100,
        "thresh": 50,
        "when_failed": "",
        "flags": {
          "value": 0,
          "string": "------ ",
          "prefailure": false,
          "updated_online": false,
          "performance": false,
          "error_rate": false,
          "event_count": false,
          "auto_keep": false
        },
        "raw": {
          "value": 45,
          "string": "45"
        }
      },
      {
        "id": 196,
        "name": "Reallocated_Event_Count",
        "value": 100,
        "worst": 100,
        "thresh": 50,
        "when_failed": "",
        "flags": {
          "value": 0,
          "string": "------ ",
          "prefailure": false,
          "updated_online": false,
          "performance": false,
          "error_rate": false,
          "event_count": false,
          "auto_keep": false
        },
        "raw": {
          "value": 0,
          "string": "0"
        }
      },
      {
        "id": 241,
        "name": "Total_LBAs_Written",
        "value": 100,
        "worst": 100,
        "thresh": 50,
        "when_failed": "",
        "flags": {
          "value": 0,
          "string": "------ ",
          "prefailure": false,
          "updated_online": false,
          "performance": false,
          "error_rate": false,
          "event_count": false,
          "auto_keep": false
        },
        "raw": {
          "value": 744006,
          "string": "744006"
        }
      },
      {
        "id": 242,
        "name": "Total_LBAs_Read",
        "value": 100,
        "worst": 100,
        "thresh": 50,
        "when_failed": "",
        "flags": {
          "value": 0,
          "string": "------ ",
          "prefailure": false,
          "updated_online": false,
          "performance": false,
          "error_rate": false,
          "event_count": false,
          "auto_keep": false
        },
        "raw": {
          "value": 214740,
          "string": "214740"
        }
      },
      {
        "id": 245,
        "name": "Unknown_Attribute",
        "value": 100,
        "worst": 100,
        "thresh": 50,
        "when_failed": "",
        "flags": {
          "value": 0,
          "string": "------ ",
          "prefailure": false,
          "updated_online": false,
          "performance": false,
          "error_rate": false,
          "event_count": false,
          "auto_keep": false
        },
        "raw": {
          "value": 1718759,
          "string": "1718759"
        }
      }
    ]
  },
  "spare_available": {
    "current_percent": 100
  },
  "power_on_time": {
    "hours": 2658
  },
  "power_cycle_count": 97,
  "temperature": {
    "current": 40
  },
  "ata_smart_error_log": {
    "summary": {
      "revision": 1,
      "count": 0
    }
  },
  "ata_smart_self_test_log": {
    "standard": {
      "revision": 1,
      "count": 0
    }
  }
}