使用Azure Monitor監視Process

常見的監控場景中,咱們除了監控服務器的性能、服務的運行情況之外,也須要對某些進程的運行情況進行監控。在Azure Monitor中咱們能夠將進程ID視爲性能計數器,來完成對進程運行情況的監控。服務器

每一個進程都會在性能計數器中寫入不少數值。默認狀況下Azure Monitor是不會收集這些數值的,可是咱們能夠很容易的在Windows Performance 中看到:
使用Azure Monitor監視Processide

配置收集進程數據
咱們能夠使用以下方式配置Azure Monitor以性能計數器的方式監控進程,在此以notepad爲例:
在Log Analytics工做區中點擊「Advanced settings」--「Data」--「Windows Performance Counters」,添加「Process[notepad]\ID Process」:
使用Azure Monitor監視Process性能

查看收集到的數據
配置完成之後,咱們能夠使用以下查詢來查詢notepad的進程ID。若是記事本程序沒有運行,則沒有數據。若是須要設置Alert,警報規則能夠配置爲在最近X分鐘內返回零結果時生成警報。3d

Perf
| where InstanceName == "notepad"
| extend localTimestamp = TimeGenerated + 8h
| where TimeGenerated > ago(5m)
| project TimeGenerated , CounterValue, InstanceName
| order by TimeGenerated desc

使用Azure Monitor監視Process

相關文章
相關標籤/搜索