License
MIT License
v0.1.1 · public · Published about 1 month ago
This plugin provides native disk instrumentation for monitoring and metrics collection in Sensu Go. It is a Golang replacement for sensu-plugins/sensu-plugins-disk-checks.
Features:
Check disk usage against warning and critical thresholds.
check-disk-usage --warning 80 --critical 90
Options:
-w, --warning float Warning threshold percentage for disk usage
-c, --critical float Critical threshold percentage for disk usage
-i, --ignore-paths strings Comma-separated list of mount paths to ignore
-I, --include-paths strings Comma-separated list of mount paths to include (if set, only these are checked)
-x, --ignore-types strings Comma-separated list of filesystem types to ignore
-t, --include-types strings Comma-separated list of filesystem types to include (if set, only these are checked)
Examples:
Check all filesystems with 80% warning and 90% critical thresholds:
check-disk-usage --warning 80 --critical 90
Check only ext4 filesystems:
check-disk-usage --warning 80 --critical 90 --include-types ext4
Ignore tmpfs and devtmpfs filesystems:
check-disk-usage --warning 80 --critical 90 --ignore-types tmpfs,devtmpfs
Check specific mount points:
check-disk-usage --warning 80 --critical 90 --include-paths /,/home
Verify that filesystems defined in /etc/fstab are actually mounted.
check-fstab-mounts
Options:
-f, --fstab-path string Path to fstab file (default "/etc/fstab")
Examples:
Check default fstab:
check-fstab-mounts
Check custom fstab file:
check-fstab-mounts --fstab-path /etc/fstab.backup
Check SMART disk health status using smartctl.
check-smart --devices /dev/sda,/dev/sdb
Options:
-d, --devices strings Comma-separated list of devices to check (e.g., /dev/sda,/dev/sdb)
-s, --smartctl-path string Path to smartctl binary (default "smartctl")
-c, --config-file string Path to JSON config file with device list (default "/etc/sensu/conf.d/smart.json")
Examples:
Check specific devices:
check-smart --devices /dev/sda,/dev/sdb
Auto-detect devices:
check-smart
Use config file:
check-smart --config-file /etc/sensu/conf.d/smart.json
Note: Requires smartctl (from smartmontools package) and typically needs sudo permissions.
Check SMART offline test status.
check-smart-status --devices /dev/sda
Options:
-d, --devices strings Comma-separated list of devices to check
-s, --smartctl-path string Path to smartctl binary (default "smartctl")
-c, --config-file string Path to JSON config file with device list (default "/etc/sensu/conf.d/smart.json")
Note: Requires smartctl and typically needs sudo permissions.
Check SMART self-test status and verify tests are running within expected intervals.
check-smart-tests --devices /dev/sda --short-test-interval 24 --long-test-interval 336
Options:
-d, --devices strings Comma-separated list of devices to check
-s, --smartctl-path string Path to smartctl binary (default "smartctl")
-c, --config-file string Path to JSON config file with device list (default "/etc/sensu/conf.d/smart.json")
-l, --short-test-interval int Maximum hours since last short test (default 24, 0 to disable)
-t, --long-test-interval int Maximum hours since last extended test (default 336, 0 to disable)
Examples:
Check with default intervals (24h for short, 14 days for long):
check-smart-tests --devices /dev/sda,/dev/sdb
Custom intervals:
check-smart-tests --devices /dev/sda --short-test-interval 12 --long-test-interval 168
Note: Requires smartctl and typically needs sudo permissions.
Output disk usage metrics in Graphite plaintext format.
metrics-disk-usage
Options:
-s, --scheme string Metric naming scheme prefix (default "disk_usage")
-i, --ignore-paths strings Comma-separated list of mount paths to ignore
-I, --include-paths strings Comma-separated list of mount paths to include (if set, only these are checked)
-x, --ignore-types strings Comma-separated list of filesystem types to ignore
-t, --include-types strings Comma-separated list of filesystem types to include (if set, only these are checked)
Examples:
Output metrics for all filesystems:
metrics-disk-usage
Output metrics with custom scheme:
metrics-disk-usage --scheme servers.disk
Output metrics only for ext4 filesystems:
metrics-disk-usage --include-types ext4
Output format:
All metrics commands output in Graphite plaintext format with the following metrics per filesystem:
used_bytes - Bytes usedtotal_bytes - Total bytesfree_bytes - Bytes freeused_percent - Percentage usedinodes_used - Inodes usedinodes_total - Total inodesinodes_free - Inodes freeinodes_used_percent - Percentage of inodes usedAssets are the best way to make use of this plugin. If you're not using an asset, please consider doing so!
---
type: Asset
api_version: core/v2
metadata:
name: sensu-check-disk
spec:
builds:
- url: https://github.com/nmollerup/sensu-check-disk/releases/download/{{ version }}/sensu-check-disk_{{ version }}_linux_amd64.tar.gz
sha512: REPLACE_WITH_SHA512
filters:
- entity.system.os == 'linux'
- entity.system.arch == 'amd64'
Check disk usage:
---
type: CheckConfig
api_version: core/v2
metadata:
name: check-disk-usage
spec:
command: check-disk-usage --warning 80 --critical 90 --ignore-types tmpfs,devtmpfs
runtime_assets:
- sensu-check-disk
subscriptions:
- system
interval: 60
publish: true
Metrics collection:
---
type: CheckConfig
api_version: core/v2
metadata:
name: metrics-disk-usage
spec:
command: metrics-disk-usage --scheme disk_usage
runtime_assets:
- sensu-check-disk
subscriptions:
- system
interval: 60
output_metric_format: graphite_plaintext
output_metric_handlers:
- influxdb
publish: true
Download the latest version or create an executable from this source.
From source:
go install github.com/nmollerup/sensu-check-disk/cmd/check-disk-usage@latest
go install github.com/nmollerup/sensu-check-disk/cmd/metrics-disk-usage@latest
From release:
Download the latest release from the releases page.
Build from source:
git clone https://github.com/nmollerup/sensu-check-disk.git
cd sensu-check-disk
go build -o bin/check-disk-usage ./cmd/check-disk-usage
go build -o bin/metrics-disk-usage ./cmd/metrics-disk-usage
Contributions are welcome! Please open an issue or submit a pull request.
Please describe the reason for reporting this asset. Our moderators will be notified and will disable the asset if it is found to be inappropriate.
×