def _valuespec_special_agents_mikrotik_api():
    return Dictionary(
        title=_("MikroTik RouterOS via API"),
        help=
        _("This rule set selects the special agent for Mikrotik Routerboards "
          "instead of the normal Check_MK agent and allows monitoring via API."
          ),
        optional_keys=False,
        elements=[
            ("user", TextAscii(title=_("Username"), allow_empty=False)),
            ("password",
             PasswordFromStore(title=_("Password"), size=58,
                               allow_empty=False)),
            ("nossl",
             DropdownChoice(title=_("Connection type"),
                            default_value=False,
                            choices=[
                                (True, _("Do not use SSL to connect to API")),
                                (False, _("Use SSL (Default)")),
                            ])),
            ("connect",
             Integer(
                 title=_("TCP Port number"),
                 help=_(
                     "Port number for connection to API. Usually 8729 (SSL) "
                     "or 8728 (no SSL)"),
                 default_value=8729,
                 minvalue=1,
                 maxvalue=65535,
             )),
            ("infos",
             Transform(
                 ListChoice(
                     choices=[
                         ("resource", _("CPU, Memory, Storage and Uptime")),
                         ("interface", _("Network Interfaces")),
                         ("bgp", _("BGP sessions")),
                         ("ospf", _("OSPF Neighbours")),
                         ("vrrp", _("VRRP info")),
                         ("health", _("Health")),
                         ("board", _("Device Info")),
                         ("ipsec", _("IPsec")),
                         ("ntp", _("NTP")),
                         ("firewall", _("Firewall rules")),
                         ("certificates", _("Certificate expirations")),
                         ("ppp", _("PPP Sessions")),
                     ],
                     default_value=[
                         "resource", "interface", "health", "board"
                     ],
                     allow_empty=False,
                 ),
                 title=_("Retrieve information about..."),
             )),
        ],
    )
示例#2
0
def _valuespec_special_agents_couchbase():
    return Dictionary(
        title=_("Couchbase servers"),
        help=_(
            "This rule allows to select a Couchbase server to monitor as well as "
            "configure buckets for further checks"),
        elements=[
            (
                "buckets",
                ListOfStrings(title=_("Bucket names"),
                              help=_("Name of the Buckets to monitor.")),
            ),
            (
                "timeout",
                Integer(title=_("Timeout"),
                        default_value=10,
                        help=_("Timeout for requests in seconds.")),
            ),
            (
                "port",
                Integer(
                    title=_("Port"),
                    default_value=8091,
                    help=_("The port that is used for the api call."),
                ),
            ),
            (
                "authentication",
                Tuple(
                    title=_("Authentication"),
                    help=_(
                        "The credentials for api calls with authentication."),
                    elements=[
                        TextInput(title=_("Username"), allow_empty=False),
                        PasswordFromStore(title=_("Password of the user"),
                                          allow_empty=False),
                    ],
                ),
            ),
        ],
    )
示例#3
0
 def valuespec(self):
     return Dictionary(
         title=_("Support credentials"),
         elements=[
             ("username",
              TextUnicode(
                  title=_("Username"),
                  allow_empty=False,
              )),
             ("password",
              PasswordFromStore(
                  title=_("Password"),
                  allow_empty=False,
              )),
         ],
         optional_keys=[],
         help=
         _("Set credentials for automatically submitting crash reports, "
           "license usage reports, et al. to Tribe29. The credentials are part "
           "of your subscription and can be found in your contract. These "
           "credentials are also used for downloading the Checkmk software versions "
           "from the Tribe29 website."),
     )
示例#4
0
    def spec(self):
        return Dictionary(
            title=_("Create notification with the following parameters"),
            required_keys=[
                'password',
            ],
            elements=[
                ("password",
                 PasswordFromStore(
                     title=_(
                         "API Key to use. Depending on your opsgenie "
                         "subscription you can use global or team integration api "
                         "keys."),
                     allow_empty=False,
                 )),
                ("url",
                 TextAscii(
                     title=_("Domain (only used for european accounts)"),
                     help=_(
                         "If you have an european account, please set the "
                         "domain of your opsgenie. Specify an absolute URL like "
                         "https://my.app.eu.opsgenie.com "),
                     regex="^https://.*",
                     regex_error=_("The URL must begin with <tt>https</tt>."),
                     size=64,
                 )),
                ("owner",
                 TextUnicode(
                     title=_("Owner"),
                     help=("Sets the user of the alert. "
                           "Display name of the request owner."),
                     size=100,
                     allow_empty=False,
                 )),
                ("source",
                 TextUnicode(
                     title=_("Source"),
                     help=_("Source field of the alert. Default value is IP "
                            "address of the incoming request."),
                     size=16,
                 )),
                ('priority',
                 DropdownChoice(
                     title=_("Priority"),
                     choices=[
                         ('P1', _('P1 - Critical')),
                         ('P2', _('P2 - High')),
                         ('P3', _('P3 - Moderate')),
                         ('P4', _('P4 - Low')),
                         ('P5', _('P5 - Informational')),
                     ],
                     default_value="P3",
                 )),
                ("note_created",
                 TextUnicode(
                     title=_("Note while creating"),
                     help=
                     _("Additional note that will be added while creating the alert."
                       ),
                     default_value="Alert created by Check_MK",
                 )),
                ("note_closed",
                 TextUnicode(
                     title=_("Note while closing"),
                     help=
                     _("Additional note that will be added while closing the alert."
                       ),
                     default_value="Alert closed by Check_MK",
                 )),
                ("host_msg",
                 TextUnicode(
                     title=_("Description for host alerts"),
                     help=_(
                         "Description field of host alert that is generally "
                         "used to provide a detailed information about the "
                         "alert."),
                     default_value="Check_MK: $HOSTNAME$ - $HOSTSHORTSTATE$",
                     size=64,
                 )),
                ("svc_msg",
                 TextUnicode(
                     title=_("Description for service alerts"),
                     help=_(
                         "Description field of service alert that is generally "
                         "used to provide a detailed information about the "
                         "alert."),
                     default_value=
                     "Check_MK: $HOSTNAME$/$SERVICEDESC$ $SERVICESHORTSTATE$",
                     size=68,
                 )),
                ("host_desc",
                 TextAreaUnicode(title=_("Message for host alerts"),
                                 rows=7,
                                 cols=58,
                                 monospaced=True,
                                 default_value="""Host: $HOSTNAME$
Event:    $EVENT_TXT$
Output:   $HOSTOUTPUT$
Perfdata: $HOSTPERFDATA$
$LONGHOSTOUTPUT$
""")),
                ("svc_desc",
                 TextAreaUnicode(title=_("Message for service alerts"),
                                 rows=11,
                                 cols=58,
                                 monospaced=True,
                                 default_value="""Host: $HOSTNAME$
Service:  $SERVICEDESC$
Event:    $EVENT_TXT$
Output:   $SERVICEOUTPUT$
Perfdata: $SERVICEPERFDATA$
$LONGSERVICEOUTPUT$
""")),
                ("teams",
                 ListOfStrings(
                     title=_("Responsible teams"),
                     help=_(
                         "Team names which will be responsible for the alert. "
                         "If the API Key belongs to a team integration, "
                         "this field will be overwritten with the owner "
                         "team."),
                     allow_empty=False,
                     orientation="horizontal",
                 )),
                ("actions",
                 ListOfStrings(
                     title=_("Actions"),
                     help=_(
                         "Custom actions that will be available for the alert."
                     ),
                     allow_empty=False,
                     orientation="horizontal",
                 )),
                ("tags",
                 ListOfStrings(
                     title=_("Tags"),
                     help=_("Tags of the alert."),
                     allow_empty=False,
                     orientation="horizontal",
                 )),
                ("entity",
                 TextUnicode(
                     title=_("Entity"),
                     help=
                     _("Is used to specify which domain the alert is related to."
                       ),
                     allow_empty=False,
                     size=68,
                 )),
            ],
        )
示例#5
0
    def spec(self):
        return Dictionary(
            title=_("Create notification with the following parameters"),
            required_keys=['url', 'username', 'password', 'caller'],
            elements=[
                ("url",
                 HTTPUrl(
                     title=_("Servicenow URL"),
                     help=
                     _("Configure your servicenow URL here (eg. https://myservicenow.com)."
                       ),
                     allow_empty=False,
                 )),
                ("proxy_url", HTTPProxyReference()),
                ("username",
                 TextAscii(
                     title=_("Username"),
                     size=40,
                     allow_empty=False,
                 )),
                ("password",
                 PasswordFromStore(
                     title=_("Password of the user"),
                     allow_empty=False,
                 )),
                ("caller",
                 TextAscii(
                     title=_("Caller ID"),
                     help=
                     _("Caller is the user on behalf of whom the incident is being reported "
                       "within servicenow. Please enter the name of the caller here."
                       ),
                 )),
                ("host_short_desc",
                 TextAscii(
                     title=_("Short description for host incidents"),
                     help=_(
                         "Text that should be set in field <tt>Short description</tt> "
                         "for host notifications."),
                     default_value="Check_MK: $HOSTNAME$ - $HOSTSHORTSTATE$",
                     size=64,
                 )),
                ("svc_short_desc",
                 TextAscii(
                     title=_("Short description for service incidents"),
                     help=_(
                         "Text that should be set in field <tt>Short description</tt> "
                         "for service notifications."),
                     default_value=
                     "Check_MK: $HOSTNAME$/$SERVICEDESC$ $SERVICESHORTSTATE$",
                     size=68,
                 )),
                ("host_desc",
                 TextAreaUnicode(
                     title=_("Description for host incidents"),
                     help=_(
                         "Text that should be set in field <tt>Description</tt> "
                         "for host notifications."),
                     rows=7,
                     cols=58,
                     monospaced=True,
                     default_value="""Host: $HOSTNAME$
Event:    $EVENT_TXT$
Output:   $HOSTOUTPUT$
Perfdata: $HOSTPERFDATA$
$LONGHOSTOUTPUT$
""")),
                ("svc_desc",
                 TextAreaUnicode(
                     title=_("Description for service incidents"),
                     help=_(
                         "Text that should be set in field <tt>Description</tt> "
                         "for service notifications."),
                     rows=11,
                     cols=58,
                     monospaced=True,
                     default_value="""Host: $HOSTNAME$
Service:  $SERVICEDESC$
Event:    $EVENT_TXT$
Output:   $SERVICEOUTPUT$
Perfdata: $SERVICEPERFDATA$
$LONGSERVICEOUTPUT$
""")),
                ("urgency",
                 DropdownChoice(
                     title=_("Urgency"),
                     help=
                     _("See <a href=\"https://docs.servicenow.com/bundle/"
                       "helsinki-it-service-management/page/product/incident-management/"
                       "reference/r_PrioritizationOfIncidents.html\" target=\"_blank\">"
                       "ServiceNow Incident</a> for more information."),
                     choices=[
                         ("low", _("Low")),
                         ("medium", _("Medium")),
                         ("high", _("High")),
                     ],
                     default_value="low",
                 )),
                ("impact",
                 DropdownChoice(
                     title=_("Impact"),
                     help=
                     _("See <a href=\"https://docs.servicenow.com/bundle/"
                       "helsinki-it-service-management/page/product/incident-management/"
                       "reference/r_PrioritizationOfIncidents.html\" target=\"_blank\">"
                       "ServiceNow Incident</a> for more information."),
                     choices=[
                         ("low", _("Low")),
                         ("medium", _("Medium")),
                         ("high", _("High")),
                     ],
                     default_value="low",
                 )),
                ("ack_state",
                 Dictionary(
                     title=
                     _("Settings for incident state in case of acknowledgement"
                       ),
                     help=
                     _("Here you can define the state of the incident in case of an "
                       "acknowledgement of the affected host or service problem."
                       ),
                     elements=[
                         ("start",
                          DropdownChoice(
                              title=_(
                                  "State of incident if acknowledgement is set"
                              ),
                              help=
                              _("Here you can define the state of the incident in case of an "
                                "acknowledgement of the host or service problem."
                                ),
                              choices=[
                                  ("none", _("Don't change state")),
                                  ("new", _("New")),
                                  ("progress", _("In Progress")),
                                  ("hold", _("On Hold")),
                                  ("resolved", _("Resolved")),
                                  ("closed", _("Closed")),
                                  ("canceled", _("Canceled")),
                              ],
                              default_value="none",
                          )),
                     ],
                 )),
                ("dt_state",
                 Dictionary(
                     title=_(
                         "Settings for incident state in case of downtime"),
                     help=_(
                         "Here you can define the state of the incident in case of a "
                         "downtime of the affected host or service."),
                     elements=[
                         ("start",
                          DropdownChoice(
                              title=_("State of incident if downtime is set"),
                              help=
                              _("Here you can define the state of the incident in case of an "
                                "acknowledgement of the host or service problem."
                                ),
                              choices=[
                                  ("none", _("Don't change state")),
                                  ("new", _("New")),
                                  ("progress", _("In Progress")),
                                  ("hold", _("On Hold")),
                                  ("resolved", _("Resolved")),
                                  ("closed", _("Closed")),
                                  ("canceled", _("Canceled")),
                              ],
                              default_value="none",
                          )),
                         ("end",
                          DropdownChoice(
                              title=_("State of incident if downtime expires"),
                              help=
                              _("Here you can define the state of the incident in case of an "
                                "ending acknowledgement of the host or service problem."
                                ),
                              choices=[
                                  ("none", _("Don't change state")),
                                  ("new", _("New")),
                                  ("progress", _("In Progress")),
                                  ("hold", _("On Hold")),
                                  ("resolved", _("Resolved")),
                                  ("closed", _("Closed")),
                                  ("canceled", _("Canceled")),
                              ],
                              default_value="none",
                          )),
                     ],
                 )),
                ("timeout",
                 TextAscii(
                     title=_(
                         "Set optional timeout for connections to servicenow"),
                     help=_(
                         "Here you can configure timeout settings in seconds."
                     ),
                     default_value=10,
                     size=3)),
            ],
        )
示例#6
0
def _valuespec_special_agents_splunk():
    return Dictionary(
        title=_("Splunk"),
        help=_("Requests data from a Splunk instance."),
        optional_keys=["instance", "port"],
        elements=[
            (
                "instance",
                TextInput(
                    title=_("Splunk instance to query."),
                    help=_(
                        "Use this option to set which host should be checked "
                        "by the special agent."),
                    size=32,
                    allow_empty=False,
                ),
            ),
            ("user", TextInput(title=_("Username"), size=32,
                               allow_empty=False)),
            (
                "password",
                PasswordFromStore(
                    title=_("Password of the user"),
                    allow_empty=False,
                ),
            ),
            (
                "protocol",
                DropdownChoice(
                    title=_("Protocol"),
                    choices=[
                        ("http", "HTTP"),
                        ("https", "HTTPS"),
                    ],
                    default_value="https",
                ),
            ),
            (
                "port",
                Integer(
                    title=_("Port"),
                    help=
                    _("Use this option to query a port which is different from standard port 8089."
                      ),
                    default_value=8089,
                ),
            ),
            (
                "infos",
                ListChoice(
                    title=_("Informations to query"),
                    help=_("Defines what information to query. You can "
                           "choose to query license state and usage, Splunk "
                           "system messages, Splunk jobs, shown in the job "
                           "menu within Splunk. You can also query for "
                           "component health and fired alerts."),
                    choices=[
                        ("license_state", _("Licence state")),
                        ("license_usage", _("Licence usage")),
                        ("system_msg", _("System messages")),
                        ("jobs", _("Jobs")),
                        ("health", _("Health")),
                        ("alerts", _("Alerts")),
                    ],
                    default_value=[
                        "license_state",
                        "license_usage",
                        "system_msg",
                        "jobs",
                        "health",
                        "alerts",
                    ],
                    allow_empty=False,
                ),
            ),
        ],
    )
示例#7
0
def _valuespec_special_agents_rabbitmq():
    return Dictionary(
        title=_("RabbitMQ"),
        help=_("Requests data from a RabbitMQ instance."),
        elements=[
            (
                "instance",
                TextInput(
                    title=_("RabbitMQ instance to query"),
                    help=_(
                        "Use this option to set which instance should be "
                        "checked by the special agent. Please add the "
                        "hostname here, eg. my_rabbitmq.com. If not set, the "
                        "assigned host is used as instance."),
                    size=32,
                    allow_empty=False,
                ),
            ),
            (
                "user",
                TextInput(
                    title=_("Username"),
                    help=_(
                        "The username that should be used for accessing the "
                        "RabbitMQ API."),
                    size=32,
                    allow_empty=False,
                ),
            ),
            (
                "password",
                PasswordFromStore(
                    title=_("Password of the user"),
                    allow_empty=False,
                ),
            ),
            (
                "protocol",
                DropdownChoice(
                    title=_("Protocol"),
                    choices=[
                        ("http", "HTTP"),
                        ("https", "HTTPS"),
                    ],
                    default_value="https",
                ),
            ),
            (
                "port",
                Integer(
                    title=_("Port"),
                    default_value=15672,
                    help=_("The port that is used for the api call."),
                ),
            ),
            (
                "sections",
                ListChoice(
                    title=_("Informations to query"),
                    help=_("Defines what information to query. You can choose "
                           "between the cluster, nodes, vhosts and queues."),
                    choices=[
                        ("cluster", _("Clusterwide")),
                        ("nodes", _("Nodes")),
                        ("vhosts", _("Vhosts")),
                        ("queues", _("Queues")),
                    ],
                    default_value=["cluster", "nodes", "vhosts", "queues"],
                    allow_empty=False,
                ),
            ),
        ],
        optional_keys=[
            "instance",
            "port",
        ],
    )
示例#8
0
register_alert_handler_parameters(
    "windows_remote",
    Dictionary(
        title = _("Remote execution on Windows via WMI"),
        help = _("This alert handler allows the remote execution of scripts and programs "
                 "on Windows systems via WMI. Please note that this configuration is saved "
                 "in clear text (including the password!). We have not made any influence on "
                 "the security settings of the target Window hosts. If you don't secure the "
                 "WMI access, the credentials might be used to execute arbitrary commands on "
                 "the remote system. Use with caution!"),
        elements = [
            ("runas", TextInput(
                  title = _("User to run handler as"),
                  allow_empty = False,
                  regex = re.compile('^[a-zA-Z_][-/a-zA-Z0-9_\\\\]*$'),
                  regex_error = _("Your input does not match the required format.") \
                              + " " + _("Expected syntax: [domain/]username")
            )),
            ("password", PasswordFromStore(
                  title = _("Password of the user"),
                  allow_empty = False,
            )),
            ("command", TextInput(
                title = _("Command to execute"),
                allow_empty = False,
            )),
        ],
        optional_keys = False,
    )
)
    def spec(self):
        return Dictionary(
            title=_("Create notification with the following parameters"),
            optional_keys=[
                "api_url", "host_desc", "svc_desc", "host_msg", "svc_msg",
                "ignore_graphs"
            ],
            required_keys=["bot_token"],
            elements=[
                ("bot_token",
                 PasswordFromStore(
                     title=_("BOT Token"),
                     help=
                     _("You need to provide a valid BOT token to be able to send notifications using Telegram. "
                       "For information see <a href=\"https://core.telegram.org/bots#create-a-new-bot\" "
                       "target=\"_blank\">Bots: An introduction for developers</a>"
                       ),
                     size=58,
                     allow_empty=False,
                 )),
                ("api_url",
                 TextAscii(
                     title=_("API Endpoint"),
                     help=
                     _("Telegram API endpoint URL. Do <tt>not</tt> change unless you know what you are doing."
                       ),
                     default_value="https://api.telegram.org",
                 )),
                ("host_desc",
                 TextUnicode(
                     title=_("Description for host alerts"),
                     help=_(
                         "Description field of host alert that is generally "
                         "used to provide a detailed information about the "
                         "alert."),
                     default_value="Check_MK: $HOSTNAME$ - $EVENT_TXT$",
                     size=64,
                 )),
                ("svc_desc",
                 TextUnicode(
                     title=_("Description for service alerts"),
                     help=_(
                         "Description field of service alert that is generally "
                         "used to provide a detailed information about the "
                         "alert."),
                     default_value=
                     "Check_MK: $HOSTNAME$/$SERVICEDESC$ $EVENT_TXT$",
                     size=68,
                 )),
                ("host_msg",
                 TextAreaUnicode(title=_("Message for host alerts"),
                                 rows=8,
                                 cols=58,
                                 monospaced=True,
                                 default_value="""```
Host:    $HOSTNAME$
Alias:   $HOSTALIAS$
Address: $HOSTADDRESS$
Event:   $EVENT_TXT$
Output:  $HOSTOUTPUT$
```""")),
                ("svc_msg",
                 TextAreaUnicode(title=_("Message for service alerts"),
                                 rows=11,
                                 cols=58,
                                 monospaced=True,
                                 default_value="""```
Host:     $HOSTNAME$
Alias:    $HOSTALIAS$
Address:  $HOSTADDRESS$
Service:  $SERVICEDESC$
Event:    $EVENT_TXT$
Output:   $SERVICEOUTPUT$
```""")),
                ("ignore_graphs",
                 FixedValue(
                     False,
                     title=_(
                         "Disable attaching graphs for PROBLEM and CUSTOM types"
                     ),
                     totext=_(
                         "Disable attaching graphs for PROBLEM and CUSTOM types"
                     ),
                     help=
                     _("Do not attach graphs of the host or service for PROBLEM and CUSTOM notification types."
                       ),
                 )),
            ])

        return Dictionary(
            title=_("Create notification with the following parameters"),
            elements=elements)
示例#10
0
def _valuespec_special_agents_jenkins():
    return Transform(
        valuespec=Dictionary(
            title=_("Jenkins jobs and builds"),
            help=_("Requests data from a jenkins instance."),
            optional_keys=["port"],
            elements=[
                (
                    "instance",
                    TextInput(
                        title=_("Jenkins instance to query."),
                        help=_(
                            "Use this option to set which instance should be "
                            "checked by the special agent. Please add the "
                            "hostname here, eg. my_jenkins.com."),
                        size=32,
                        allow_empty=False,
                    ),
                ),
                (
                    "user",
                    TextInput(
                        title=_("Username"),
                        help=
                        _("The username that should be used for accessing the "
                          "jenkins API. Has to have read permissions at least."
                          ),
                        size=32,
                        allow_empty=False,
                    ),
                ),
                (
                    "password",
                    PasswordFromStore(
                        help=_("The password or API key of the user."),
                        title=_("Password of the user"),
                        allow_empty=False,
                    ),
                ),
                (
                    "protocol",
                    DropdownChoice(
                        title=_("Protocol"),
                        choices=[
                            ("http", "HTTP"),
                            ("https", "HTTPS"),
                        ],
                        default_value="https",
                    ),
                ),
                (
                    "port",
                    Integer(
                        title=_("Port"),
                        help=
                        _("Use this option to query a port which is different from standard port 8080."
                          ),
                        default_value=443,
                    ),
                ),
                (
                    "sections",
                    ListChoice(
                        title=_("Informations to query"),
                        help=
                        _("Defines what information to query. You can choose "
                          "between the instance state, job states, node states "
                          "and the job queue."),
                        choices=[
                            ("instance", _("Instance state")),
                            ("jobs", _("Job state")),
                            ("nodes", _("Node state")),
                            ("queue", _("Queue info")),
                        ],
                        default_value=["instance", "jobs", "nodes", "queue"],
                        allow_empty=False,
                    ),
                ),
            ],
        ),
        forth=_transform_jenkins_infos,
    )
示例#11
0
def _valuespec_special_agents_jira():
    return Dictionary(
        title=_("Jira statistics"),
        help=_("Use Jira Query Language (JQL) to get statistics out of your " "Jira instance."),
        elements=[
            (
                "instance",
                TextInput(
                    title=_("Jira instance to query"),
                    help=_(
                        "Use this option to set which instance should be "
                        "checked by the special agent. Please add the "
                        "hostname here, eg. my_jira.com. If not set, the "
                        "assigned host is used as instance."
                    ),
                    size=32,
                    allow_empty=False,
                ),
            ),
            (
                "user",
                TextInput(
                    title=_("Username"),
                    help=_("The username that should be used for accessing the " "Jira API."),
                    size=32,
                    allow_empty=False,
                ),
            ),
            (
                "password",
                PasswordFromStore(
                    title=_("Password of the user"),
                    allow_empty=False,
                ),
            ),
            (
                "protocol",
                DropdownChoice(
                    title=_("Protocol"),
                    choices=[
                        ("http", "HTTP"),
                        ("https", "HTTPS"),
                    ],
                    default_value="https",
                ),
            ),
            (
                "project_workflows",
                _vs_jira_projects(
                    _(
                        "Monitor the number of issues for given projects and their "
                        "workflows. This results in a service for each project with "
                        "the number of issues per workflow."
                    ),
                ),
            ),
            (
                "jql",
                ListOf(
                    valuespec=Dictionary(
                        elements=[
                            (
                                "service_description",
                                TextInput(
                                    title=_("Service description: "),
                                    help=_(
                                        "The resulting service will get this entry as "
                                        "service description"
                                    ),
                                    allow_empty=False,
                                ),
                            ),
                            (
                                "query",
                                TextInput(
                                    title=_("JQL query: "),
                                    help=_(
                                        "E.g. 'project = my_project and result = "
                                        '"waiting for something"\''
                                    ),
                                    allow_empty=False,
                                    size=80,
                                ),
                            ),
                            (
                                "result",
                                CascadingDropdown(
                                    title=_("Type of result"),
                                    help=_(
                                        "Here you can define, what search result "
                                        "should be used. You can show the number of search "
                                        "results (count) or the summed up or average values "
                                        "of a given numeric field."
                                    ),
                                    choices=[
                                        ("count", _("Number of " "search results")),
                                        (
                                            "sum",
                                            _(
                                                "Summed up values of "
                                                "the following numeric field:"
                                            ),
                                            Tuple(
                                                elements=[
                                                    TextInput(
                                                        title=_("Field Name: "),
                                                        allow_empty=False,
                                                    ),
                                                    Integer(
                                                        title=_(
                                                            "Limit number of processed search results"
                                                        ),
                                                        help=_(
                                                            "Here you can define, how many search results "
                                                            "should be processed. The max. internal limit "
                                                            "of Jira is 1000 results. If you want to "
                                                            "ignore any limit, set -1 here. Default is 50."
                                                        ),
                                                        default_value=50,
                                                    ),
                                                ],
                                            ),
                                        ),
                                        (
                                            "average",
                                            _("Average value " "of the following numeric field: "),
                                            Tuple(
                                                elements=[
                                                    TextInput(
                                                        title=_("Field Name: "),
                                                        allow_empty=False,
                                                    ),
                                                    Integer(
                                                        title=_(
                                                            "Limit number of processed search results"
                                                        ),
                                                        default_value=50,
                                                    ),
                                                ],
                                            ),
                                        ),
                                    ],
                                    sorted=False,
                                ),
                            ),
                        ],
                        optional_keys=[],
                    ),
                    title=_("Custom search query"),
                ),
            ),
        ],
        optional_keys=[
            "jql",
            "project_workflows",
            "instance",
        ],
    )
示例#12
0
def _valuespec_special_agents_graylog():
    return Dictionary(
        title=_("Graylog"),
        help=_("Requests node, cluster and indice data from a Graylog "
               "instance."),
        optional_keys=["port"],
        elements=[
            (
                "instance",
                TextInput(
                    title=_("Graylog instance to query"),
                    help=_("Use this option to set which instance should be "
                           "checked by the special agent. Please add the "
                           "hostname here, eg. my_graylog.com."),
                    size=32,
                    allow_empty=False,
                ),
            ),
            (
                "user",
                TextInput(
                    title=_("Username"),
                    help=_(
                        "The username that should be used for accessing the "
                        "Graylog API. Has to have read permissions at least."),
                    size=32,
                    allow_empty=False,
                ),
            ),
            (
                "password",
                PasswordFromStore(
                    title=_("Password of the user"),
                    allow_empty=False,
                ),
            ),
            (
                "protocol",
                DropdownChoice(
                    title=_("Protocol"),
                    choices=[
                        ("http", "HTTP"),
                        ("https", "HTTPS"),
                    ],
                    default_value="https",
                ),
            ),
            (
                "port",
                Integer(
                    title=_("Port"),
                    help=
                    _("Use this option to query a port which is different from standard port 443."
                      ),
                    default_value=443,
                ),
            ),
            (
                "since",
                Age(
                    title=_("Time for coverage of failures"),
                    help=
                    _("If you choose to query for failed index operations, use "
                      "this option to set the timeframe in which failures "
                      "should be covered. The check will output the total "
                      "number of failures and the number of failures in this "
                      "given timeframe."),
                    default_value=1800,
                ),
            ),
            (
                "sections",
                ListChoice(
                    title=_("Information to query"),
                    help=_("Defines what information to query."),
                    choices=[
                        ("alerts", _("Alarms")),
                        ("cluster_stats", _("Cluster statistics")),
                        ("cluster_traffic", _("Cluster traffic statistics")),
                        ("failures", _("Failed index operations")),
                        ("jvm", _("JVM heap size")),
                        ("license", _("License state")),
                        ("messages", _("Message count")),
                        ("nodes", _("Nodes")),
                        ("sidecars", _("Sidecars")),
                        ("sources", _("Sources")),
                        ("streams", _("Streams")),
                    ],
                    default_value=[
                        "alerts",
                        "cluster_stats",
                        "cluster_traffic",
                        "failures",
                        "jvm",
                        "license",
                        "messages",
                        "nodes",
                        "sidecars",
                        "sources",
                        "streams",
                    ],
                    allow_empty=False,
                ),
            ),
            (
                "display_node_details",
                DropdownChoice(
                    title=_("Display node details on"),
                    help=_("The node details can be displayed either on the "
                           "queried host or the Graylog node."),
                    choices=[
                        ("host", _("The queried Graylog host")),
                        ("node", _("The Graylog node")),
                    ],
                    default_value="host",
                ),
            ),
            (
                "display_sidecar_details",
                DropdownChoice(
                    title=_("Display sidecar details on"),
                    help=_(
                        "The sidecar details can be displayed either on the "
                        "queried host or the sidecar host."),
                    choices=[
                        ("host", _("The queried Graylog host")),
                        ("sidecar", _("The sidecar host")),
                    ],
                    default_value="host",
                ),
            ),
            (
                "display_source_details",
                DropdownChoice(
                    title=_("Display source details on"),
                    help=_("The source details can be displayed either on the "
                           "queried host or the source host."),
                    choices=[
                        ("host", _("The queried Graylog host")),
                        ("source", _("The source host")),
                    ],
                    default_value="host",
                ),
            ),
        ],
    )
示例#13
0
def _valuespec_active_checks_elasticsearch_query():
    return Dictionary(
        required_keys=["svc_item", "pattern", "timerange"],
        title=_("Query elasticsearch logs"),
        help=_(
            "You can search indices for defined patterns in defined fieldnames."
        ),
        elements=[
            (
                "svc_item",
                TextInput(
                    title=_("Item suffix"),
                    help=_(
                        "Here you can define what service description (item) is "
                        "used for the created service. The resulting item "
                        "is always prefixed with 'Elasticsearch Query'."),
                    allow_empty=False,
                    size=16,
                ),
            ),
            (
                "hostname",
                TextInput(
                    title=_("DNS hostname or IP address"),
                    help=_(
                        "You can specify a hostname or IP address different from the IP address "
                        "of the host this check will be assigned to."),
                    allow_empty=False,
                ),
            ),
            ("user", TextInput(title=_("Username"), size=32,
                               allow_empty=True)),
            (
                "password",
                PasswordFromStore(
                    title=_("Password of the user"),
                    allow_empty=False,
                ),
            ),
            (
                "protocol",
                DropdownChoice(
                    title=_("Protocol"),
                    help=
                    _("Here you can define which protocol to use, default is https."
                      ),
                    choices=[
                        ("http", "HTTP"),
                        ("https", "HTTPS"),
                    ],
                    default_value="https",
                ),
            ),
            (
                "port",
                Integer(
                    title=_("Port"),
                    help=
                    _("Use this option to query a port which is different from standard port 9200."
                      ),
                    default_value=9200,
                ),
            ),
            (
                "pattern",
                TextInput(
                    title=_("Search pattern"),
                    help=
                    _("Here you can define what search pattern should be used. "
                      "You can use Kibana query language as described "
                      '<a href="https://www.elastic.co/guide/en/kibana/current/kuery-query.html"'
                      'target="_blank">here</a>. To optimize search speed, use defined indices and fields '
                      "otherwise all indices and fields will be searched."),
                    allow_empty=False,
                    size=32,
                ),
            ),
            (
                "index",
                ListOfStrings(
                    title=_("Indices to query"),
                    help=_("Here you can define what index should be queried "
                           "for the defined search. You can query one or "
                           "multiple indices. Without this option all indices "
                           "are queried. If you want to speed up your search, "
                           "use definded indices."),
                    orientation="horizontal",
                    allow_empty=False,
                    size=48,
                ),
            ),
            (
                "fieldname",
                ListOfStrings(
                    title=_("Fieldnames to query"),
                    help=
                    _("Here you can define fieldnames that should be used "
                      "in the search. Regexp query is allowed as described "
                      '<a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-regexp-query.html"'
                      'target="_blank">here</a>. If you want to speed up your search, '
                      "use defined indices."),
                    allow_empty=False,
                    orientation="horizontal",
                    size=32,
                ),
            ),
            (
                "timerange",
                Age(
                    title=_("Timerange"),
                    help=
                    _("Here you can define the timerange to query, eg. the last x minutes from now. "
                      "The query will then check for the count of log messages in the defined range. "
                      "Default is 1 minute."),
                    display=["days", "hours", "minutes"],
                    default_value=60,
                ),
            ),
            (
                "count",
                Tuple(
                    title=_("Thresholds on message count"),
                    elements=[
                        Integer(
                            title=_("Warning at or above"),
                            unit=_("log messages"),
                        ),
                        Integer(
                            title=_("Critical at or above"),
                            unit=_("log messages"),
                        ),
                    ],
                ),
            ),
        ],
    )
示例#14
0
def _valuespec_special_agents_cisco_prime():
    return Dictionary(
        elements=[
            (
                "host",
                CascadingDropdown(
                    choices=[
                        ("ip_address", _("IP Address")),
                        ("host_name", _("Host name")),
                        (
                            "custom",
                            _("Custom Host"),
                            Dictionary(
                                elements=[(
                                    "host",
                                    TextInput(
                                        title=_("Custom Host"),
                                        allow_empty=False,
                                    ),
                                )],
                                optional_keys=[],
                            ),
                        ),
                    ],
                    default_value="ip_address",
                    title=_("Host to use for connecting to Cisco Prime"),
                ),
            ),
            (
                "basicauth",
                Tuple(
                    title=_("BasicAuth settings (optional)"),
                    help=_(
                        "The credentials for api calls with authentication."),
                    elements=[
                        TextInput(title=_("Username"), allow_empty=False),
                        PasswordFromStore(title=_("Password of the user"),
                                          allow_empty=False),
                    ],
                ),
            ),
            ("port", Integer(title=_("Port"), default_value=8080)),
            (
                "no-tls",
                FixedValue(
                    value=True,
                    title=_("Don't use TLS/SSL/Https (unsecure)"),
                    totext=_("TLS/SSL/Https disabled"),
                ),
            ),
            (
                "no-cert-check",
                FixedValue(
                    value=True,
                    title=_("Disable SSL certificate validation"),
                    totext=_("SSL certificate validation is disabled"),
                ),
            ),
            (
                "timeout",
                Integer(
                    title=_("Connect Timeout"),
                    help=_("The network timeout in seconds"),
                    default_value=60,
                    minvalue=1,
                    unit=_("seconds"),
                ),
            ),
        ],
        title=_("Cisco Prime"),
    )
示例#15
0
def _valuespec_special_agents_elasticsearch():
    return Dictionary(
        optional_keys=["user", "password"],
        title=_("Elasticsearch"),
        help=_(
            "Requests data about Elasticsearch clusters, nodes and indices."),
        elements=[
            (
                "hosts",
                ListOfStrings(
                    title=_("Hostnames to query"),
                    help=
                    _("Use this option to set which host should be checked by the special agent. If the "
                      "connection to the first server fails, the next server will be queried (fallback). "
                      "The check will only output data from the first host that sends a response."
                      ),
                    size=32,
                    allow_empty=False,
                ),
            ),
            ("user", TextInput(title=_("Username"), size=32,
                               allow_empty=True)),
            (
                "password",
                PasswordFromStore(
                    title=_("Password of the user"),
                    allow_empty=False,
                ),
            ),
            (
                "protocol",
                DropdownChoice(
                    title=_("Protocol"),
                    choices=[
                        ("http", "HTTP"),
                        ("https", "HTTPS"),
                    ],
                    default_value="https",
                ),
            ),
            (
                "port",
                Integer(
                    title=_("Port"),
                    help=
                    _("Use this option to query a port which is different from standard port 9200."
                      ),
                    default_value=9200,
                ),
            ),
            (
                "infos",
                ListChoice(
                    title=_("Informations to query"),
                    help=_(
                        "Defines what information to query. "
                        "Checks for Cluster, Indices and Shard statistics follow soon."
                    ),
                    choices=[
                        ("cluster_health", _("Cluster health")),
                        ("nodes", _("Node statistics")),
                        ("stats", _("Cluster, Indices and Shard statistics")),
                    ],
                    default_value=["cluster_health", "nodes", "stats"],
                    allow_empty=False,
                ),
            ),
        ],
    )
示例#16
0
def _valuespec_special_agents_mqtt() -> Dictionary:
    return Dictionary(
        title=_("MQTT broker statistics"),
        help=
        _("Connect to an MQTT broker to get statistics out of your instance. "
          "The information is fetched from the <tt>$SYS</tt> topic of the broker. The "
          "different brokers implement different topics as they are not standardized, "
          "means that not every service available with every broker. "
          "In multi-tentant, enterprise level cluster this agent may not be useful or "
          "probably only when directly connecting to single nodes, because the "
          "<tt>$SYS</tt> topic is node-specific."),
        elements=[
            (
                "username",
                TextInput(
                    title=_("Username"),
                    help=_("The username used for broker authentication."),
                    size=32,
                    allow_empty=False,
                ),
            ),
            (
                "password",
                PasswordFromStore(
                    title=_("Password of the user"),
                    allow_empty=False,
                ),
            ),
            (
                "address",
                HostAddress(
                    title=_("Custom address"),
                    help=
                    _("When set, this address is used for connecting to the MQTT "
                      "broker. If not set, the special agent will use the primary "
                      "address of the host to connect to the MQTT broker."),
                    size=32,
                    allow_empty=False,
                ),
            ),
            (
                "port",
                NetworkPort(
                    title=_("Port"),
                    default_value=1883,
                    help=_("The port that is used for the api call."),
                ),
            ),
            (
                "client-id",
                TextInput(
                    title=_("Client ID"),
                    help=_(
                        "Unique client ID used for the broker. Will be randomly "
                        "generated when not set."),
                    size=32,
                    allow_empty=False,
                ),
            ),
            (
                "protocol",
                DropdownChoice(
                    title=_("Protocol"),
                    choices=[
                        ("MQTTv31", "MQTTv31"),
                        ("MQTTv311", "MQTTv311"),
                        ("MQTTv5", "MQTTv5"),
                    ],
                    default_value="MQTTv311",
                ),
            ),
            (
                "instance-id",
                TextInput(
                    title=_("Instance ID"),
                    help=
                    _("Unique ID used to identify the instance on the host within Checkmk."
                      ),
                    size=32,
                    allow_empty=False,
                    default_value="broker",
                ),
            ),
        ],
        required_keys=[],
    )