こんにちはマツダです。
WindowsのIOPSを監視するmuninプラグインを作成する機会があったので共有します。
対象バージョン
- Windows Server 2016
- munin-node-x64-v1.6
プラグイン本体
プラグインはIOPSを返すVBScript(iops.vbs)とそれを呼び出すcmdファイル(iops.cmd)になります。
プラグインの作成
WindowsのIOPSはパフォーマンスモニタの「Process(_Total)\IO Operation/sec」の値を取ってきて表示します。
また、第一引数にconfigを指定された場合は、グラフ(RRDtool)の設定を返すようにします。
C:\munin\plugins\iops.vbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
' Munin Node for Windows external plugin
' This plugin shows iops.
Option Explicit
Dim args, objWMI
Set args = WScript.Arguments
Set objWMI = GetObject("winmgmts:\\.\root\cimv2")
if args.Count = 1 then
if args.Item(0) = "config" then
Print("graph_title IOPS")
Print("graph_category disk")
Print("graph_info This graph shows iops.")
Print("graph_vlabel IO Operation/sec")
Print("graph_args --alt-autoscale-max --rigid --base 1000 --lower-limit 0")
Print("iops.label IO Operation/sec")
Print("iops.max 10000")
Print("iops.min 0")
Print("iops.draw LINE")
Print("iops.type DERIVE")
Print(".")
elseif args.Item(0) = "name" then
Print("iops_cmd")
end if
WScript.Quit
end if
' Get performance monitor IO Data Operations/sec(_Total)
Dim PerfProcTotal
For Each PerfProcTotal in objWMI.ExecQuery ("Select * from Win32_PerfRawData_PerfProc_Process where Name='_Total'")
Print("iops.value " & PerfProcTotal.IODataOperationsPerSec)
Next
Print(".")
'--- Function ---
Sub Print(str)
Wscript.StdOut.Write str & vbLf
'WScript.Echo str
End Sub
|
C:\munin\plugins\iops.cmd
1
2
3
4
5
6
|
@echo off
rem Munin Node for Windows external plugin wrapper
call %windir%\system32\cscript.exe //NoLogo "C:\munin\plugins\iops.vbs" %1
|
作成したプラグインの設定
c:\munin\munin-node.ini に下記を追記し、munin-nodeを再起動します。
1
2
3
4
5
6
7
|
[Plugins]
External=1
ExternalTimeout=5
[ExternalPlugin]
Plugin01=c:\munin\plugins\iops.cmd
|
動作確認
グラフが正常に表示されることを確認します。
※参考にしたサイト:https://gist.github.com/moisseev/6026bb2794b33b2488c65aec9a8a5452