{"id":20666813,"url":"https://github.com/sbraz/check_smart","last_synced_at":"2026-05-28T06:03:35.985Z","repository":{"id":66064044,"uuid":"352710881","full_name":"sbraz/check_smart","owner":"sbraz","description":"Nagios-like plugin to check S.M.A.R.T. data","archived":false,"fork":false,"pushed_at":"2025-02-23T23:12:32.000Z","size":77,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-24T00:20:24.094Z","etag":null,"topics":["icinga2","monitor","monitoring-plugins","nagios","nagios-plugins"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sbraz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-29T16:29:22.000Z","updated_at":"2025-02-23T23:12:35.000Z","dependencies_parsed_at":"2023-02-21T08:45:52.061Z","dependency_job_id":null,"html_url":"https://github.com/sbraz/check_smart","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbraz%2Fcheck_smart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbraz%2Fcheck_smart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbraz%2Fcheck_smart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbraz%2Fcheck_smart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sbraz","download_url":"https://codeload.github.com/sbraz/check_smart/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242856023,"owners_count":20196360,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["icinga2","monitor","monitoring-plugins","nagios","nagios-plugins"],"created_at":"2024-11-16T19:41:54.861Z","updated_at":"2025-12-16T05:31:45.618Z","avatar_url":"https://github.com/sbraz.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Introduction\n\nThis plugin can be used to monitor disks and detect changes in S.M.A.R.T. metrics.\n\n## Features\n* Checks the status of all smart metrics and whether they are in a failing state\n* Checks increments in critical counters such as read errors\n* Outputs performance data for all attributes\n\nBy default, the script checks all disks present on the system and\nretains values over the last 4 runs. This means that in case a critical\nmetric sees an increase, the check will return a warning 4 times.\nAfter the fifth run, the increment will no longer be detected.\n\n\n# Requirements\n\nThe script requires:\n* Python 3.10 or newer\n* [`nagiosplugin`](https://nagiosplugin.readthedocs.io) version 1.2.4 or newer\n* smartmontools 7.0 or newer (JSON output support)\n* sudo and access to `smartctl --json=s -x` commands, see [the related section](#security)\n* read-write access to `/var/tmp/` (where the state file is created)\n\n# \u003ca name=\"security\"\u003e\u003c/a\u003e Security considerations\n\nIn order to limit the attack surface as much as possible, it is recommended to\nonly grant sudo access to the required `smartctl` commands.\n\nFor example, create `/etc/sudoders.d/check_smart` containing:\n```\nicinga ALL=(ALL) NOPASSWD: /usr/sbin/smartctl --json=s -x /dev/sd[a-z]\nicinga ALL=(ALL) NOPASSWD: /usr/sbin/smartctl --json=s -x /dev/sd[a-z][a-z]\nicinga ALL=(ALL) NOPASSWD: /usr/sbin/smartctl --json=s -x /dev/nvme[0-9]n[0-9]\n```\n\nThis should be enough to make the check work with most configurations.\n\n# Usage\n\nTo check all disks:\n```\n./check_smart.py\n```\n\nTo list all available disks:\n```\n./check_smart.py --list-devices\n```\n\nTo limit to two disks:\n```\n./check_smart.py -D /dev/sda /dev/sdb\n```\n\nSymlinks are also resolved, so the following trick can be used\nto make sure we are opening the same disk across reboots:\n```\n./check_smart.py -D /dev/disk/by-id/ata-*\u003cdevice serial\u003e\n```\n\nTo exclude a disk:\n```\n./check_smart.py -X /dev/sda\n```\n\nIt is possible to change the number of check attempts before an increment in a\nchecked counter stops being reported as an error. The following will cause\nthe check to return an error only once. All subsequent runs will be fine.\n```\n./check_smart.py --max-attempts 1\n```\n\nSometimes, it is desirable to exclude certain counters from alerts:\n```\n./check_smart.py --exclude-metric Raw_Read_Error_Rate\n```\n\nThe list of checked and non-checked metrics for a certain device\ncan be obtained with:\n```\n./check_smart.py --checked-metrics -D /dev/sda\n./check_smart.py --non-checked-metrics -D /dev/sda\n```\n\nCheck the help for a description of all avaliable options:\n```\n./check_smart.py -h\n```\n\n# Integration with Icinga\n\nAn Icinga `CheckCommand` can be defined with:\n```\nobject CheckCommand \"smart_metrics\" {\n  command = [PluginDir + \"/check_smart.py\"]\n  arguments = {\n    \"--devices\" = {\n      value = \"$smart_metrics_devices$\"\n      repeat_key = false\n    }\n    \"--exclude-devices\" = {\n      value = \"$smart_metrics_exclude_devices$\"\n      repeat_key = false\n    }\n    \"--skip-removable\" = {\n      set_if = \"$smart_metrics_skip_removable$\"\n    }\n    \"--max-attempts\" = \"$max_check_attempts$\"\n    \"--exclude-metrics\" = {\n      value = \"$smart_metrics_exclude_metrics$\"\n      repeat_key = false\n    }\n    \"--ignore-failing-commands\" = {\n      set_if = \"$smart_metrics_ignore_failing_commands$\"\n    }\n    \"--ignore-error-message\" = {\n        value = \"$smart_metrics_ignore_error_message$\"\n    }\n  }\n  vars.smart_metrics_skip_removable = true\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbraz%2Fcheck_smart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsbraz%2Fcheck_smart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbraz%2Fcheck_smart/lists"}