示例#1
0
    def liveproxyd_connection_params_elements(cls):
        defaults = ConfigDomainLiveproxy.connection_params_defaults()

        return [
            ("channels",
             Integer(
                 title=_("Number of channels to keep open"),
                 minvalue=2,
                 maxvalue=50,
                 default_value=defaults["channels"],
             )),
            ("heartbeat",
             Tuple(title=_("Regular heartbeat"),
                   orientation="float",
                   elements=[
                       Integer(
                           label=_("One heartbeat every"),
                           unit=_("sec"),
                           minvalue=1,
                           default_value=defaults["heartbeat"][0],
                       ),
                       Float(label=_("with a timeout of"),
                             unit=_("sec"),
                             minvalue=0.1,
                             default_value=defaults["heartbeat"][1],
                             display_format="%.1f"),
                   ])),
            ("channel_timeout",
             Float(
                 title=_("Timeout waiting for a free channel"),
                 minvalue=0.1,
                 default_value=defaults["channel_timeout"],
                 unit=_("sec"),
             )),
            ("query_timeout",
             Float(
                 title=_("Total query timeout"),
                 minvalue=0.1,
                 unit=_("sec"),
                 default_value=defaults["query_timeout"],
             )),
            ("connect_retry",
             Float(
                 title=_("Cooling period after failed connect/heartbeat"),
                 minvalue=0.1,
                 unit=_("sec"),
                 default_value=defaults["connect_retry"],
             )),
            ("cache",
             Checkbox(
                 title=_("Enable Caching"),
                 label=_("Cache several non-status queries"),
                 help=
                 _("This option will enable the caching of several queries that "
                   "need no current data. This reduces the number of Livestatus "
                   "queries to sites and cuts down the response time of remote "
                   "sites with large latencies."),
                 default_value=defaults["cache"],
             )),
        ]
示例#2
0
文件: sites.py 项目: epasham/checkmk
    def transform_old_connection_params(cls, value):
        if "params" in value:
            return value

        new_value = {
            "params": value,
        }

        defaults = ConfigDomainLiveproxy.connection_params_defaults()
        for key, val in value.items():
            if val == defaults[key]:
                del value[key]

        if not value:
            new_value["params"] = None

        return new_value