def vs_abs_perc(): return CascadingDropdown( orientation="horizontal", choices=[ ( "perc", _("Percentual levels (in relation to port speed)"), Tuple( orientation="float", show_titles=False, elements=[ Percentage(label=_("Warning at")), Percentage(label=_("Critical at")), ], ), ), ( "abs", _("Absolute levels in bits or bytes per second"), Tuple( orientation="float", show_titles=False, elements=[ Integer(label=_("Warning at")), Integer(label=_("Critical at")), ], ), ), ("predictive", _("Predictive Levels (only on CMC)"), PredictiveLevels()), ], )
def test_load_levels_wato(): # when scaling the preditvie levels we make certain asumptions about the # wato structure of predictive levels here we try to make sure that these # asumptions are still correct. if this test fails, fix it and adapt # _scale_levels_predictive to handle the changed values from cmk.gui.plugins.wato import PredictiveLevels pl = PredictiveLevels() pl.validate_value(LEVELS, "") pl.validate_datatype(LEVELS, "")
def _parameter_valuespec_memory_pagefile_win(): return Dictionary( elements=[ ( "memory", Alternative( title=_("Memory Levels"), elements=[ Tuple( title=_("Memory usage in percent"), elements=[ Percentage(title=_("Warning at")), Percentage(title=_("Critical at")), ], ), Transform( Tuple( title=_("Absolute free memory"), elements=[ Filesize(title=_("Warning if less than")), Filesize(title=_("Critical if less than")), ], ), # Note: Filesize values lesser 1MB will not work # -> need hide option in filesize valuespec back=lambda x: (x[0] // 1024 // 1024, x[1] // 1024 // 1024), forth=lambda x: (x[0] * 1024 * 1024, x[1] * 1024 * 1024)), PredictiveLevels(unit=_("GB"), default_difference=(0.5, 1.0)) ], default_value=(80.0, 90.0))), ( "pagefile", Alternative( title=_("Commit charge Levels"), elements=[ Tuple( title= _("Commit charge in percent (relative to commit limit)" ), elements=[ Percentage(title=_("Warning at")), Percentage(title=_("Critical at")), ], ), Transform( Tuple( title=_("Absolute commitable memory"), elements=[ Filesize(title=_("Warning if less than")), Filesize(title=_("Critical if less than")), ], ), # Note: Filesize values lesser 1MB will not work # -> need hide option in filesize valuespec back=lambda x: (x[0] // 1024 // 1024, x[1] // 1024 // 1024), forth=lambda x: (x[0] * 1024 * 1024, x[1] * 1024 * 1024)), PredictiveLevels(unit=_("GB"), default_difference=(0.5, 1.0)) ], default_value=(80.0, 90.0))), ("average", Integer( title=_("Averaging"), help= _("If this parameter is set, all measured values will be averaged " "over the specified time interval before levels are being applied. Per " "default, averaging is turned off. "), unit=_("minutes"), minvalue=1, default_value=60, )), ], )