Maintenance mode for everything?

New user here, this may be a really dumb question but I couldn’t find anything in the docs for maintenance modes, maybe I overlooked it? Can anyone tell me if there is a way to set a maintenance mode for all devices without having to select each one? I thought maybe * would do it, but I still got an alert email during the maintenance mode period.

In fact I did not find such option either, but apparently it is quite easy to do via SQL. I have my own approach on how to do this as I generally need maintenance for a device group, but I altered it to fit your scenario:

  1. Create a maintenance via web interface and map to a single device from device group.
  2. Get the ID of new maintenance in MySQL:
    SELECT schedule_id FROM alert_schedule ORDER BY schedule_id DESC LIMIT 1;
  3. Get affected device id’s to be added to maintenance in MySQL:
    SELECT device_id FROM devices;
  4. Add the devices to maintenance with queries like:
    INSERT INTO alert_schedule_items (schedule_id, target) VALUES (<result from step 2>, <result from step 4>);

This may sound like a lot of work, but in fact can be done in approximately 5 minutes.

Thanks, I’ll give it a try. Looks like this could turn out to be a large insert query lol but if it gets the job done I guess it doesnt matter :wink:

Actually - I found this a bit easier:

INSERT INTO alert_schedule_items (schedule_id, target)  (SELECT 1, device_id FROM `devices`);

The schedule ID I am using is 1. This just adds all of the items in one insert query, my only issue with doing it this way is that every time a new device is added the table will need emptied if I want to do this again. Or I guess I could just add the device easily from the webui. Really the only reason I am doing this is because I don’t need alerts after 6pm until 7am the following day so I think I could make a daily job that just does this for me possibly, it’s just a pain after setting up a few hundred devices.

1 Like

Also - It would be great if there were some info in the official docs about maintenance modes, just a suggestion :wink: On another note - I seem to still get alerts inside the maintenance window, found a similar thread where they have the options setup nearly like mine but looks like it was never resolved Alerts inside recurring scheduled maintenance for device group