{"id":21469968,"url":"https://github.com/sensu-plugins/sensu-plugins-disk-checks","last_synced_at":"2025-04-05T04:13:19.013Z","repository":{"id":26617707,"uuid":"30073059","full_name":"sensu-plugins/sensu-plugins-disk-checks","owner":"sensu-plugins","description":"This plugin provides native disk instrumentation                               for monitoring and metrics collection, including: health, usage, and various metrics.","archived":false,"fork":false,"pushed_at":"2021-10-21T07:16:24.000Z","size":240,"stargazers_count":27,"open_issues_count":22,"forks_count":63,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-29T03:09:12.864Z","etag":null,"topics":["disk-usage","metrics","monitoring","sensu-plugins"],"latest_commit_sha":null,"homepage":"http://sensu-plugins.io","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sensu-plugins.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-01-30T13:28:51.000Z","updated_at":"2023-07-08T18:35:51.000Z","dependencies_parsed_at":"2022-08-17T17:35:11.927Z","dependency_job_id":null,"html_url":"https://github.com/sensu-plugins/sensu-plugins-disk-checks","commit_stats":null,"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sensu-plugins%2Fsensu-plugins-disk-checks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sensu-plugins%2Fsensu-plugins-disk-checks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sensu-plugins%2Fsensu-plugins-disk-checks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sensu-plugins%2Fsensu-plugins-disk-checks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sensu-plugins","download_url":"https://codeload.github.com/sensu-plugins/sensu-plugins-disk-checks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247284951,"owners_count":20913704,"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":["disk-usage","metrics","monitoring","sensu-plugins"],"created_at":"2024-11-23T09:19:56.253Z","updated_at":"2025-04-05T04:13:18.993Z","avatar_url":"https://github.com/sensu-plugins.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Sensu Bonsai Asset](https://img.shields.io/badge/Bonsai-Download%20Me-brightgreen.svg?colorB=89C967\u0026logo=sensu)](https://bonsai.sensu.io/assets/sensu-plugins/sensu-plugins-disk-checks)\n[![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-disk-checks.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-disk-checks)\n[![Gem Version](https://badge.fury.io/rb/sensu-plugins-disk-checks.svg)](http://badge.fury.io/rb/sensu-plugins-disk-checks)\n[![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-disk-checks/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-disk-checks)\n[![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-disk-checks/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-disk-checks)\n[![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-disk-checks.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-disk-checks)\n\n## Sensu Disk Checks Plugin\n- [Overview](#overview)\n- [Usage examples](#usage-examples)\n- [Configuration](#configuration)\n  - [Sensu Go](#sensu-go)\n    - [Asset definition](#asset-definition)\n    - [Check definition](#check-definition)\n  - [Sensu Core](#sensu-core)\n    - [Check definition](#check-definition)\n- [Functionality](#functionality)\n- [Additional information](#additional-information)\n- [Installation from source and contributing](#installation-from-source-and-contributing)\n\n### Overview\n\nThis plugin provides native disk instrumentation for monitoring and metrics collection, including: health, usage, and various metrics.\n\nThe Sensu assets packaged from this repository are built against the Sensu ruby runtime environment. When using these assets as part of a Sensu Go resource (check, mutator or handler), make sure you include the corresponding Sensu ruby runtime asset in the list of assets needed by the resource.  The current ruby-runtime assets can be found [here](https://bonsai.sensu.io/assets/sensu/sensu-ruby-runtime) in the [Bonsai Asset Index](bonsai.sensu.io)\n\n#### Files\n * bin/check-disk-usage.rb\n * bin/check-fstab-mounts.rb\n * bin/check-smart-status.rb\n * bin/check-smart.rb\n * bin/check-smart-tests.rb\n * bin/metrics-disk.rb\n * bin/metrics-disk-capacity.rb\n * bin/metrics-disk-usage.rb\n\n### Usage examples\n\n#### Help\n\n**check-disk-usage.rb**\n```\nUsage: check-disk-usage.rb (options)\n    -c PERCENT                       Critical if PERCENT or more of disk full\n    -w PERCENT                       Warn if PERCENT or more of disk full\n    -t TYPE[,TYPE]                   Only check fs type(s)\n    -K PERCENT                       Critical if PERCENT or more of inodes used\n    -i MNT[,MNT]                     Ignore mount point(s)\n    -o TYPE[.TYPE]                   Ignore option(s)\n    -p PATHRE                        Ignore mount point(s) matching regular expression\n    -x TYPE[,TYPE]                   Ignore fs type(s)\n    -I MNT[,MNT]                     Include only mount point(s)\n    -r                               Ignore bytes reserved for privileged processes only\n    -W PERCENT                       Warn if PERCENT or more of inodes used\n    -m MAGIC                         Magic factor to adjust warn/crit thresholds. Example: .9\n    -l MINIMUM                       Minimum size to adjust (in GB)\n    -n NORMAL                        Levels are not adapted for filesystems of exactly this size, where levels are reduced for smaller filesystems and raised for larger filesystems.\n```\n\n**metrics-disk-usage.rb**\n```\nUsage: metrics-disk-usage.rb (options)\n    -B, --block-size BLOCK_SIZE      Set block size for sizes printed\n    -f, --flatten                    Output mounts with underscore rather than dot\n    -i, --ignore-mount MNT[,MNT]     Ignore mounts matching pattern(s)\n    -I, --include-mount MNT[,MNT]    Include only mounts matching pattern(s)\n    -l, --local                      Only check local filesystems (df -l option)\n        --scheme SCHEME              Metric naming scheme, text to prepend to .$parent.$child\n```\n\n\n### Configuration\n#### Sensu Go\n##### Asset registration\n\nAssets are the best way to make use of this plugin. If you're not using an asset, please consider doing so! If you're using sensuctl 5.13 or later, you can use the following command to add the asset: \n\n`sensuctl asset add sensu-plugins/sensu-plugins-disk-checks`\n\nIf you're using an earlier version of sensuctl, you can download the asset definition from [this project's Bonsai Asset Index page](https://bonsai.sensu.io/assets/sensu-plugins/sensu-plugins-disk-checks).\n\n##### Asset definition\n\n```yaml\n---\ntype: Asset\napi_version: core/v2\nmetadata:\n  name: sensu-plugins-disk-checks\nspec:\n  url: https://assets.bonsai.sensu.io/73a6f8b6f56672630d83ec21676f9a6251094475/sensu-plugins-disk-checks_5.0.0_centos_linux_amd64.tar.gz\n  sha512: 0ce9d52b270b77f4cab754e55732ae002228201d0bd01a89b954a0655b88c1ee6546e2f82cfd1eec04689af90ad940cde128e8867912d9e415f4a58d7fdcdadf\n```\n\n##### Check definition\n\n```yaml\n---\ntype: CheckConfig\nspec:\n  command: \"metrics-disk-usage.rb\"\n  handlers: []\n  high_flap_threshold: 0\n  interval: 10\n  low_flap_threshold: 0\n  publish: true\n  runtime_assets:\n  - sensu-plugins/sensu-plugins-disk-checks\n  - sensu/sensu-ruby-runtime\n  subscriptions:\n  - linux\n  output_metric_format: graphite_plaintext\n  output_metric_handlers:\n  - influx-db\n```\n#### Sensu Core\n##### Check definition\n```json\n{\n  \"checks\": {\n    \"metrics-disk-usage\": {\n      \"command\": \"metric-disk-usage.rb\",\n      \"subscribers\": [\"linux\"],\n      \"interval\": 10,\n      \"refresh\": 10,\n      \"handlers\": [\"influxdb\"]\n    }\n  }\n}\n\n```\n\n### Functionality\n\n**check-disk-usage**\n\nCheck disk capacity and inodes based upon the gem sys-filesystem.\n\nCan adjust thresholds for larger filesystems by providing a 'magic factor'\n(`-m`).  The default, `1.0`, will not adapt threshold percentages for volumes.\n\nThe `-l` option can be used in combination with the 'magic factor' to specify\nthe minimum size volume to adjust the thresholds for.\n\nBy default all mounted filesystems are checked.\n\nThe `-x` option can be used to exclude one or more filesystem types. e.g.\n\n    check-disk-usage.rb -x debugfs,tracefs\n\nThe `-p` option can be used to exlucde specific mount points. e.g.\n\n    check-disk-usage.rb -p /run/lxcfs\n\nIt's also possible to use regular expressions with the `-x` or `-p` option\n\n    check-disk-usage.rb -p '(\\/var|\\/run|\\/sys|\\/snap)'\n\nRefer to [check_mk's](https://mathias-kettner.de/checkmk_filesystems.html)\ndocumentation on adaptive thresholds.\n\nYou can also visualize the adjustment using\n[WolframAlpha]([https://www.wolframalpha.com/input/) with the following:\n\n    y = 100 - (100-P)*(N^(1-m))/(x^(1-m)), y = P for x in 0 to 1024\n\nWhere P = base percentage, N = normalize factor, and m = magic factor\n\n**check-fstab-mounts**\n\nCheck the mount points in */etc/fstab* to ensure they are all accounted for.\n\n**metrics-disk-capacity**\n\nAcquire disk capacity metrics from `df` and convert them to a form usable by graphite\n\n**metrics-disk**\n\nRead */proc/iostats* for disk metrics and put them in a form usable by Graphite.  See [iostats.txt](http://www.kernel.org/doc/Documentation/iostats.txt) for more details.\n\n**metrics-disk-usage**\n\nBased on disk-capacity-metrics.rb by bhenerey and nstielau. The difference here being how the key is defined in graphite and the size we emit to graphite(now using megabytes), inode info has also been dropped.\n\n**check-smart-status**\n\nCheck the SMART status of hardrives and alert based upon a given set of thresholds\n\n**check-smart**\n\nCheck the health of a disk using `smartctl`\n\n**check-smart-tests**\n\nCheck the status of SMART offline tests and optionally check if tests were executed in a specified interval\n\n### Additional information\nThe `check-smart.rb` and `check-smart-status.rb` scripts can make use of a json file living on disk in `/etc/sensu/conf.d`with the name `smart.json`. You can see a sample input file used by these scripts below. Please refer to the individual scripts for further details.\n```json\n{\n  \"smart\": {\n    \"attributes\": [\n      { \"id\": 1, \"name\": \"Raw_read_Error_Rate\", \"read\": \"left16bit\" },\n      { \"id\": 5, \"name\": \"Reallocated_Sector_Ct\" },\n      { \"id\": 9, \"name\": \"Power_On_Hours\", \"read\": \"right16bit\", \"warn_max\": 10000, \"crit_max\": 15000 },\n      { \"id\": 10 , \"name\": \"Spin_Retry_Count\" },\n      { \"id\": 184, \"name\": \"End-to-End_Error\" },\n      { \"id\": 187, \"name\": \"Reported_Uncorrect\" },\n      { \"id\": 188, \"name\": \"Command_Timeout\" },\n      { \"id\": 193, \"name\": \"Load_Cycle_Count\", \"warn_max\": 300000, \"crit_max\": 600000 },\n      { \"id\": 194, \"name\": \"Temperature_Celsius\", \"read\": \"right16bit\", \"crit_min\": 20, \"warn_min\": 10, \"warn_max\": 40, \"crit_max\": 50 },\n      { \"id\": 196, \"name\": \"Reallocated_Event_Count\" },\n      { \"id\": 197, \"name\": \"Current_Pending_Sector\" },\n      { \"id\": 198, \"name\": \"Offline_Uncorrectable\" },\n      { \"id\": 199, \"name\": \"UDMA_CRC_Error_Count\" },\n      { \"id\": 201, \"name\": \"Unc_Soft_read_Err_Rate\", \"read\": \"left16bit\" },\n      { \"id\": 230, \"name\": \"Life_Curve_Status\", \"crit_min\": 100, \"warn_min\": 100, \"warn_max\": 100, \"crit_max\": 100 }\n    ]\n  },\n  \"hardware\": {\n    \"devices\": [\n\t  { \"path\": \"sda\", \"ignore\" : [ 187 ] },\n\t  { \"path\": \"sdb\", \"override\": \"/dev/twa0 -d 3ware,0\" }\n\t]\n  }\n}\n```\n\n### Installation\n\n### Sensu Go\n\nSee the instructions above for [asset registration](#asset-registration)\n\n### Sensu Core\nInstall and setup plugins on [Sensu Core](https://docs.sensu.io/sensu-core/latest/installation/installing-plugins/)\n\n\n### Certification Verification\n\nIf you are verifying certificates in the gem install you will need the certificate for the `sys-filesystem` gem loaded in the gem certificate store. That cert can be found [here](https://raw.githubusercontent.com/djberg96/sys-filesystem/ffi/certs/djberg96_pub.pem).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsensu-plugins%2Fsensu-plugins-disk-checks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsensu-plugins%2Fsensu-plugins-disk-checks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsensu-plugins%2Fsensu-plugins-disk-checks/lists"}