opendds初入门之monitor监控的简单练习
使用过程中,发现monitor这个软件基于集中模式下确实能正常运行,但是总会有卡死,异常等一些情况,还是不那么好用。
1.考虑一下如何基于opendds实现节点监控
opendds提供了monitor的软件实现节点监控。
- 理论上,基于当前的monitor监控方案(认知理解),可以监控到对应的topic,发布者信息Writer,订阅者信息Reader,domainid,transport等。
====》严格基于opendds的管理架构,按层级进行监控展示的。
====》只有tree Node可以。(感觉容易受到影响,不稳定,主要是inforepo.exe的稳定性吧,后台不要有多个,传输链路影响的?) - 理论上,可以参考monitor代码简单修改,实现非集中模式下的这种类似的监控。
- 考虑业务适配度,查看了monitor监控界面,实际上展示和显示都是不够友好的,以及它的粒度是很低的,基于topic和基于datawriter/reader。
要实现基于一个运行节点的监控功能:使用内置主题+节点专门的topic实现(monitor处理太细节了,通过qos策略关联也是可行的吧)。
2.分析一下monitor的节点监控的方案。
集中模式下的monitor监控直接用opendds自带的example进行测试即可,非集中模式需要修改代码适配,专门的订阅端监听专门的topic进行识别。
opendds中有个monitor模块,实现了基于集中模式的节点监控功能。
=====》该模块使用专门的monitor topic,monitor模块作为订阅端,同时订阅相关的内置主题,识别上下线以及监控功能。
=====》参考该集中模式下monitor的方式,使用非集中模式进行测试。
#首先观察opendds下自带的monitor模块
C:\Users\LEGION\Desktop\opendds_study\OpenDDS\tests\DCPS\Monitor>perl run_odds_mon.pl
C:\Users\LEGION\Desktop\opendds_study\OpenDDS\bin\.\DCPSInfoRepo.EXE -DCPSDebugLevel 6 -ORBDebugLevel 10 -ORBLogFile DCPSInfoRepo.log -o repo.iorinfoRepo has run start.C:\Users\LEGION\Desktop\opendds_study\OpenDDS\bin\.\monitor.EXE -DCPSTransportDebugLevel 6 -ORBDebugLevel 10 -ORBLogFile mon.log -DCPSDebugLevel 10 -DCPSConfigFile mon.ini
.\.\publisher.EXE -ORBDebugLevel 10 -ORBLogFile pub.log -DCPSConfigFile pub.ini -DCPSDebugLevel 10
.\.\subscriber.EXE -DCPSTransportDebugLevel 6 -ORBDebugLevel 10 -ORBLogFile sub.log -DCPSConfigFile sub.ini -DCPSDebugLevel 10
可以看到确实能看到相关监控信息:
参考自带的monitor测试样例,使用集中模式,首先启动我的中心节点,使用monitor进行监控(注意该节点也需要通过配置文件启动监控支持) (支持监控节点都需要DCPSMonitor=1),验证可以看到相同信息。
#这里需要注意 启动的相关指令 需要集中模式,还需要打开monitor开关。
C:\Users\LEGION\Desktop\opendds_study\OpenDDS\bin\.\DCPSInfoRepo.EXE -ORBDebugLevel 1 -ORBLogFile DCPSInfoRepo.log -o repo.ior -DCPSPendingTimeout 3#注意修改pub和sub的配置文件,使支持监控
[common]
DCPSDebugLevel=0
DCPSInfoRepo=file://repo.ior
DCPSChunks=20
DCPSChunkAssociationMultiplier=10
DCPSLivelinessFactor=80
DCPSMonitor=1
#DCPSBit=0 #注意冲突#启动监控模块 这里直接使用monitor自带的mon.ini配置
C:\Users\LEGION\Desktop\opendds_study\OpenDDS\bin\.\monitor.EXE -DCPSTransportDebugLevel 6 -ORBDebugLevel 10 -ORBLogFile mon.log -DCPSDebugLevel 10 -DCPSConfigFile mon.ini#分别启动发布端和订阅端模块 subscriber.exe publisher.exe 在监控软件上可以看到监控的信息
暂时练习这些,非集中模式需要适配代码,监听专门的monitor topci进行测试,持续研究和练习后续。