Windows服务,线上的监控程序,监控指定的服务
高胜
2023-05-08 27306db9a074ea4ebdb5e75237f058e4e9af2167
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using HDLMonitorService.ServiceMonitor;
using HDLMonitorService.UDP;
using System;
using System.Collections.Generic;
using System.IO;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading;
using HDLMonitorService.Helper;
 
namespace HDLMonitorService
{
    public partial class HDLMonitorService : ServiceBase
    {
        public HDLMonitorService()
        {
            InitializeComponent();
        }
 
        protected override void OnStart(string[] args)
        {
            try
            {
                //启动HttpListener监听服务注册
                MyHttpListener.Listener();
 
                //启动发送服务心跳的线程
                ServiceHandler.HeartThread();
 
                //检测服务是否长时间离线的线程
                ServiceHandler.CheckService();
 
                //监控数据转发服务
                ServerMonitor.monitorServer();
 
                //启动UDP的通信Socket
                UDPServer.Start();
 
                //监控设备状态缓存服务
                DeviceCacheServiceMonitor.monitorDeviceCacheServer();
 
                //监控小度语音控制
                DuerOsMonitor.monitor();
 
                //监控Alexa语音控制
                AlexaMonitor.monitor();
 
                //监控App接口
                ApiGatewayInfoMonitor.monitor();
 
                //接收业务异常报警
                ListenerAlarm.Listener();
            }
            catch (Exception ex)
            {
                LogHp.WriteLog("启动服务异常", Newtonsoft.Json.JsonConvert.SerializeObject(ex));
            }
        }
 
        protected override void OnStop()
        {
 
 
        }
    }
}