[Tool]利用 Microsoft Monitoring Agent 來找出系統效能及異常問題

想要蒐集系統有什麼異常或是效能問題嗎?
以前都是去解析IIS Log,現在您有更好的工具來幫忙哦!
原本在System Center中的Module,現在也可以單獨使用了哦!

最近公司有個系統,當系統中有比較多的資料時,一登入就會粉慢。

後來找到了「Introducing Microsoft Monitoring Agent」這篇文章。

於是下載「Microsoft Monitoring Agent 2013 」來試看看。

安裝完成之後,在服務之中會有 Microsoft Monitoring Agent 及 Microsoft Monitoring Agent APM ,如下,

image

 

然後就可以開始將較慢的網頁記錄下來,請以系統管理員身份開啟 PowerShell,

然後輸入 Start-WebApplicationMonitoring ,再來輸入要監看的 網站 及 監看的方式 ,如下,

image

 

註:如果一開始輸入時,發生如下的錯誤訊息,

image

無法辨識 'start-webapplicationmonitoring' 詞彙是否為 Cmdlet、函數、指令檔或可執行程式的名稱。請檢查名稱拼字是否正確,如
果包含路徑的話,請確認路徑是否正確,然後再試一次。
位於 行:1 字元:31
+ start-webapplicationmonitoring <<<<
    + CategoryInfo          : ObjectNotFound: (start-webapplicationmonitoring:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

請先Import module,如下,

import-module "C:\Program Files\Microsoft Monitoring Agent\Agent\PowerShell\Microsoft.MonitoringAgent.PowerShell\Microsoft.MonitoringAgent.PowerShell.dll"

image

 

等測試完成後,就可以執行 Checkpoint-WebApplicationMonitoring 來建立 IntelliTrace 檔案,

或是執行 Stop-WebApplicationMonitoring "網站" 來停止監看並建立 IntelliTrace 檔案。

image

image

詳細 Cmdlet 使用方式,請參考 Cmdlet Reference

 

有了 IntelliTrace 檔案,我們就可以使用 Visual Studio Ultimate 2013 來開啟它,

可看到系統執行中的Exception,及效能較差的地方,如下,

image

 

效能的部份,還可以DBClick或是選擇後,按下「View Details」再看更詳細的資訊,如下,

image

image

image

如果有pdb,還可以進一步的Debug進去哦! 希望對大家有幫助

 

參考資料

Introducing Microsoft Monitoring Agent

Monitor apps in deployment with Microsoft Monitoring Agent

Monitoring Web Applications with Microsoft Monitoring Agent

Microsoft Monitoring Agent 2013

Hi, 

亂馬客Blog已移到了 「亂馬客​ : Re:從零開始的軟體開發生活

請大家繼續支持 ^_^