简体   繁体   English

SSRS 报告服务器 - 失败时的电子邮件?

[英]SSRS Report Server - Email on failure?

My company uses SSRS to deliver reports to users, either by email subscriptions or by the user opening the Report Server page in their browser and clicking on the report they want, which then runs it against the db.我的公司使用 SSRS 向用户提供报告,通过电子邮件订阅或用户在浏览器中打开报告服务器页面并单击他们想要的报告,然后针对数据库运行它。 I call this "Interactive mode".我称之为“交互模式”。

My users are supposed to tell me when a report fails, so I can go fix it, but most of the time they don't.我的用户应该在报告失败时告诉我,所以我可以去修复它,但大多数时候他们不会。

So I need to go looking for failed reports.所以我需要去寻找失败的报告。 I can already see which email subscription reports have failed using the subscriptions report in SSRS, but I need a way to either generate an email or log a row to a table whenever one of the interactive mode reports fails.我已经可以使用 SSRS 中的订阅报告查看哪些电子邮件订阅报告失败了,但我需要一种方法来生成电子邮件或在其中一个交互模式报告失败时将行记录到表中。

I can't see anything obvious in Visual Studio that would allow me to do this, has anyone come up with a solution for this before?我在 Visual Studio 中看不到任何明显的东西可以让我这样做,以前有人想出解决方案吗?

By default SSRS maintains the subscriptions and errors info within Report server database.默认情况下,SSRS 在报表服务器数据库中维护订阅和错误信息。

  • Subscriptions is catalog info table of all subscriptions in Report Server Subscriptions是报表服务器中所有订阅的目录信息表
  • SubscriptionHistory maintains the extended details of the error. SubscriptionHistory维护错误的扩展详细信息。

Using following script, you can monitor the last status of all subscriptions at one place, rather than going through SSRS web interface.使用以下脚本,您可以在一个地方监控所有订阅的最后状态,而不是通过 SSRS Web 界面。 also, you could develop your own script based on this:此外,您可以基于此开发自己的脚本:

select  c.ItemID as ReportItemID,
        c.Name as ReportName,
        c.Path as ReportLocation,
        s.Description as SubscriptionTitle,
        EventType,
        LastRunTime,
        LastStatus,
        CreationDate
from Subscriptions as s
     join Catalog as c on s.Report_OID = c.ItemID 
Where   LastStatus like '%failed%'
      or LastStatus like '%Error%'  
      and (NOT LastStatus like '%0 Errors.')
GO

事实证明,ReportServer 数据库中有一个非常有用的表,名为“ExecutionLog”,其中包含这些详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM