简介
Opserver是Stack Overflow的开源监控解决方案,由Stack Exchange发布,基于.NET框架构建。开源地址:https://github.com/opserver/Opserver
使用
github下载源代码编译后,发布至IIS,需要先修改Opserver/Config目录下配置信息(根据模板修改):
首先是SecuritySettings.config(编辑后去掉.example后缀):
1 <?xml version="1.0" encoding="utf-8"?> 2 <!--配置为对所有人可访问--> 3 <SecuritySettings provider="alladmin"> 4 <InternalNetworks> 5 <!--在此节点下的地址 无需身份验证--> 6 <Network name="SE Internal" cidr="127.0.0.1" /> 7 </InternalNetworks> 8 </SecuritySettings>
启用Redis监控
编辑RedisSettings.json,如下:
1 { 2 "allServers": { 3 "name": "All", 4 "instances": [ 5 {"name":"所有Servers都有的实例","port":"99999"} 6 ] 7 }, 8 "Servers": [ 9 { 10 "name": "192.168.1.222" , 11 "instances": [ 12 { "name": "Redis_1", "port": "10001" }, 13 ] 14 }, 15 { 16 "name": "127.0.0.1", 17 "instances": [ 18 { 19 "name": "Redis_1", 20 "port": "6379" 21 }, 22 { 23 "name": "Redis_Master", 24 "port": "6380", 25 "Password":"123456" //auth 26 }, 27 { 28 "name": "Redis_Slave_1", 29 "port": "6381" }, 30 { 31 "name": "Redis_Slave_2", 32 "port": "6382" 33 }, 34 ] 35 } 36 ] 37 }
这里本机开启了4个redisserver:6379-6382,6380(主)/6381/6382为主从集群。
allservers内,是Servers节点下配置的实例中全局的实例信息(配置内的redis实际为开启,只演示用),监控截图:
点击实例可查看Redis详细监控信息:
启用SqlServer监控
编辑SQLSettings.json:
1 { 2 //默认连接字符串,实例未配置connectionString 的,将已name 替换 $ServerName$ 3 "defaultConnectionString": "Data Source=$ServerName$;Initial Catalog=master;Integrated Security=SSPI;", 4 "instances": [ 5 { 6 "name": "MYDB", 7 "connectionString": "Server=127.0.0.1;User ID=user;Password=123456;Trusted_Connection=false", 8 }, 9 ] 10 }
监控截图:
top中,可根据条件查看前几位的查询语句:
connections中,可查看当前活动链接,点击可查看具体信息:
可查看执行计划:
It's all