Sensu Check Entropy

Description
This plugin provides native entropy instrumentation for monitoring and metrics collection of available system entropy on Linux systems.
The plugin includes:
- check-entropy: Monitor entropy levels with configurable warning and critical thresholds
- metrics-entropy: Collect entropy metrics in Graphite format for time-series databases
Both commands read the available entropy from /proc/sys/kernel/random/entropy_avail.
Installation
Binary Releases
Download the latest release from the releases page.
From Source
go install github.com/nmollerup/sensu-check-entropy/cmd/check-entropy@latest
go install github.com/nmollerup/sensu-check-entropy/cmd/metrics-entropy@latest
Configuration
Asset Registration
Assets are the recommended way to install plugins in Sensu. The asset can be configured using sensuctl:
sensuctl asset add nmollerup/sensu-check-entropy
Check Definition
Example check definition:
---
type: CheckConfig
api_version: core/v2
metadata:
name: check-entropy
spec:
command: check-entropy --warning 60 --critical 30
subscriptions:
- linux
runtime_assets:
- nmollerup/sensu-check-entropy
interval: 60
publish: true
Usage
check-entropy
Sensu check to monitor available system entropy
Usage:
check-entropy [flags]
Flags:
-c, --critical int Critical threshold for available entropy (default 30)
-h, --help help for check-entropy
-m, --metrics Output entropy as metrics in Graphite format
-s, --metric-scheme Metric naming scheme when using --metrics (default: hostname.entropy)
-w, --warning int Warning threshold for available entropy (default 60)
Examples
Check with default thresholds (warning: 60, critical: 30):
check-entropy
Check with custom thresholds:
check-entropy --warning 100 --critical 50
Check using environment variables:
CHECK_ENTROPY_WARNING=100 CHECK_ENTROPY_CRITICAL=50 check-entropy
Output metrics in Graphite format:
check-entropy --metrics
# Output: hostname.entropy 256 1738147200
Output metrics with custom scheme:
check-entropy --metrics --metric-scheme myserver.system.entropy
# Output: myserver.system.entropy 256 1738147200
Output
The check will output one of the following states:
- OK: Entropy is above the warning threshold
- WARNING: Entropy is at or below the warning threshold but above the critical threshold
- CRITICAL: Entropy is at or below the critical threshold
- UNKNOWN: Unable to read entropy or invalid thresholds
Example outputs:
CheckEntropy OK: entropy is 256
CheckEntropy WARNING: entropy is 55
CheckEntropy CRITICAL: entropy is 25
metrics-entropy
Sensu metric plugin to collect system entropy metrics
Usage:
metrics-entropy [flags]
Flags:
-h, --help help for metrics-entropy
-s, --scheme string Metric naming scheme, text to prepend to metric (default: hostname.entropy)
Examples
Collect entropy metrics with default scheme:
metrics-entropy
# Output: hostname.entropy 256 1738147200
Collect entropy metrics with custom scheme:
metrics-entropy --scheme production.server01.entropy
# Output: production.server01.entropy 256 1738147200
Example metric check definition:
---
type: CheckConfig
api_version: core/v2
metadata:
name: metrics-entropy
spec:
command: metrics-entropy
subscriptions:
- linux
runtime_assets:
- nmollerup/sensu-check-entropy
interval: 60
publish: true
output_metric_format: graphite_plaintext
output_metric_handlers:
- influxdb
This plugin is designed for Linux systems only, as it reads from /proc/sys/kernel/random/entropy_avail.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License - see LICENSE file for details.