createMaintenanceWindow

A Workflow Engine function that calls the MoogDb createMaintenanceWindow API call, using the same parameters.

This function can be used to enable events to generate maintenance windows on-the-fly. It can also be used as a CEvent triggered action (ex. in the Alert Workflows) or in an Eventless mode (ex. in the Alert Inform Engine), using details passed into the workflowContext.

This function is available as a feature of the Add-ons v2.4 download and later.

This function is available for event, alert, and Situation workflows.

Back to Workflow Engine Functions Reference.

Note

Before using this function, ensure that the Maintenance Window Manager Moolet configuration is changed to support standalone mode. The following line needs to be added to the file $MOOGSOFT_HOME/moolets/maintenance_window_manager.conf. Insert a comma at the end of the previous line if needed:

{
    ... ,
    standalone_moolet : true
}

If you do not have access to this file, please raise a support ticket for this change. Future releases will have this change made permanently.

Note

As with any maintenance window, make sure that the filter for the window applies only to the desired alerts. If the filter is being created programmatically (ex. via substitution), use wildcards and regular expressions with caution.

Arguments

Workflow Engine function createMaintenanceWindow takes the following arguments:

Name

Required

Type

Description

name

yes

string

The name of the maintenance window.

Note: This has a max size of 30 characters. Any name longer than 30 characters will be truncated.

description

yes

string

Description of the maintenance window.

filter

yes

string

An SQL-like filter that alerts must match to be included in the maintenance window.

start_date_time

yes

string

Start time of the maintenance window. This must be in Unix epoch time and may be up to 5 years in the future.

Note: This is a UTC epoch.

duration

yes

string

Duration of the maintenance window in seconds. The minimum duration is 1 second and the maximum is 157784630 seconds (5 years).

forward_alerts

yes

string

Whether or not alerts should be forwarded to the next Moolet in the processing chain.

recurring_period

no

string

Whether or not this is a recurring maintenance window. Set this to:

  • 1, for a recurring maintenance window. If you choose this option, you must also specify recurring_period_units.

  • 0, for a one-time maintenance window. This is also the default value if recurring_period is left unspecified.

Note: "true" or "false" are also accepted as valid inputs.

recurring_period_unit

no

string

The recurring period of the maintenance window, in days, weeks or months. Valid values are:

  • 2, for a daily period

  • 3, for a weekly period

  • 4, for a monthly period

Default value is 0 if recurring_period is set to 0.

Note: String values of "daily", "weekly", and "monthly" will also be accepted.

Example

The following example demonstrates typical use of Workflow Engine function createMaintenanceWindow.

An alert is generated when an event source is entering a maintenance period. We want all alerts for that source to be ignored for the next hour.

  1. Create a workflow in the Alert Workflows with a suitable entry filter to scope the action to the appropriate alert description.

  2. If necessary, add actions to the workflow to extract the required data from the event or alert.

  3. Use the createMaintenanceWindow action with appropriate parameters:

    • name - “Maintenance : $(source)”

      Note: A name needs to be 30 characters or less.

    • description - “Automatically created maintenance window from alert $(alert_id) from source $(source)”

    • filter - “source = ‘$(source)’”

    • startDateTime - $(moog_now)

      • Start the window immediately

    • duration - 3600

This would appear in the UI as:

{"name":"Maintenance : $(source)","description":"Automatically created maintenance window from alert $(alert_id) from source $(source)","filter":"source = '$(source)'","startDateTime":"$(moog_now)","duration":"3600","forwardAlerts":"false"}
ac05ab60-1ea0-4557-ac8f-80451b6666cd.png