• We collect Jira Service Desk feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

      In many cases the setup is depending on scheduled imports from other systems running every night. However, if the import is failing by some reason, you will today need to get in and look on the process result each day. As you don't know it is failing this won't happen. To make sure to catch such import errors, it would be really good to be able to setup a user or several users to be notified when an import is failing.  

            [JSDSERVER-7990] Alert functionality for failing imports

            Marc Dacanay made changes -
            Labels Original: affects-server insight-l New: affects-server insight-l ril
            Marc Dacanay made changes -
            Remote Link New: This issue links to "Internal ticket (Web Link)" [ 977612 ]

            Same query as for PostrgeSQL from Dennis but written in Microsoft SQL Server T-SQL for the Windows platform. I also added as an output the column [LastSuccessfulImport].

            -- Get the time zone from the server
            DECLARE @TZName AS NVARCHAR(256);
            EXEC master.dbo.xp_regread
                N'HKEY_LOCAL_MACHINE'
                ,N'SYSTEM\CurrentControlSet\Control\TimeZoneInformation'
                ,N'TimeZoneKeyName'
                ,@TZName OUT;
            
            -- Time zone can also be set manually but the above method is more reliable if your system allows you to read the value.
            --SET @TZName = N'W. Europe Standard Time';
            
            ;WITH
                -- Extract JSON data
                ctePr (ID, importSourceId, result, ENDED) AS
                (
                    SELECT
                        pr.ID
                        ,ISNULL(TRY_CAST(JSON_VALUE(pr.RESULT_DATA, N'strict $.importSourceId') AS INT), -1)    AS importSourceId
                        ,ISNULL(TRY_CAST(JSON_VALUE(pr.RESULT_DATA, N'strict $.result') AS NVARCHAR(256)), N'') AS result
                        ,pr.ENDED
                    FROM dbo.AO_8542F1_IFJ_PRG_RES AS pr
                )
            SELECT
                ios.NAME                                                                    AS objectschema_name
                ,isrc.NAME                                                                  AS import_name
                ,DATEDIFF_BIG(SECOND, MAX(pr.ENDED)AT TIME ZONE @TZName, CURRENT_TIMESTAMP) AS age_seconds
                ,MAX(pr.ENDED)AT TIME ZONE @TZName                                          AS LastSuccessfulImport
            FROM dbo.AO_8542F1_IFJ_IMPORT_SRC           AS isrc
                INNER JOIN ctePr                        AS pr ON isrc.ID = pr.importSourceId
                INNER JOIN dbo.AO_8542F1_IFJ_OBJ_SCHEMA AS ios ON ios.ID = ISNULL(isrc.OBJECT_SCHEMA_ID, -1)
            WHERE
                ISNULL(isrc.SYNCHRONIZATION_ENABLED, 0) = 1
                AND ISNULL(pr.result, N'')              = N'OK'
            GROUP BY
                ios.NAME
                ,isrc.NAME
            ORDER BY
                objectschema_name
                ,import_name;
            

            DedicatumJonas added a comment - Same query as for PostrgeSQL from Dennis but written in Microsoft SQL Server T-SQL for the Windows platform. I also added as an output the column [LastSuccessfulImport] . -- Get the time zone from the server DECLARE @TZName AS NVARCHAR(256); EXEC master.dbo.xp_regread N 'HKEY_LOCAL_MACHINE' ,N ' SYSTEM \CurrentControlSet\Control\TimeZoneInformation' ,N 'TimeZoneKeyName' ,@TZName OUT ; -- Time zone can also be set manually but the above method is more reliable if your system allows you to read the value . -- SET @TZName = N 'W. Europe Standard Time ' ; ; WITH -- Extract JSON data ctePr (ID, importSourceId, result , ENDED) AS ( SELECT pr.ID , ISNULL (TRY_CAST(JSON_VALUE(pr.RESULT_DATA, N ' strict $.importSourceId' ) AS INT ), -1) AS importSourceId , ISNULL (TRY_CAST(JSON_VALUE(pr.RESULT_DATA, N ' strict $. result ' ) AS NVARCHAR(256)), N'') AS result ,pr.ENDED FROM dbo.AO_8542F1_IFJ_PRG_RES AS pr ) SELECT ios. NAME AS objectschema_name ,isrc. NAME AS import_name ,DATEDIFF_BIG( SECOND , MAX (pr.ENDED) AT TIME ZONE @TZName, CURRENT_TIMESTAMP ) AS age_seconds , MAX (pr.ENDED) AT TIME ZONE @TZName AS LastSuccessfulImport FROM dbo.AO_8542F1_IFJ_IMPORT_SRC AS isrc INNER JOIN ctePr AS pr ON isrc.ID = pr.importSourceId INNER JOIN dbo.AO_8542F1_IFJ_OBJ_SCHEMA AS ios ON ios.ID = ISNULL (isrc.OBJECT_SCHEMA_ID, -1) WHERE ISNULL (isrc.SYNCHRONIZATION_ENABLED, 0) = 1 AND ISNULL (pr. result , N '') = N' OK' GROUP BY ios. NAME ,isrc. NAME ORDER BY objectschema_name ,import_name;

            Dennis added a comment -

            As a workaround, we are extracting the time since the last import from the database and feed those into our monitoring. This works reasonably well with Postgres' built-in JSON functions:

            SET TIME ZONE 'Europe/Berlin';
            SELECT
                ios."NAME" AS objectschema_name,
                isrc."NAME" AS import_name,
                EXTRACT(epoch FROM(NOW() - MAX(pr."ENDED")))::INTEGER AS age_seconds
            FROM
                "AO_8542F1_IFJ_IMPORT_SRC" isrc
            JOIN public."AO_8542F1_IFJ_PRG_RES" AS pr ON
                json_extract_path_text(pr."RESULT_DATA"::JSON, 'importSourceId') = isrc."ID"::TEXT
            JOIN "AO_8542F1_IFJ_OBJ_SCHEMA" ios ON
                ios."ID" = isrc."OBJECT_SCHEMA_ID"
            WHERE
                isrc."SYNCHRONIZATION_ENABLED" = TRUE
                AND json_extract_path_text(pr."RESULT_DATA"::JSON, 'result') = 'OK'
            GROUP BY
                ios."NAME",
                isrc."NAME"
            ORDER BY
                objectschema_name ASC,
                import_name ASC;
            

            Dennis added a comment - As a workaround, we are extracting the time since the last import from the database and feed those into our monitoring. This works reasonably well with Postgres' built-in JSON functions: SET TIME ZONE 'Europe/Berlin' ; SELECT     ios. " NAME " AS objectschema_name,     isrc. " NAME " AS import_name,     EXTRACT (epoch FROM (NOW() - MAX (pr. "ENDED" ))):: INTEGER AS age_seconds FROM     "AO_8542F1_IFJ_IMPORT_SRC" isrc JOIN public . "AO_8542F1_IFJ_PRG_RES" AS pr ON     json_extract_path_text(pr. "RESULT_DATA" ::JSON, 'importSourceId' ) = isrc. "ID" :: TEXT JOIN "AO_8542F1_IFJ_OBJ_SCHEMA" ios ON     ios. "ID" = isrc. "OBJECT_SCHEMA_ID" WHERE     isrc. "SYNCHRONIZATION_ENABLED" = TRUE     AND json_extract_path_text(pr. "RESULT_DATA" ::JSON, ' result ' ) = 'OK' GROUP BY     ios. " NAME " ,     isrc. " NAME " ORDER BY     objectschema_name ASC ,     import_name ASC ;
            Chung Park Chan made changes -
            Link New: This issue relates to JSDSERVER-7885 [ JSDSERVER-7885 ]
            Alex Cooksey made changes -
            Labels New: affects-server insight-l
            Alex Cooksey created issue -

              Unassigned Unassigned
              da0dd4439f59 Alex Cooksey
              Votes:
              3 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: