簡介
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