Use the New Maintenance Mode to Silence Notifications

Written by: Baptiste Mathus

Using the CloudBees Monitoring plugin it is possible to create very flexible alerts. You can easily trigger an email notification based on a whole variety of metrics .

Starting with CloudBees Monitoring plugin 2.7, you can now disable the notifications during some planned maintenance window.

Use Case

Imagine you set up an alert on the jenkins.queue.pending.value metric to be notified when there are too many jobs waiting (hence wasting time) in the queue to get an executor.

Now, you, as an administrator, have planned a backend migration to grow the capacity, that you know will impact the queuing time.

It would be nice if you could tell the alerting system: “Please, tomorrow, starting at 17:00, don’t nag me with notifications for alerts for 1 hour”.

This is the feature that was added.

Example Usage

We introduced a new set of Jenkins CLI commands to manage the maintenance windows.

  • list-maintenance-windows

  • schedule-maintenance-window

  • clear-maintenance-windows

  • cancel-maintenance-window

  • complete-maintenance-window

Example: planning a maintenance window, starting now and lasting for 1 hour, for the reason “upgrading the infrastructure” (the authentication part in the command below has been left aside: please refer to the CLI documentation and use either the user:token format, or the SSH authentication) :

$ java -jar jenkins-cli.jar -s schedule-maintenance-window now 1h "upgrading the infrastructure"

Once that is done, you can check it has been registered:

$ java -jar jenkins-cli.jar -s list-maintenance-windows
[{"start":1507719722000,"end":1507723322000,"reason":"upgrading the infrastructure","ownerDisplayName":"Baptiste Mathus"}]

If you access the UI, you will see that the Alert icon shows a visual warning that notifications are currently skipped. On the Alerts page, you will be presented with a summary of the planned maintenance windows:

During that maintenance window: if an alert is triggered, then resolved, no notification will ever be sent.

If the alert is still present after the end of the maintenance window, then a notification will occur.


The roles of those commands should be pretty straightforward, but for an extensive and always up-to-date command by command help, refer to your Jenkins’ instance itself, under https://your-instance/cli .

For more thorough explanations and overview of this new feature, please refer to the official documentation .

Stay up to date

We'll never share your email address and you can opt out at any time, we promise.