def _vs_ip_range(self): return CascadingDropdown(choices=[ ("ip_range", _("IP-Range"), Tuple( elements=[ IPv4Address(title=_("From:"),), IPv4Address(title=_("To:"),), ], orientation="horizontal", )), ("ip_network", _("IP Network"), Tuple( elements=[ IPv4Address(title=_("Network address:"),), Integer( title=_("Netmask"), minvalue=8, maxvalue=30, ), ], orientation="horizontal", )), ("ip_list", _("Explicit List of IP Addresses"), ListOfStrings( valuespec=IPv4Address(), orientation="horizontal", )), ("ip_regex_list", _("List of patterns to exclude"), ListOfStrings( valuespec=RegExp(mode=RegExp.prefix,), orientation="horizontal", help=_("A list of regular expressions which are matched against the found " "IP addresses to exclude them. The matched addresses are excluded."), )), ])
def _parameter_valuespec_tcp_connections(): return Dictionary( help=_( "This rule allows to monitor the existence of specific TCP connections or " "TCP/UDP listeners."), elements=[ ( "proto", DropdownChoice( title=_("Protocol"), choices=[("TCP", _("TCP")), ("UDP", _("UDP"))], default_value="TCP", ), ), ( "state", DropdownChoice( title=_("State"), choices=[ ("ESTABLISHED", "ESTABLISHED"), ("LISTENING", "LISTENING"), ("SYN_SENT", "SYN_SENT"), ("SYN_RECV", "SYN_RECV"), ("LAST_ACK", "LAST_ACK"), ("CLOSE_WAIT", "CLOSE_WAIT"), ("TIME_WAIT", "TIME_WAIT"), ("CLOSED", "CLOSED"), ("CLOSING", "CLOSING"), ("FIN_WAIT1", "FIN_WAIT1"), ("FIN_WAIT2", "FIN_WAIT2"), ("BOUND", "BOUND"), ], ), ), ("local_ip", IPv4Address(title=_("Local IP address"))), ("local_port", NetworkPort(title=_("Local port number"))), ("remote_ip", IPv4Address(title=_("Remote IP address"))), ("remote_port", NetworkPort(title=_("Remote port number"))), ( "max_states", Tuple( title=_("Maximum number of connections or listeners"), elements=[ Integer(title=_("Warning at")), Integer(title=_("Critical at")), ], ), ), ( "min_states", Tuple( title=_("Minimum number of connections or listeners"), elements=[ Integer(title=_("Warning if below")), Integer(title=_("Critical if below")), ], ), ), ], )
def _vs_ip_range(self, with_regexp=False): # NOTE: The `ip_regex_list` choice is only used in the `exclude_ranges` key. options = [ ( "ip_range", _("IP-Range"), Tuple( elements=[ IPv4Address(title=_("From:"), ), IPv4Address(title=_("To:"), ), ], orientation="horizontal", ), ), ( "ip_network", _("IP Network"), Tuple( elements=[ IPv4Address(title=_("Network address:"), ), Integer( title=_("Netmask"), minvalue=8, maxvalue=30, default_value=24, ), ], orientation="horizontal", help= _("Please avoid very large subnet sizes/ranges. A netmask value of /21 is " "probably ok, while larger subnets (i.e. smaller netmask values) will lead " "to excessive runtimes."), ), ), ( "ip_list", _("Explicit List of IP Addresses"), ListOfStrings( valuespec=IPv4Address(), orientation="horizontal", ), ), ] regexp_exclude = ( "ip_regex_list", _("List of patterns to exclude"), ListOfStrings( valuespec=RegExp(mode=RegExp.prefix, ), orientation="horizontal", help= _("A list of regular expressions which are matched against the found " "IP addresses to exclude them. The matched addresses are excluded." ), ), ) if with_regexp: options.append(regexp_exclude) return CascadingDropdown(choices=options)
def _parameter_valuespec_vpn_tunnel(): return Dictionary( elements=[ ( "tunnels", ListOf( Tuple( title=("VPN Tunnel Endpoints"), elements=[ IPv4Address( title=_("IP-Address or Name of Tunnel Endpoint"), help=_( "The configured value must match a tunnel reported by the monitored " "device." ), ), TextInput( title=_("Tunnel Alias"), help=_( "You can configure an individual alias here for the tunnel matching " "the IP-Address or Name configured in the field above." ), ), MonitoringState( default_value=2, title=_("State if tunnel is not found"), ), ], ), add_label=_("Add tunnel"), movable=False, title=_("VPN tunnel specific configuration"), ), ), ( "state", MonitoringState( title=_("Default state to report when tunnel can not be found anymore"), help=_( "Default state if a tunnel, which is not listed above in this rule, " "can no longer be found." ), ), ), ], )
def spec(self): return Dictionary( title=_("Create notification with the following parameters"), optional_keys=None, elements=[ ("destination", IPv4Address(title=_("Destination IP"), help=_("IP Address of the Spectrum server receiving the SNMP trap"))), ("community", Password( title=_("SNMP Community"), help=_("SNMP Community for the SNMP trap"), )), ("baseoid", TextAscii(title=_("Base OID"), help=_("The base OID for the trap content"), default_value="1.3.6.1.4.1.1234")), ], )
def spec(self): return Dictionary(elements=[ ("facility", DropdownChoice( title=_("Syslog Facility to use"), help= _("The notifications will be converted into syslog messages with " "the facility that you choose here. In the Event Console you can " "later create a rule matching this facility."), choices=mkeventd.syslog_facilities, )), ("remote", IPv4Address( title=_("IP Address of remote Event Console"), help= _("If you set this parameter then the notifications will be sent via " "syslog/UDP (port 514) to a remote Event Console or syslog server." ), )), ], )