Query for inactive maintenance windows
search cancel

Query for inactive maintenance windows

book

Article ID: 372966

calendar_today

Updated On:

Products

DX Unified Infrastructure Management (Nimsoft / UIM)

Issue/Introduction

Looking for query to list the inactive maintenance windows in the environment.

 

Environment

Release: DX UIM 20.4*/23.4*

Component: Maintenance mode 

Resolution

Run this query:

 

SELECT  mw.WINDOW_START_TIME,mw.WINDOW_END_TIME, dev_ids =

STUFF((SELECT ',' + cd.dev_id FROM CM_DEVICE cd join MAINTENANCE_SCHEDULE_MEMBERS msm on cd.cs_id =  msm.CS_ID   

WHERE msm.SCHEDULE_ID = ms.SCHEDULE_ID  AND cd.probe_name not like 'app_disco%'

FOR XML PATH('')), 1, 1, ''),

csids_devids=

STUFF((SELECT ',' +  CONVERT(varchar(10),msm.CS_ID) + '=' + cd.dev_id  FROM CM_DEVICE cd join MAINTENANCE_SCHEDULE_MEMBERS msm on cd.cs_id =  msm.CS_ID  WHERE msm.SCHEDULE_ID = ms.SCHEDULE_ID  AND cd.probe_name not like 'app_disco%'

FOR XML PATH('')), 1, 1, ''), ms.SCHEDULE_ID, ms.SCHEDULE_NAME, ms.START_TIME, ms.DURATION, ms.DESCRIPTION  , ms.ACCOUNT_ID, ms.RECURRENCE_PATTERN,

ms.RECURRENCE_PERIOD, ms.RECURRENCE_DAYS_OF_THE_WEEK, ms.RECURRENCE_DAY_OF_THE_MONTH, ms.RECURRENCE_INSTANCE, ms.RECURRENCE_END_TIME, ms.TIMEZONE

FROM MAINTENANCE_SCHEDULE ms  left join (

SELECT    MAX(START_TIME) WINDOW_START_TIME ,MAX(END_TIME) WINDOW_END_TIME, SCHEDULE_ID

FROM      MAINTENANCE_WINDOW group by SCHEDULE_ID  ) mw ON (mw.SCHEDULE_ID = ms.SCHEDULE_ID)