Goal
Migrate all --warning and --critical parameters from type=int (or type=float) to type=str with _operator='range' in lib.base.get_state(), enabling full Nagios range expressions like 10:, ~:50, @10:20.
Background
The CONTRIBUTING and the example plugin now define Nagios range support as the standard for new plugins. Existing plugins still use type=int with the default _operator='ge', which only supports simple "greater or equal" thresholds.
What needs to change per plugin
- Remove
type=int (or type=float) from --warning and --critical add_argument() calls (defaults to type=str).
- Change
lib.base.get_state(value, args.WARN, args.CRIT) to lib.base.get_state(value, args.WARN, args.CRIT, _operator='range').
- Update the help text Default from
Default: >= %(default)s to Default: %(default)s (the range interpretation handles the direction).
- Update unit tests if they assert on specific threshold behavior.
Backward compatibility
Simple numeric values like --critical 90 continue to work identically: 90 as a Nagios range means "alert if outside 0..90", which is equivalent to the current "alert if >= 90" behavior for values between 0 and 100. No admin-visible breaking change for standard usage.
Scope
All plugins that currently use type=int or type=float for --warning/--critical parameters with lib.base.get_state().
Goal
Migrate all
--warningand--criticalparameters fromtype=int(ortype=float) totype=strwith_operator='range'inlib.base.get_state(), enabling full Nagios range expressions like10:,~:50,@10:20.Background
The CONTRIBUTING and the example plugin now define Nagios range support as the standard for new plugins. Existing plugins still use
type=intwith the default_operator='ge', which only supports simple "greater or equal" thresholds.What needs to change per plugin
type=int(ortype=float) from--warningand--criticaladd_argument()calls (defaults totype=str).lib.base.get_state(value, args.WARN, args.CRIT)tolib.base.get_state(value, args.WARN, args.CRIT, _operator='range').Default: >= %(default)stoDefault: %(default)s(the range interpretation handles the direction).Backward compatibility
Simple numeric values like
--critical 90continue to work identically:90as a Nagios range means "alert if outside 0..90", which is equivalent to the current "alert if >= 90" behavior for values between 0 and 100. No admin-visible breaking change for standard usage.Scope
All plugins that currently use
type=intortype=floatfor--warning/--criticalparameters withlib.base.get_state().