def _item_cohesity_node_status():
    return TextAscii(
        title=_("Node"),
        help=_("Name of node"),
    )
Esempio n. 2
0
def _werk_table_option_entries():
    translator = cmk.utils.werks.WerkTranslator()
    return [
        ("classes", "double",
         ListChoice(
             title=_("Classes"),
             choices=sorted(translator.classes()),
         ), ["feature", "fix", "security"]),
        ("levels", "double",
         ListChoice(
             title=_("Levels"),
             choices=sorted(translator.levels()),
         ), [1, 2, 3]),
        ("date", "double", Timerange(title=_("Date")),
         ('date', (1383149313, int(time.time())))),
        ("id", "single",
         TextAscii(
             title=_("Werk ID"),
             label="#",
             regex="[0-9]{4}",
             allow_empty=True,
             size=4,
         ), ""),
        ("compatibility", "single",
         DropdownChoice(title=_("Compatibility"),
                        choices=[
                            (["compat", "incomp_ack", "incomp_unack"],
                             _("Compatible and incompatible Werks")),
                            (["compat"], _("Compatible Werks")),
                            (["incomp_ack",
                              "incomp_unack"], _("Incompatible Werks")),
                            (["incomp_unack"],
                             _("Unacknowledged incompatible Werks")),
                            (["incomp_ack"],
                             _("Acknowledged incompatible Werks")),
                        ]), ["compat", "incomp_ack", "incomp_unack"]),
        ("component", "single",
         DropdownChoice(
             title=_("Component"),
             choices=[
                 (None, _("All components")),
             ] + sorted(translator.components()),
         ), None),
        ("edition", "single",
         DropdownChoice(
             title=_("Edition"),
             choices=[
                 (None, _("All editions")),
                 ("cme",
                  _("Werks only concerning the Managed Services Edition")),
                 ("cee", _("Werks only concerning the Enterprise Edition")),
                 ("cre", _("Werks also concerning the Raw Edition")),
             ],
         ), None),
        ("werk_content", "single",
         TextUnicode(
             title=_("Werk title or content"),
             size=41,
         ), ""),
        ("version", "single",
         Tuple(title=_("Checkmk Version"),
               orientation="float",
               elements=[
                   TextAscii(label=_("from:"), size=12),
                   TextAscii(label=_("to:"), size=12),
               ]), ("", "")),
        ("grouping", "single",
         DropdownChoice(
             title=_("Group Werks by"),
             choices=[
                 ("version", _("Checkmk Version")),
                 ("day", _("Day of creation")),
                 ("week", _("Week of creation")),
                 (None, _("Do not group")),
             ],
         ), "version"),
        ("group_limit", "single",
         Integer(
             title=_("Show number of groups"),
             unit=_("groups"),
             minvalue=1,
         ), 20),
    ]
Esempio n. 3
0
def _item_spec_docker_node_disk_usage():
    return TextAscii(
        title=_("Type"),
        help=_("Either Containers, Images, Local Volumes or Build Cache"),
        allow_empty=True,
    )
Esempio n. 4
0
    TextAscii,
)

from cmk.gui.plugins.wato import (
    CheckParameterRulespecWithItem,
    rulespec_registry,
    RulespecGroupCheckParametersEnvironment,
)


def _parameter_valuespec_switch_contact():
    return DropdownChoice(
        help=_("This rule sets the required state of a switch contact"),
        label=_("Required switch contact state"),
        choices=[
            ("open", "Switch contact is <b>open</b>"),
            ("closed", "Switch contact is <b>closed</b>"),
            ("ignore", "Ignore switch contact state"),
        ],
    )


rulespec_registry.register(
    CheckParameterRulespecWithItem(
        check_group_name="switch_contact",
        group=RulespecGroupCheckParametersEnvironment,
        item_spec=lambda: TextAscii(title=_("Sensor"), allow_empty=False),
        parameter_valuespec=_parameter_valuespec_switch_contact,
        title=lambda: _("Switch contact state"),
    ))
Esempio n. 5
0
 def item_spec(self):
     return TextAscii(
         title=_("Connection name"),
         help=_("Specify an arbitrary name of this connection here"),
         allow_empty=False,
     )
Esempio n. 6
0
             elements=[
                 Tuple(
                     title=_("Percentual levels (in relation to policy speed)"),
                     elements=[
                         Percentage(title=_("Warning at"),
                                    maxvalue=1000,
                                    label=_("% of port speed")),
                         Percentage(title=_("Critical at"),
                                    maxvalue=1000,
                                    label=_("% of port speed")),
                     ],
                 ),
                 Tuple(elements=[
                     Integer(title=_("Warning at"), size=8, label=_("bits / bytes per second")),
                     Integer(title=_("Critical at"), size=8, label=_("bits / bytes per second")),
                 ],)
             ],
         )),
    ],)


rulespec_registry.register(
    CheckParameterRulespecWithItem(
        check_group_name="cisco_qos",
        group=RulespecGroupCheckParametersNetworking,
        item_spec=lambda: TextAscii(title=_("port specification"), allow_empty=False),
        match_type="dict",
        parameter_valuespec=_parameter_valuespec_cisco_qos,
        title=lambda: _("Cisco quality of service"),
    ))
Esempio n. 7
0
def _item_spec_filestats():
    return TextAscii(
        title=_("File Group Name"),
        help=_("This name must match the name of the section defined "
               "in the mk_filestats configuration."),
        allow_empty=True)
Esempio n. 8
0
def _item_spec_juniper_mem_modules():
    return TextAscii(
        title=_("Module Name"),
        help=_("The identificator of the module."),
    )
Esempio n. 9
0
def _item_spec_mysql_innodb_io():
    return TextAscii(
        title=_("Instance"),
        help=_("Only needed if you have multiple MySQL Instances on one server"),
    )
Esempio n. 10
0
def _item_spec_db2_counters():
    return TextAscii(
        title=_("Instance"),
        help=_("DB2 instance followed by database name, e.g db2taddm:CMDBS1"))
Esempio n. 11
0
             title=_("State when VPN status is Destroy"),
             default_value=1,
         )),
        ("Idle",
         MonitoringState(
             title=_("State when VPN status is Idle"),
             default_value=0,
         )),
        ("Phase1",
         MonitoringState(
             title=_("State when VPN status is Phase1"),
             default_value=2,
         )),
        ("Down",
         MonitoringState(
             title=_("State when VPN status is Down"),
             default_value=2,
         )),
        ("Init",
         MonitoringState(
             title=_("State when VPN status is Init"),
             default_value=1,
         )),
    ]),
    TextAscii(
        title=_("Name of VPN tunnel"),
        allow_empty=True,
    ),
    match_type="dict",
)
Esempio n. 12
0
def _item_spec_if():
    return TextAscii(title=_("port specification"), allow_empty=False)
Esempio n. 13
0
         ),
         forth=str,
         back=int,
     )),
    ("items",
     ListOfStrings(
         title=_("Restrict interface items"),
         help=_("Only interface with these item names are put into this group."),
     )),
]  # type: List[DictionaryEntry]

vs_elements_if_groups_group = [
    ("group_name",
     TextAscii(
         title=_("Group name"),
         help=_("Name of group in service description"),
         allow_empty=False,
     )),
    ("group_presence",
     DropdownChoice(
         title=_("Group interface presence"),
         help=_("Determine whether the group interface is created as an "
                "separate service or not. In second case the choosen interface "
                "services disapear."),
         choices=[
             ("separate", _("List grouped interfaces separately")),
             ("instead", _("List grouped interfaces instead")),
         ],
         default_value="instead",
     )),
]
Esempio n. 14
0
 def item_spec(self):
     return TextAscii(title=_(
         "The filesystem path, prefixed with <i>File </i> or <i>Folder </i>"
     ), )
Esempio n. 15
0
def _item_spec_ibm_svc_enclosure():
    return TextAscii(
        title=_("Name of enclosure"),
        help=_("Name of the enclosure, e.g. Enclosure 1"),
    )
Esempio n. 16
0
        ("2_fail",
         MonitoringState(title=_("Failover State: FAILOVER_PENDING"),
                         default_value=2)),
        ("3_fail",
         MonitoringState(title=_("Failover State: FAILED_OVER"),
                         default_value=2)),
        ("4_fail",
         MonitoringState(title=_("Failover State: ACTIVE"), default_value=2)),
        ("5_fail",
         MonitoringState(title=_("Failover State: ACTIVE_DOWN"),
                         default_value=2)),
        ("6_fail",
         MonitoringState(title=_("Failover State: ACTIVE_FAILED"),
                         default_value=2)),
        ("7_fail",
         MonitoringState(title=_("Failover State: FAILBACK_PENDING"),
                         default_value=1)),
    ], )


rulespec_registry.register(
    CheckParameterRulespecWithItem(
        check_group_name="threepar_ports",
        group=RulespecGroupCheckParametersNetworking,
        item_spec=lambda: TextAscii(title=_("Port"),
                                    help=_("The Port Description")),
        match_type="dict",
        parameter_valuespec=_parameter_valuespec_threepar_ports,
        title=lambda: _("3PAR Ports"),
    ))
Esempio n. 17
0
from cmk.gui.i18n import _
from cmk.gui.valuespec import (
    Percentage,
    TextAscii,
    Tuple,
)

from cmk.gui.plugins.wato import (
    CheckParameterRulespecWithItem,
    rulespec_registry,
    RulespecGroupCheckParametersNetworking,
)


def _parameter_valuespec_signal_quality():
    return Tuple(elements=[
        Percentage(title=_("Warning if under"), maxvalue=100),
        Percentage(title=_("Critical if under"), maxvalue=100),
    ], )


rulespec_registry.register(
    CheckParameterRulespecWithItem(
        check_group_name="signal_quality",
        group=RulespecGroupCheckParametersNetworking,
        item_spec=lambda: TextAscii(title=_("Network specification"),
                                    allow_empty=True),
        parameter_valuespec=_parameter_valuespec_signal_quality,
        title=lambda: _("Signal quality of Wireless device"),
    ))
Esempio n. 18
0
def _parameter_valuespec_logwatch_ec():
    return Alternative(
        title=_("Forwarding"),
        help=_("Instead of using the regular logwatch check all lines received by logwatch can "
               "be forwarded to a Check_MK event console daemon to be processed. The target event "
               "console can be configured for each host in a separate rule."),
        style="dropdown",
        elements=[
            FixedValue(
                "",
                totext=_("Messages are handled by logwatch."),
                title=_("No forwarding"),
            ),
            Dictionary(
                title=_('Forward Messages to Event Console'),
                elements=[
                    (
                        'method',
                        Transform(
                            # TODO: Clean this up to some CascadingDropdown()
                            Alternative(
                                style="dropdown",
                                title=_("Forwarding Method"),
                                elements=[
                                    FixedValue(
                                        "",
                                        title=
                                        _("Local: Send events to local Event Console in same OMD site"
                                         ),
                                        totext=_("Directly forward to Event Console"),
                                    ),
                                    TextAscii(
                                        title=
                                        _("Local: Send events to local Event Console into unix socket"
                                         ),
                                        allow_empty=False,
                                    ),
                                    FixedValue(
                                        "spool:",
                                        title=
                                        _("Local: Spooling - Send events to local event console in same OMD site"
                                         ),
                                        totext=_("Spool to Event Console"),
                                    ),
                                    Transform(
                                        TextAscii(allow_empty=False,),
                                        title=
                                        _("Local: Spooling - Send events to local Event Console into given spool directory"
                                         ),
                                        forth=lambda x: x[6:],
                                        # remove prefix
                                        back=lambda x: "spool:" + x,  # add prefix
                                    ),
                                    CascadingDropdown(
                                        title=_("Remote: Send events to remote syslog host"),
                                        choices=[
                                            (
                                                "tcp",
                                                _("Send via TCP"),
                                                Dictionary(
                                                    elements=[
                                                        ("address",
                                                         TextAscii(
                                                             title=_("Address"),
                                                             allow_empty=False,
                                                         )),
                                                        ("port",
                                                         Integer(
                                                             title=_("Port"),
                                                             default_value=514,
                                                             minvalue=1,
                                                             maxvalue=65535,
                                                             size=6,
                                                         )),
                                                        (
                                                            "spool",
                                                            Dictionary(
                                                                title=
                                                                _("Spool messages that could not be sent"
                                                                 ),
                                                                help=
                                                                _("Messages that can not be forwarded, e.g. when the target Event Console is "
                                                                  "not running, can temporarily be stored locally. Forwarding is tried again "
                                                                  "on next execution. When messages are spooled, the check will go into WARNING "
                                                                  "state. In case messages are dropped by the rules below, the check will shortly "
                                                                  "go into CRITICAL state for this execution."
                                                                 ),
                                                                elements=[
                                                                    (
                                                                        "max_age",
                                                                        Age(
                                                                            title=
                                                                            _("Maximum spool duration"
                                                                             ),
                                                                            help=
                                                                            _("Messages that are spooled longer than this time will be thrown away."
                                                                             ),
                                                                            default_value=60 * 60 *
                                                                            24 *
                                                                            7,  # 1 week should be fine (if size is not exceeded)
                                                                        )),
                                                                    (
                                                                        "max_size",
                                                                        Filesize(
                                                                            title=_(
                                                                                "Maximum spool size"
                                                                            ),
                                                                            help=
                                                                            _("When the total size of spooled messages exceeds this number, the oldest "
                                                                              "messages of the currently spooled messages is thrown away until the left "
                                                                              "messages have the half of the maximum size."
                                                                             ),
                                                                            default_value=
                                                                            500000,  # do not save more than 500k of message
                                                                        )),
                                                                ],
                                                                optional_keys=[],
                                                            )),
                                                    ],
                                                    optional_keys=["spool"],
                                                )),
                                            ("udp", _("Send via UDP"),
                                             Dictionary(
                                                 elements=[
                                                     ("address",
                                                      TextAscii(
                                                          title=_("Address"),
                                                          allow_empty=False,
                                                      )),
                                                     ("port",
                                                      Integer(
                                                          title=_("Port"),
                                                          default_value=514,
                                                          minvalue=1,
                                                          maxvalue=65535,
                                                          size=6,
                                                      )),
                                                 ],
                                                 optional_keys=[],
                                             )),
                                        ],
                                    ),
                                ],
                                match=lambda x: 4 if isinstance(x, tuple) else
                                (0 if not x else (2 if x == 'spool:' else
                                                  (3 if x.startswith('spool:') else 1)))),
                            # migrate old (tcp, address, port) tuple to new dict
                            forth=lambda v: (v[0], {
                                "address": v[1],
                                "port": v[2]
                            }) if (isinstance(v, tuple) and not isinstance(v[1], dict)) else v,
                        )),
                    (
                        'facility',
                        DropdownChoice(
                            title=_("Syslog facility for forwarded messages"),
                            help=_(
                                "When forwarding messages and no facility can be extracted from the "
                                "message this facility is used."),
                            choices=mkeventd.syslog_facilities,
                            default_value=17,  # local1
                        )),
                    (
                        'restrict_logfiles',
                        ListOfStrings(
                            title=_('Restrict Logfiles (Prefix matching regular expressions)'),
                            help=_(
                                "Put the item names of the logfiles here. For example \"System$\" "
                                "to select the service \"LOG System\". You can use regular expressions "
                                "which must match the beginning of the logfile name."),
                        ),
                    ),
                    ('monitor_logfilelist',
                     Checkbox(
                         title=_("Monitoring of forwarded logfiles"),
                         label=_("Warn if list of forwarded logfiles changes"),
                         help=
                         _("If this option is enabled, the check monitors the list of forwarded "
                           "logfiles and will warn you if at any time a logfile is missing or exceeding "
                           "when compared to the initial list that was snapshotted during service detection. "
                           "Reinventorize this check in order to make it OK again."),
                     )),
                    ('expected_logfiles',
                     ListOf(
                         TextUnicode(),
                         title=_("List of expected logfiles"),
                         help=
                         _("When the monitoring of forwarded logfiles is enabled, the check verifies that "
                           "all of the logfiles listed here are reported by the monitored system."),
                     )),
                    ('logwatch_reclassify',
                     Checkbox(
                         title=_("Reclassify messages before forwarding them to the EC"),
                         label=_("Apply logwatch patterns"),
                         help=
                         _("If this option is enabled, the logwatch lines are first reclassified by the logwatch "
                           "patterns before they are sent to the event console. If you reclassify specific lines to "
                           "IGNORE they are not forwarded to the event console. This takes the burden from the "
                           "event console to process the message itself through all of its rulesets. The reclassifcation "
                           "of each line takes into account from which logfile the message originates. So you can create "
                           "logwatch reclassification rules specifically designed for a logfile <i>access.log</i>, "
                           "which do not apply to other logfiles."),
                     )),
                    ('separate_checks',
                     Checkbox(
                         title=_("Create a separate check for each logfile"),
                         label=_("Separate check"),
                         help=
                         _("If this option is enabled, there will be one separate check for each logfile found during "
                           "the service discovery. This option also changes the behaviour for unknown logfiles. "
                           "The default logwatch check forwards all logfiles to the event console, even logfiles "
                           "which were not known during the service discovery. Creating one check per logfile changes "
                           "this behaviour so that any data from unknown logfiles is discarded."),
                     ))
                ],
                optional_keys=[
                    'restrict_logfiles', 'expected_logfiles', 'logwatch_reclassify',
                    'separate_checks'
                ],
                ignored_keys=['service_level'],
            ),
        ],
        default_value='',
    )
Esempio n. 19
0
STATES_CHECK_RES = [("deleted", 2), ("read-only", 1), ("read-write", 0),
                    ("replication destination", 0),
                    ("retention lock disabled", 0),
                    ("retention lock enabled", 0), ("unknown", 3)]


def _parameter_valuespec_emc_datadomain_mtree():
    return Dictionary(
        title=_("Mapping of MTree state to monitoring state"),
        help=
        _("Define a translation of the possible states of the MTree to monitoring "
          "states, i.e. to the result of the check. This overwrites the default "
          "mapping used by the check."),
        elements=[(state,
                   MonitoringState(title=_(
                       "Monitoring state if MTree state is '%s'" % state),
                                   default_value=check_res))
                  for state, check_res in STATES_CHECK_RES])


rulespec_registry.register(
    CheckParameterRulespecWithItem(
        check_group_name="emc_datadomain_mtree",
        group=RulespecGroupCheckParametersStorage,
        item_spec=lambda: TextAscii(title=_("MTree name")),
        match_type="dict",
        parameter_valuespec=_parameter_valuespec_emc_datadomain_mtree,
        title=lambda: _("State of EMC Data Domain MTree"),
    ))
Esempio n. 20
0
                     )),
                 Dictionary(elements=[
                     ("lower",
                      Tuple(
                          title=_("Lower levels"),
                          elements=[Float(), Float()],
                      )),
                     ("upper",
                      Tuple(
                          title=_("Upper levels"),
                          elements=[Float(), Float()],
                      )),
                 ], ),
             ], ),
                    title=_(
                        "Set lower and upper levels for numerical sensors"))),
        ],
        ignored_keys=["ignored_sensors", "ignored_sensor_states"],
    )


rulespec_registry.register(
    CheckParameterRulespecWithItem(
        check_group_name="ipmi",
        group=RulespecGroupCheckParametersEnvironment,
        item_spec=lambda: TextAscii(title=_("The sensor name")),
        match_type="dict",
        parameter_valuespec=_parameter_valuespec_ipmi,
        title=lambda: _("IPMI sensors"),
    ))
Esempio n. 21
0
        ("levels",
         Tuple(
             title=_("Levels for remaining undo retention"),
             elements=[
                 Age(title=_("warning if less then"), default_value=600),
                 Age(title=_("critical if less then"), default_value=300),
             ],
         )),
        (
            'nospaceerrcnt_state',
            MonitoringState(
                default_value=2,
                title=_(
                    "State in case of non space error count is greater then 0: "
                ),
            ),
        ),
    ], )


rulespec_registry.register(
    CheckParameterRulespecWithItem(
        check_group_name="oracle_undostat",
        group=RulespecGroupCheckParametersApplications,
        item_spec=lambda: TextAscii(
            title=_("Database SID"), size=12, allow_empty=False),
        match_type="dict",
        parameter_valuespec=_parameter_valuespec_oracle_undostat,
        title=lambda: _("Oracle Undo Retention"),
    ))
Esempio n. 22
0
def _item_spec_skype_edge():
    return TextAscii(
        title=_("Interface"),
        help=_("The name of the interface (Public/Private IPv4/IPv6 Network Interface)"),
    )
         )),
        ('correcteds',
         Tuple(
             title=_("Levels for rate of corrected errors"),
             elements=[
                 Percentage(title=_("Warning at"), default_value=5.0),
                 Percentage(title=_("Critical at"), default_value=8.0),
             ],
         )),
        ('uncorrectables',
         Tuple(
             title=_("Levels for rate of uncorrectable errors"),
             elements=[
                 Percentage(title=_("Warning at"), default_value=1.0),
                 Percentage(title=_("Critical at"), default_value=2.0),
             ],
         )),
    ], )


rulespec_registry.register(
    CheckParameterRulespecWithItem(
        check_group_name="docsis_channels_upstream",
        group=RulespecGroupCheckParametersNetworking,
        item_spec=lambda: TextAscii(title=_(
            "ID of the channel (usually ranging from 1)")),
        match_type="dict",
        parameter_valuespec=_parameter_valuespec_docsis_channels_upstream,
        title=lambda: _("Docsis Upstream Channels"),
    ))
Esempio n. 24
0
 def item_spec(self):
     return TextAscii(title=_("Name of the database"), )
Esempio n. 25
0
 def item_spec(self):
     return TextAscii(title=_("Port specification"), allow_empty=False)
Esempio n. 26
0
 def item_spec(self):
     return TextAscii(title=_("Name of the mount point"),
                      help=_("For NFS enter the name of the mount point."))
Esempio n. 27
0
    rulespec_registry,
    RulespecGroupCheckParametersStorage,
)
from cmk.gui.plugins.wato.check_parameters.utils import vs_filesystem


def _parameter_valuespec_threepar_capacity():
    return vs_filesystem([
        (
            "failed_capacity_levels",
            Tuple(
                title=_("Levels for failed capacity in percent"),
                elements=[
                    Percentage(title=_("Warning at"), default_value=0.0),
                    Percentage(title=_("Critical at"), default_value=0.0),
                ],
            ),
        ),
    ], )


rulespec_registry.register(
    CheckParameterRulespecWithItem(
        check_group_name="threepar_capacity",
        group=RulespecGroupCheckParametersStorage,
        item_spec=lambda: TextAscii(title=_("Device type"), allow_empty=False),
        match_type="dict",
        parameter_valuespec=_parameter_valuespec_threepar_capacity,
        title=lambda: _("3Par Capacity (used space and growth)"),
    ))
Esempio n. 28
0
 def item_spec(self):
     return TextAscii(title=_("Service descriptions"), allow_empty=False)
Esempio n. 29
0
    CheckParameterRulespecWithItem,
    rulespec_registry,
    RulespecGroupCheckParametersApplications,
)


def _parameter_valuespec_hacmp_resources():
    return Dictionary(
        elements=[
            ("expect_online_on",
             DropdownChoice(
                 title=_(u"Expect resource to be online on"),
                 choices=[
                     ("first", _(u"the first node")),
                     ("any", _(u"any node")),
                 ],
             )),
        ],
        optional_keys=[],
    )


rulespec_registry.register(
    CheckParameterRulespecWithItem(
        check_group_name="hacmp_resources",
        group=RulespecGroupCheckParametersApplications,
        item_spec=lambda: TextAscii(title=_("Resource Group")),
        parameter_valuespec=_parameter_valuespec_hacmp_resources,
        title=lambda: _("AIX HACMP Resource Groups"),
    ))
Esempio n. 30
0
from cmk.gui.plugins.wato import (
    CheckParameterRulespecWithItem,
    rulespec_registry,
    RulespecGroupCheckParametersApplications,
)


def _parameter_valuespec_veeam_backup():
    return Dictionary(elements=[("age",
                                 Tuple(
                                     title=_("Time since end of last backup"),
                                     elements=[
                                         Age(title=_("Warning if older than"),
                                             default_value=108000),
                                         Age(title=_("Critical if older than"),
                                             default_value=172800)
                                     ],
                                 ))], )


rulespec_registry.register(
    CheckParameterRulespecWithItem(
        check_group_name="veeam_backup",
        group=RulespecGroupCheckParametersApplications,
        item_spec=lambda: TextAscii(title=_("Job name")),
        match_type="dict",
        parameter_valuespec=_parameter_valuespec_veeam_backup,
        title=lambda: _("Veeam: Time since last Backup"),
    ))