rulesets.v1

class _Localizable(_arg, *, _modifier=None)

Base class for creating a localizable string

This class marks its argument as “to be localized”. The actual localization is done later by the backend. For this to work, the argument passed to the constructor needs to be present in the localization file.

Parameters:

arg – The string to be localized.

Returns:

An object that can later be translated by the backend.

Examples

Examples are given for the _Localizable class, but they are meant to be implemented using the appropriate subclasses, such as Title, Label, Help, and Message.

This is a simple use case:

>>> title = _Localizable("Translate this title")

Note that the returned type only supports % formatting and addition.

When adding localizables, you must make sure the translations of the individual components are available.

>>> help = _Localizable("Translate this. ") + _Localizable("Translate this separately.")

Sometimes you might want to format individually localized strings, to ensure consistent translations:

>>> help = _Localizable("Please use '%s' for foo") % _Localizable("params for foo")

Be aware that this does not result in an instance of a Localizable:

>>> "%s!" % _Localizable("hi")
"_Localizable('hi')!"
class Help(_arg, *, _modifier=None)

Bases: _Localizable

Create a localizable help text for more detailed descriptions which can contain more complex formatting

class Label(_arg, *, _modifier=None)

Bases: _Localizable

Create a localizable label which acts an extension of the input field with additional information

class Message(_arg, *, _modifier=None)

Bases: _Localizable

Create a localizable message which notifies the user during runtime, e.g. to clarify why a validation has failed.

entry_point_prefixes()

Return the types of plug-ins and their respective prefixes that can be discovered by Checkmk.

These types can be used to create plug-ins that can be discovered by Checkmk. To be discovered, the plug-in must be of one of the types returned by this function and its name must start with the corresponding prefix.

Return type:

Mapping[type[ActiveCheck | AgentConfig | AgentAccess | EnforcedService | CheckParameters | Host | InventoryParameters | NotificationParameters | DiscoveryParameters | Service | SNMP | SpecialAgent], str]

Example:

>>> for plugin_type, prefix in entry_point_prefixes().items():
...     print(f'{prefix}... = {plugin_type.__name__}(...)')
rule_spec_... = ActiveCheck(...)
rule_spec_... = AgentConfig(...)
rule_spec_... = AgentAccess(...)
rule_spec_... = EnforcedService(...)
rule_spec_... = CheckParameters(...)
rule_spec_... = Host(...)
rule_spec_... = InventoryParameters(...)
rule_spec_... = NotificationParameters(...)
rule_spec_... = DiscoveryParameters(...)
rule_spec_... = Service(...)
rule_spec_... = SNMP(...)
rule_spec_... = SpecialAgent(...)
class Title(_arg, *, _modifier=None)

Bases: _Localizable

Create a localizable title which shortly describes an element