Hi,
Getting historical windows from DB is simple:
select
ms.SCHEDULE_NAME,
mw.START_TIME,
mw.END_TIME,
d.dev_name,
d.dev_ip
from
MAINTENANCE_SCHEDULE ms,
MAINTENANCE_WINDOW mw,
CM_DEVICE d
where
mw.SCHEDULE_ID = ms.SCHEDULE_ID
and
d.dev_id = mw.DEV_ID
order by
ms.START_TIME,
ms.SCHEDULE_NAME
Getting schedules that will fire within the next day isn't quite so simple, since they are usually defined by recurrence. The data is stored in MAINTENANCE_SCHEDULE table, but you'd have to build a bit more complicated query for that. Maintenance_mode probe also has callbacks for both functions, but I'm not quite sure why I haven't gotten them to work properly. However, both are also exposed through the REST api, which is very simple to use in the case of schedules about to trigger, althought it might be a bit more arduous to make your data presentable. Then again, building a UR report with variables in queries is also nasty job in my experience.
To get schedules that are about to trigger:
https://your.domain.com/rest/maintenance_mode/Domain/Hub/Robot/get_next_fire_time_for_schedules
You need to point it to the robot that has maintenance_mode installed on it.
It's funny how it seems it's more simple to get one from the db and the other from the ws..
-jon