This document contains development notes and configuration information for Claude when working on this CheckMK OPOSS zpool iostat plugin.
cmk-oposs_zpool_iostat/
├── local/
│ ├── share/check_mk/agents/plugins/
│ │ └── oposs_zpool_iostat # Agent plugin (Python)
│ └── lib/python3/cmk_addons/plugins/
│ ├── agent_based/
│ │ └── oposs_zpool_iostat.py # Check plugin
│ ├── rulesets/
│ │ ├── oposs_zpool_iostat.py # Check parameters ruleset
│ │ └── oposs_zpool_iostat_bakery.py # Agent bakery ruleset
│ └── checkman/
│ └── oposs_zpool_iostat # Documentation
├── LICENSE # MIT License
├── README.md # User documentation
└── CLAUDE.md # This file
- Purpose: Collects ZFS pool I/O statistics using
zpool iostat -Hylpq - Configuration: Reads from
/etc/check_mk/oposs_zpool_iostat.json - Supported Config Options:
enabled: Enable/disable monitoring (default: true)timeout: Command timeout in seconds (default: 30)sampling_duration: Iostat sampling duration (default: 10)
- Output Format: JSON per pool with pipe separator
- Purpose: Processes agent data and performs threshold checking
- Key Functions:
parse_oposs_zpool_iostat(): Parses JSON agent datadiscover_oposs_zpool_iostat(): Discovers ZFS poolscheck_oposs_zpool_iostat(): Performs monitoring checks
- Behavior: Only yields Result objects when specific thresholds are configured
- Purpose: Defines GUI configuration for monitoring thresholds
- Parameter Groups:
- Basic: storage_levels, *_ops_levels, *_wait_levels, *_throughput_levels
- Advanced: disk_wait_levels, individual queue metrics
- Alignment: All parameters correspond to actual
zpool iostatfields
- Purpose: Automated agent deployment configuration
- Supported Options: Only options actually implemented in agent plugin
enabled,timeout,sampling_duration
- Removed: Fictional options like retry logic, version checking
- Agent Plugin: Runs
zpool iostat -Hylpq {sampling_duration} 1 - Agent Plugin: Parses output into structured JSON per pool
- Agent Plugin: Outputs in CheckMK section format with pipe separator
- Check Plugin: Parses JSON data from agent section
- Check Plugin: Calculates derived metrics (e.g., storage utilization %)
- Check Plugin: Applies configured thresholds and yields results
field_names = [
'pool', 'alloc', 'free', 'read_ops', 'write_ops', 'read_bytes', 'write_bytes',
'read_wait', 'write_wait', 'disk_read_wait', 'disk_write_wait',
'syncq_read_wait', 'syncq_write_wait', 'asyncq_read_wait', 'asyncq_write_wait',
'scrub_wait', 'trim_wait', 'rebuild_wait', 'syncq_read_pend', 'syncq_read_activ',
'syncq_write_pend', 'syncq_write_activ', 'asyncq_read_pend', 'asyncq_read_activ',
'asyncq_write_pend', 'asyncq_write_activ', 'scrubq_read_pend', 'scrubq_read_activ',
'trimq_write_pend', 'trimq_write_activ', 'rebuildq_write_pend', 'rebuildq_write_activ'
]storage_used_percent: Calculated as(alloc / (alloc + free)) * 100
- Raw Data: ZFS reports wait times in nanoseconds
- Internal Storage: All wait time metrics are converted to seconds (SI base unit) and stored with
_ssuffix - User Configuration: Thresholds are configured in milliseconds for user convenience
- Conversion Flow:
- Agent collects data in nanoseconds
- Check plugin converts nanoseconds to seconds (divide by 1e9)
- Thresholds in milliseconds are converted to seconds for comparison (divide by 1000)
- Display renders seconds as milliseconds (multiply by 1000) for readability
- Metric Naming Convention: Added
_ssuffix to create new metrics, preventing mixing with old nanosecond data - Affected Metrics: All
*_waitmetrics now have_ssuffix:read_wait_s,write_wait_s,disk_read_wait_s,disk_write_wait_ssyncq_read_wait_s,syncq_write_wait_s,asyncq_read_wait_s,asyncq_write_wait_sscrub_wait_s,trim_wait_s,disk_wait_max_s
- Breaking Change: Metric names have changed to include
_ssuffix - Historical Data: Old metrics stored in nanoseconds will not be compatible with new metrics in seconds
- Clean Break: This is intentional to prevent incorrect data interpretation
- Best Practice: Per CheckMK plugin development guide, always use SI base units (seconds for time, bytes for data)
- Only Real Data: All parameters correspond to actual zpool iostat fields
- Granular Control: Individual parameters for each queue metric type
- Sensible Defaults: Default thresholds based on metric characteristics
- Optional: All parameters optional (None by default except storage_levels)
- Minimal: Only options actually implemented in agent
- Clear Naming:
sampling_duration(notinterval) to avoid confusion with CheckMK plugin intervals
- All ruleset parameters must correspond to actual data from
zpool iostat - Removed fictional parameters like
collect_detailed_metrics,ignore_zero_metrics - Agent always collects all available metrics with hardcoded
-Hylpqflags
- No combined status summaries - only yield Result objects for configured thresholds
- Always yield Metric objects for performance data
- Individual threshold checking for each queue metric type
# Test agent plugin manually
/usr/lib/check_mk_agent/plugins/oposs_zpool_iostat
# Check actual zpool iostat output
zpool iostat -Hylpq 10 1
# Verify field count matches agent parsing
zpool iostat -Hylpq 10 1 | awk '{print NF}' | head -1- Data Alignment: Always verify parameters match actual
zpool iostatoutput - Error Handling: Robust error handling with clear error messages
- Performance: Efficient data collection and processing
- Documentation: Keep documentation in sync with actual implementation
- Testing: Test with various ZFS configurations and edge cases
- Support for additional zpool iostat options if needed
- Pool-specific configuration options
- Historical data collection and trending
- Integration with ZFS pool health monitoring