Ejemplo n.º 1
0
        /// <summary>
        /// 初始化监控
        /// </summary>
        private void InitMonitor()
        {
            _logger.LogInformation((int)LogEvent.系统, "初始化监控任务");
            FixedJobTask fixedJobTask = _serviceProvider.GetRequiredService <FixedJobTask>();
            StorageMonitor <LaneFlow, FlowDevice> flowStorageMonitor = _serviceProvider.GetRequiredService <StorageMonitor <LaneFlow, FlowDevice> >();

            flowStorageMonitor.SetBranchBlock(_serviceProvider.GetRequiredService <FlowBranchBlock>());
            StorageMonitor <VideoStruct, FlowDevice> videoStorageMonitor = _serviceProvider.GetRequiredService <StorageMonitor <VideoStruct, FlowDevice> >();

            videoStorageMonitor.SetBranchBlock(_serviceProvider.GetRequiredService <VideoBranchBlock>());
            FlowSwitchMonitor   flowSwitchMonitor   = _serviceProvider.GetRequiredService <FlowSwitchMonitor>();
            VideoSwitchMonitor  videoSwitchMonitor  = _serviceProvider.GetRequiredService <VideoSwitchMonitor>();
            SectionFlowMonitor  sectionFlowMonitor  = _serviceProvider.GetRequiredService <SectionFlowMonitor>();
            SystemStatusMonitor systemStatusMonitor = _serviceProvider.GetRequiredService <SystemStatusMonitor>();

            SystemStatusMonitor.Version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
            DeviceStatusMonitor deviceStatusMonitor = _serviceProvider.GetRequiredService <DeviceStatusMonitor>();

            fixedJobTask.AddFixedJob(systemStatusMonitor, DateTimeLevel.Minute, TimeSpan.Zero, "系统状态检查");
            fixedJobTask.AddFixedJob(sectionFlowMonitor, DateTimeLevel.Minute, TimeSpan.Zero, "路段流量计算");
            fixedJobTask.AddFixedJob(flowSwitchMonitor, BranchDbConvert.DateLevel, _dbSpan, "流量数据分表切换");
            fixedJobTask.AddFixedJob(videoSwitchMonitor, BranchDbConvert.DateLevel, _dbSpan, "视频数据分表切换");
            fixedJobTask.AddFixedJob(deviceStatusMonitor, DateTimeLevel.Minute, TimeSpan.Zero, "设备状态检查");
            fixedJobTask.AddFixedJob(flowStorageMonitor, DateTimeLevel.Minute, TimeSpan.Zero, "流量数据定时保存");
            fixedJobTask.AddFixedJob(videoStorageMonitor, DateTimeLevel.Minute, TimeSpan.Zero, "视频数据定时保存");
            fixedJobTask.Start();
        }
Ejemplo n.º 2
0
        private void InitMonitor()
        {
            _logger.LogInformation((int)LogEvent.系统, "初始化监控任务");

            StorageMonitor <TrafficDensity, DensityDevice> densityStorageMonitor = _serviceProvider.GetRequiredService <StorageMonitor <TrafficDensity, DensityDevice> >();

            densityStorageMonitor.SetBranchBlock(_serviceProvider.GetRequiredService <DensityBranchBlock>());
            DensitySwitchMonitor densitySwitchMonitor = _serviceProvider.GetRequiredService <DensitySwitchMonitor>();
            SystemStatusMonitor  systemStatusMonitor  = _serviceProvider.GetRequiredService <SystemStatusMonitor>();

            SystemStatusMonitor.Version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
            DeviceStatusMonitor deviceStatusMonitor = _serviceProvider.GetRequiredService <DeviceStatusMonitor>();

            FixedJobTask fixedJobTask = _serviceProvider.GetRequiredService <FixedJobTask>();

            fixedJobTask.AddFixedJob(systemStatusMonitor, DateTimeLevel.Minute, TimeSpan.Zero, "系统状态检查");
            fixedJobTask.AddFixedJob(deviceStatusMonitor, DateTimeLevel.Minute, TimeSpan.Zero, "设备状态检查");
            fixedJobTask.AddFixedJob(densitySwitchMonitor, BranchDbConvert.DateLevel, _dbSpan, "密度数据分表切换");
            fixedJobTask.AddFixedJob(densityStorageMonitor, DateTimeLevel.Minute, TimeSpan.Zero, "密度数据定时保存");
            fixedJobTask.Start();
        }