added mona monitoring to SAP SFTP
This commit is contained in:
@ -23,7 +23,7 @@ DECLARE FUNCTION Get_Status, Msg, Utility, obj_Tables, Dialog_Box, obj_WO_Log
|
||||
Declare function Error_Services, Environment_Services, Logging_Services, GetCurrentProcessID
|
||||
DECLARE SUBROUTINE Set_Status, Msg, obj_Tables, ErrMsg, Set_Property, obj_Order, Yield, Clear_Table, RList, obj_Notes
|
||||
DECLARE SUBROUTINE Send_Info, Send_Event, Post_Event, obj_Notes, SetInitDirOptions, Send_Info, obj_Shipment, obj_Post_Log
|
||||
DECLARE SUBROUTINE Srp_Run_Command, Error_Services, Logging_Services, FTP_Services
|
||||
DECLARE SUBROUTINE Srp_Run_Command, Error_Services, Logging_Services, FTP_Services, Mona_Services
|
||||
|
||||
$INSERT MSG_EQUATES
|
||||
$INSERT NOTIFICATION_EQU
|
||||
@ -41,9 +41,11 @@ Equ CRLF$ TO \0D0A\
|
||||
Equ LF$ TO \0A\
|
||||
Equ TAB$ TO \09\
|
||||
|
||||
LogDate = Oconv(Date(), 'D4/')
|
||||
LogTime = Oconv(Time(), 'MTS')
|
||||
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
|
||||
|
||||
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\ScrapIn'
|
||||
LogDate = Oconv(Date(), 'D4/')
|
||||
LogTime = Oconv(Time(), 'MTS')
|
||||
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' ScrapIn.csv'
|
||||
Headers = 'Logging DTM' : @FM : 'User' :@FM: 'WoMatKey' :@FM: 'SAPBatchNo' :@FM: 'TransQty'
|
||||
objLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, Comma$, Headers, '', False$, False$)
|
||||
@ -63,8 +65,6 @@ LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2]
|
||||
Headers = 'Logging DTM' : @FM : 'Notes'
|
||||
objSapInboundSftpLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, Comma$, Headers, '', False$, False$, True$)
|
||||
|
||||
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
|
||||
|
||||
Main:
|
||||
|
||||
RepoID = ''
|
||||
@ -135,6 +135,7 @@ RETURN Result
|
||||
|
||||
|
||||
* * * * * * *
|
||||
|
||||
SendReconcile:
|
||||
* * * * * * *
|
||||
|
||||
@ -361,7 +362,25 @@ SendReconcile:
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDtm
|
||||
LogData<2> = stat
|
||||
Logging_Services('AppendLog', objSapOutboundSftpLog, LogData, @RM, @FM)
|
||||
Logging_Services('AppendLog', objSapOutboundSftpLog, LogData, @RM, @FM)
|
||||
|
||||
GoSub CheckForErrors
|
||||
|
||||
If SftpError then
|
||||
// Send Email to FI_SUPPORT group
|
||||
Recipients = ''
|
||||
SentFrom = 'System'
|
||||
Subject = 'Outbound SFTP error in obj_SAP'
|
||||
Message = 'SFTP output: ':CRLF$:stat
|
||||
AttachWindow = ''
|
||||
AttachKey = ''
|
||||
SendToGroup = 'FI_SUPPORT'
|
||||
Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
|
||||
obj_Notes('Create',Parms)
|
||||
Mona_Services('SendBufferedStatus', 'GRP_OPENINSIGHT_MES_OP_FE_OI_SAP_OUTBOUND', 'SFTP-Interface-Outbound', 'critical')
|
||||
end else
|
||||
Mona_Services('SendBufferedStatus', 'GRP_OPENINSIGHT_MES_OP_FE_OI_SAP_OUTBOUND', 'SFTP-Interface-Outbound', 'ok')
|
||||
end
|
||||
|
||||
StopTime = Time()
|
||||
|
||||
@ -1076,6 +1095,24 @@ SendRecord:
|
||||
LogData<2> = stat
|
||||
Logging_Services('AppendLog', objSapOutboundSftpLog, LogData, @RM, @FM)
|
||||
|
||||
GoSub CheckForErrors
|
||||
|
||||
If SftpError then
|
||||
// Send Email to FI_SUPPORT group
|
||||
Recipients = ''
|
||||
SentFrom = 'System'
|
||||
Subject = 'Outbound SFTP error in obj_SAP'
|
||||
Message = 'SFTP output: ':CRLF$:stat
|
||||
AttachWindow = ''
|
||||
AttachKey = ''
|
||||
SendToGroup = 'FI_SUPPORT'
|
||||
Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
|
||||
obj_Notes('Create',Parms)
|
||||
Mona_Services('SendBufferedStatus', 'GRP_OPENINSIGHT_MES_OP_FE_OI_SAP_OUTBOUND', 'SFTP-Interface-Outbound', 'critical')
|
||||
end else
|
||||
Mona_Services('SendBufferedStatus', 'GRP_OPENINSIGHT_MES_OP_FE_OI_SAP_OUTBOUND', 'SFTP-Interface-Outbound', 'ok')
|
||||
end
|
||||
|
||||
StopTime = Time()
|
||||
ClearFlag = 1
|
||||
OSDelete DosTable ;* Removes table from C: drive
|
||||
@ -1112,6 +1149,24 @@ ReadInbound:
|
||||
LogData<2> = stat
|
||||
Logging_Services('AppendLog', objSapInboundSftpLog, LogData, @RM, @FM)
|
||||
|
||||
GoSub CheckForErrors
|
||||
|
||||
If SftpError then
|
||||
// Send Email to FI_SUPPORT group
|
||||
Recipients = ''
|
||||
SentFrom = 'System'
|
||||
Subject = 'Inbound SFTP error in obj_SAP'
|
||||
Message = 'SFTP output: ':CRLF$:stat
|
||||
AttachWindow = ''
|
||||
AttachKey = ''
|
||||
SendToGroup = 'FI_SUPPORT'
|
||||
Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
|
||||
obj_Notes('Create',Parms)
|
||||
Mona_Services('SendBufferedStatus', 'GRP_OPENINSIGHT_MES_OP_FE_OI_SAP_INBOUND', 'SFTP-Interface-Inbound', 'critical')
|
||||
end else
|
||||
Mona_Services('SendBufferedStatus', 'GRP_OPENINSIGHT_MES_OP_FE_OI_SAP_INBOUND', 'SFTP-Interface-Inbound', 'ok')
|
||||
end
|
||||
|
||||
StopTime = Time()
|
||||
|
||||
IF StopTime - StartTime > 60 Then
|
||||
@ -1143,6 +1198,24 @@ ReadInbound:
|
||||
LogData<2> = stat
|
||||
Logging_Services('AppendLog', objSapInboundSftpLog, LogData, @RM, @FM)
|
||||
|
||||
GoSub CheckForErrors
|
||||
|
||||
If SftpError then
|
||||
// Send Email to FI_SUPPORT group
|
||||
Recipients = ''
|
||||
SentFrom = 'System'
|
||||
Subject = 'Inbound SFTP error in obj_SAP'
|
||||
Message = 'SFTP output: ':CRLF$:stat
|
||||
AttachWindow = ''
|
||||
AttachKey = ''
|
||||
SendToGroup = 'FI_SUPPORT'
|
||||
Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
|
||||
obj_Notes('Create',Parms)
|
||||
Mona_Services('SendBufferedStatus', 'GRP_OPENINSIGHT_MES_OP_FE_OI_SAP_INBOUND', 'SFTP-Interface-Inbound', 'critical')
|
||||
end else
|
||||
Mona_Services('SendBufferedStatus', 'GRP_OPENINSIGHT_MES_OP_FE_OI_SAP_INBOUND', 'SFTP-Interface-Inbound', 'ok')
|
||||
end
|
||||
|
||||
StopTime = Time()
|
||||
|
||||
IF StopTime - StartTime > 60 Then
|
||||
@ -1172,6 +1245,24 @@ ReadInbound:
|
||||
LogData<2> = stat
|
||||
Logging_Services('AppendLog', objSapInboundSftpLog, LogData, @RM, @FM)
|
||||
|
||||
GoSub CheckForErrors
|
||||
|
||||
If SftpError then
|
||||
// Send Email to FI_SUPPORT group
|
||||
Recipients = ''
|
||||
SentFrom = 'System'
|
||||
Subject = 'Inbound SFTP error in obj_SAP'
|
||||
Message = 'SFTP output: ':CRLF$:stat
|
||||
AttachWindow = ''
|
||||
AttachKey = ''
|
||||
SendToGroup = 'FI_SUPPORT'
|
||||
Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
|
||||
obj_Notes('Create',Parms)
|
||||
Mona_Services('SendBufferedStatus', 'GRP_OPENINSIGHT_MES_OP_FE_OI_SAP_INBOUND', 'SFTP-Interface-Inbound', 'critical')
|
||||
end else
|
||||
Mona_Services('SendBufferedStatus', 'GRP_OPENINSIGHT_MES_OP_FE_OI_SAP_INBOUND', 'SFTP-Interface-Inbound', 'ok')
|
||||
end
|
||||
|
||||
StopTime = Time()
|
||||
|
||||
IF StopTime - StartTime > 60 Then
|
||||
@ -1208,6 +1299,24 @@ ClearInbound:
|
||||
LogData<2> = stat
|
||||
Logging_Services('AppendLog', objSapInboundSftpLog, LogData, @RM, @FM)
|
||||
|
||||
GoSub CheckForErrors
|
||||
|
||||
If SftpError then
|
||||
// Send Email to FI_SUPPORT group
|
||||
Recipients = ''
|
||||
SentFrom = 'System'
|
||||
Subject = 'Inbound SFTP error in obj_SAP'
|
||||
Message = 'SFTP output: ':CRLF$:stat
|
||||
AttachWindow = ''
|
||||
AttachKey = ''
|
||||
SendToGroup = 'FI_SUPPORT'
|
||||
Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
|
||||
obj_Notes('Create',Parms)
|
||||
Mona_Services('SendBufferedStatus', 'GRP_OPENINSIGHT_MES_OP_FE_OI_SAP_INBOUND', 'SFTP-Interface-Inbound', 'critical')
|
||||
end else
|
||||
Mona_Services('SendBufferedStatus', 'GRP_OPENINSIGHT_MES_OP_FE_OI_SAP_INBOUND', 'SFTP-Interface-Inbound', 'ok')
|
||||
end
|
||||
|
||||
StopTime = Time()
|
||||
|
||||
IF StopTime - StartTime > 180 THEN
|
||||
@ -1245,6 +1354,24 @@ DirNextSeq:
|
||||
LogData<2> = stat
|
||||
Logging_Services('AppendLog', objSapOutboundSftpLog, LogData, @RM, @FM)
|
||||
|
||||
GoSub CheckForErrors
|
||||
|
||||
If SftpError then
|
||||
// Send Email to FI_SUPPORT group
|
||||
Recipients = ''
|
||||
SentFrom = 'System'
|
||||
Subject = 'Outbound SFTP error in obj_SAP'
|
||||
Message = 'SFTP output: ':CRLF$:stat
|
||||
AttachWindow = ''
|
||||
AttachKey = ''
|
||||
SendToGroup = 'FI_SUPPORT'
|
||||
Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
|
||||
obj_Notes('Create',Parms)
|
||||
Mona_Services('SendBufferedStatus', 'GRP_OPENINSIGHT_MES_OP_FE_OI_SAP_OUTBOUND', 'SFTP-Interface-Outbound', 'critical')
|
||||
end else
|
||||
Mona_Services('SendBufferedStatus', 'GRP_OPENINSIGHT_MES_OP_FE_OI_SAP_OUTBOUND', 'SFTP-Interface-Outbound', 'ok')
|
||||
end
|
||||
|
||||
StopTime = Time()
|
||||
|
||||
IF StopTime - StartTime > 30 THEN
|
||||
@ -1320,3 +1447,47 @@ LogTrans:
|
||||
|
||||
RETURN
|
||||
|
||||
|
||||
* * * * * * * *
|
||||
CheckForErrors:
|
||||
* * * * * * * *
|
||||
|
||||
// Expects "stat" to be populated with output from psftp call via SRP_Run_Command
|
||||
// Looking for keywords from a list of errors in psftp's (i.e., Putty) documentation.
|
||||
// See https://documentation.help/PuTTY/errors.html
|
||||
|
||||
Begin Case
|
||||
Case IndexC(stat, "host key", 1)
|
||||
SftpError = True$
|
||||
Case IndexC(stat, "WARNING", 1)
|
||||
SftpError = True$
|
||||
Case IndexC(stat, "SSH protocol", 1)
|
||||
SftpError = True$
|
||||
Case IndexC(stat, "cipher", 1)
|
||||
SftpError = True$
|
||||
Case IndexC(stat, "disconnect", 1)
|
||||
SftpError = True$
|
||||
Case IndexC(stat, "memory", 1)
|
||||
SftpError = True$
|
||||
Case IndexC(stat, "Unable to use", 1)
|
||||
SftpError = True$
|
||||
Case IndexC(stat, "Server refused", 1)
|
||||
SftpError = True$
|
||||
Case IndexC(stat, "Access denied", 1)
|
||||
SftpError = True$
|
||||
Case IndexC(stat, "No Supported authentication", 1)
|
||||
SftpError = True$
|
||||
Case IndexC(stat, "Incorrect CRC", 1)
|
||||
SftpError = True$
|
||||
Case IndexC(stat, "garbled", 1)
|
||||
SftpError = True$
|
||||
Case IndexC(stat, "proxy", 1)
|
||||
SftpError = True$
|
||||
Case IndexC(stat, "error", 1)
|
||||
SftpError = True$
|
||||
Case Otherwise$
|
||||
SftpError = False$
|
||||
End Case
|
||||
|
||||
return
|
||||
|
||||
|
Reference in New Issue
Block a user