用于Windows的服务心跳活动 [英] Heartbeat activity for Windows Service

查看:646
本文介绍了用于Windows的服务心跳活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多Windows服务(用C#4.0),在不同的时间间隔连接到数据库,做各种复杂的任务。其中一些任务只发生每天每X小时一班。但是,服务器支持团队想知道,如果Windows服务实际上是运行作为可以有任务之间有很大的间隔。他们将基本上需要为每个Windows服务心跳。每5分钟的Windows服务会做一些事情,可以通过微软系统中心操作管理器(SCOM)进行监控。任何解决方案都必须被轻易通过SCOM监控的服务器支持团队依靠它。

I have many Windows Services (written in C# 4.0) that at various intervals connect to a database and do various complex tasks. Some of these tasks only occur every X hour intervals per day. However, the server support team would like to know if the Windows Service is actually running as there can be a big interval between tasks. They would like essentially a heartbeat for each Windows Service. Every 5 minutes the Windows Service would do something that could be monitored by Microsoft System Center Operation Manager (SCOM). Any solution must being easily monitored by SCOM as the server support team rely on it.

什么是实现这一类型funcationality的最佳方式?我以为使用性能计数器,并具有SCOM听那些,但不知道这是PERF的柜台最使用

What is the best way to achieve this type of funcationality? I thought of using Performance Counters and have SCOM listen for those but not sure if that is that best use of perf counters.

UPDATE(完全忘了包括):目前各服务写入到数据库这个动作,但SCOM不在监控数据库记录和差分哪些服务是做什么等。

UPDATE (Totally forgot to include): Currently each service writes to a database this action but SCOM is not very good at monitoring databases records and differentiating which service is doing what etc.

推荐答案

你可以添加或者SNMP或WMI仪器到你的服务 - 这顺便可以让你提高的不仅仅是心跳消息更多 - 例如,你也可以提高,当你遇到需要的操作重试瞬时故障事件

You could add either SNMP or WMI instrumentation to your services - this incidentally will allow you to raise more than just heartbeat messages - for example you could also raise events when you encounter transient faults that require an operation to be retried.

有大量的SNMP库,在那里和WMI支持内置到.NET框架。

There are plenty of SNMP libraries out there and WMI support is built into the .NET framework.

这篇关于用于Windows的服务心跳活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆