Maintenance column in db after upgrade

Started by AP_ops, November 15, 2018, 03:36:16 PM

Previous topic - Next topic

AP_ops

Hello,

Last week i did an upgrade to version 2.2.10

We used to had a daily report through a db query that we check for systems that are in maintenance mode.

the query is this one:

USE netxms_db

DECLARE @OBJECT_ID INT, @NAME VARCHAR(63), @ITEM_ID INT, @DESCRIPTION VARCHAR(255)
SET @OBJECT_ID = 0
SET @ITEM_ID = 0

DECLARE @UNMANAGED_SYSTEMS TABLE(
    System VARCHAR(63)
)

WHILE (1 = 1)
BEGIN 

    SELECT TOP 1 @OBJECT_ID = object_id
    ,@NAME = name
    FROM netXMS.object_properties
    WHERE object_id > @OBJECT_ID AND maint_mode=1
    ORDER BY object_id

/* Exit loop if no more entries */
IF @@ROWCOUNT = 0 BREAK;

INSERT INTO @UNMANAGED_SYSTEMS SELECT @NAME AS System FROM [netxms_db].[netxms].[items] WHERE node_id = @OBJECT_ID

END

SELECT * FROM @UNMANAGED_SYSTEMS GROUP BY System ORDER BY System ASC


After the upgrade the query is not working. I see some changes in the names but i cannot find a value for the maint_mode.
Have you move it to different table?

thanks

gdodd

Seems if maint_event_id is greater than 0 the object is in maintenance mode. Looks like they are keeping track of more than a "yes/no" as just entering maintenance mode gives a value of 6335951 and if the object is scheduled for maintenance the value is 6335955.

Alex Kirhenshtein

When node goes into maintenance mode, event MAINTENANCE_MODE_ENTERED is generated. Unique ID of the resulting event is saved into maint_event_id.