Email notification from BizTalk for failed messages & error from event viewer

佐手、 提交于 2020-03-05 04:38:28

问题


enter image description herePlease let me know how to get email notification whenever an message fails in BizTalk and also whenever there is error in event viewer.


回答1:


I think this depends on your solution. Within the solution I have developed, I have identified most points of failure on message routing, due to mistransformations, missing fields etc. These are then routed to an Orchestration which specifically only sends SMTP emails to set addresses. This works fairly well for the requirements of my company. - you can find plenty of SMTP Orchestration examples with a quick google.. I started here

In tandem with this - for the unknowns, I have also set up a powershell script to email out the last message of the Windows Log Event Viewer. I have created a custom viewer using the BizTalk Administrative console..

<QueryList>
  <Query Id="0" Path="Application">
    <Select Path="Application">*[System[Provider[@Name='BizTalk DW Reporting' or @Name='BizTalk Server' or @Name='BizTalk Server Deployment' or @Name='BizTalk Server EDI' or @Name='ENTSSO' or @Name='XLANG/s'] and (Level=1  or Level=2)]]</Select>
  </Query>
</QueryList>

and then exported that out into a Windows Task Schedule, that triggers a powershell script whenever it detects that there is a new entry that lands in the custom viewer.

I have followed the rough principles provided here for the powershell script.

Hope this points you in the right direction for what you need. There are probably better solutions, but this works fairly well.

This is the powershell script I am using

$event = get-eventlog -LogName Application -Source "XLANG/s","BizTalk Server","BizTalk DW Reporting","BizTalk Server Deployment","BizTalk Server EDI","ENTSSO" -EntryType "Error" -newest 1
#get-help get-eventlog will show there are a handful of other options available for selecting the log entry you want.
$eventtime = $event.TimeGenerated


#ignore any messagebox errors
if (($event.EntryType -eq "Error"  -and $event.EventID -inotin 6998, 10514))
{
    $Source = $event.Source
    $PCName = $env:COMPUTERNAME
    $EmailBody = "$Source Error captured at " + $event.TimeGenerated + " in windows error log on BizTalk-UAT server: `n`n" + $event.Message
    $EmailFrom = "????-BizTalk-UAT@???.com"
    $EmailTo = @('????-BizTalk-UAT@???.com') 
    $EmailSubject = "BizTalk-UAT Server - Windows Log - " + $event.EntryType
    $SMTPServer = "mail.????.com"
    Write-host "Sending Email" $EmailFrom "To" $EmailTo
    Send-MailMessage -From $EmailFrom -To $EmailTo -Subject $EmailSubject -body $EmailBody -SmtpServer $SMTPServer

}
else
{
    write-host "No error found"
    write-host "Here is the log entry that was inspected:"
$event
}



回答2:


The 'correct' way to do this is with a monitoring tool for Windows and other platforms.

First, as your network or server team if they have a tool such as SCOM or Splunk which they should be using to monitor the servers anyway. Then, you can configure any rule you/they want, including email.

In your BizTalk Apps, just be sure to create Windows Events (Event Viewer) in you exception handling code.



来源:https://stackoverflow.com/questions/54155930/email-notification-from-biztalk-for-failed-messages-error-from-event-viewer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!