def spec(self): return Dictionary( title=_("Create notification with the following parameters"), optional_keys=["url_prefix", "proxy_url"], elements=[ ("webhook_url", CascadingDropdown( title=_("Webhook-URL"), help= _("Webhook URL. Setup Cisco Webex Teams Webhook " + "<a href=\"https://apphub.webex.com/teams/applications/incoming-webhooks-cisco-systems\" target=\"_blank\">here</a>" "<br />This URL can also be collected from the Password Store from Check_MK." ), choices=[("webhook_url", _("Webhook URL"), HTTPUrl(size=80, allow_empty=False)), ("store", _("URL from password store"), DropdownChoice( sorted=True, choices=passwordstore_choices, ))], )), ("url_prefix", _get_url_prefix_specs(local_site_url)), ("proxy_url", HTTPProxyReference()), ], )
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)), ], )
def spec(self): return Dictionary( title=_("Create notification with the following parameters"), optional_keys=["url_prefix", "proxy_url", "priority", "sound"], elements=[ ("api_key", TextAscii( title=_("API Key"), help= _("You need to provide a valid API key to be able to send push notifications " "using Pushover. Register and login to <a href=\"https://www.pushover.net\" " "target=\"_blank\">Pushover</a>, thn create your Check_MK installation as " "application and obtain your API key."), size=40, allow_empty=False, regex="[a-zA-Z0-9]{30}", )), ("recipient_key", TextAscii( title=_("User / Group Key"), help= _("Configure the user or group to receive the notifications by providing " "the user or group key here. The key can be obtained from the Pushover " "website."), size=40, allow_empty=False, regex="[a-zA-Z0-9]{30}", )), ("url_prefix", TextAscii( title=_("URL prefix for links to Check_MK"), help= _("If you specify an URL prefix here, then several parts of the " "email body are armed with hyperlinks to your Check_MK GUI, so " "that the recipient of the email can directly visit the host or " "service in question in Check_MK. Specify an absolute URL including " "the <tt>.../check_mk/</tt>"), regex="^(http|https)://.*/check_mk/$", regex_error=_( "The URL must begin with <tt>http</tt> or " "<tt>https</tt> and end with <tt>/check_mk/</tt>."), size=64, default_value=local_site_url, )), ( "proxy_url", Transform( HTTPProxyReference(), # Transform legacy explicit TextAscii() proxy URL forth=lambda v: ("url", v) if isinstance(v, str) else v, )), ("priority", Transform( CascadingDropdown( title=_("Priority"), choices=[ ("2", _("Emergency: Repeat push notification in intervalls till expire time." ), Tuple(elements=[ Age(title=_("Retry time")), Age(title=_("Expire time")), TextAscii( title=_("Receipt"), help= _("The receipt can be used to periodically poll receipts API to get " "the status of the notification. " "See <a href=\"https://pushover.net/api#receipt\" target=\"_blank\">" "Pushover receipts and callbacks</a> for more information." ), size=40, regex="[a-zA-Z0-9]{0,30}"), ])), ("1", _("High: Push notification alerts bypass quiet hours" )), ("0", _("Normal: Regular push notification (default)") ), ("-1", _("Low: No sound/vibration but show popup")), ("-2", _("Lowest: No notification, update badge number") ), ], default_value="0", ), forth=self._transform_forth_pushover_priority, back=self._transform_back_pushover_priority, )), ("sound", DropdownChoice( title=_("Select sound"), help= _("See <a href=\"https://pushover.net/api#sounds\" target=\"_blank\">" "Pushover sounds</a> for more information and trying out available sounds." ), choices=[ ("none", _("None (silent)")), ("alien", _("Alien Alarm (long)")), ("bike", _("Bike")), ("bugle", _("Bugle")), ("cashregister", _("Cash Register")), ("classical", _("Classical")), ("climb", _("Climb (long)")), ("cosmic", _("Cosmic")), ("echo", _("Pushover Echo (long)")), ("falling", _("Falling")), ("gamelan", _("Gamelan")), ("incoming", _("Incoming")), ("intermission", _("Intermission")), ("magic", _("Magic")), ("mechanical", _("Mechanical")), ("persistent", _("Persistent (long)")), ("pianobar", _("Piano Bar")), ("pushover", _("Pushover")), ("siren", _("Siren")), ("spacealarm", _("Space Alarm")), ("tugboat", _("Tug Boat")), ("updown", _("Up Down (long)")), ], default_value="none")), ], )