From 5ba99c1c15c738b12ec380a18b68f59f8967705c Mon Sep 17 00:00:00 2001 From: Marsell Kukuljevic Date: Mon, 17 Jun 2024 17:27:56 +0200 Subject: [PATCH] Add AMD GPU plugin. --- check_mk-amd-gpu/amd-gpu-0.1.0.mkp | Bin 0 -> 2600 bytes .../base/plugins/agent_based/amd_gpu.py | 106 ++++++++++++++++++ .../plugins/wato/check_parameters/amd_gpu.py | 85 ++++++++++++++ .../custom/amd_gpu/lib/plugins/amd_gpu.ps1 | 20 ++++ 4 files changed, 211 insertions(+) create mode 100755 check_mk-amd-gpu/amd-gpu-0.1.0.mkp create mode 100644 check_mk-amd-gpu/local/lib/check_mk/base/plugins/agent_based/amd_gpu.py create mode 100644 check_mk-amd-gpu/local/lib/python3/cmk/gui/plugins/wato/check_parameters/amd_gpu.py create mode 100644 check_mk-amd-gpu/local/share/check_mk/agents/custom/amd_gpu/lib/plugins/amd_gpu.ps1 diff --git a/check_mk-amd-gpu/amd-gpu-0.1.0.mkp b/check_mk-amd-gpu/amd-gpu-0.1.0.mkp new file mode 100755 index 0000000000000000000000000000000000000000..28c40eddd576864bbfc69ec6aefacaead9b321c4 GIT binary patch literal 2600 zcmZwH`9Bkk1Hf^i$1O*W(&NZc%sI-jX-Uj2SB@=XLg{V~49SDjRH-UTK zi$I1LJSa4uQl0p5{|HiZQ{={$TAY1bDDb(Z zujaI`)3f%WoFI(!L{Aov{!o7TD7=`n63vH(@5S{8#IS7W?@dS_$UA06N*!$sgpQn` zCzxY_HuFr}X~(d?@+LEY`19*oN9tLiFUQTpS1n8b@k-1hFE}{TwyG4xxb3OKhB3&@ zlUiiyA+*My{;Nt8{W}s9ecI=V$O)l7VRv;3Lb;AXMLk@9c5N!!_ ze{4U4=>^jlJHULQ(-)3A1eNoAWw$$uL~kD2xsx6;`o}v)>Hj&=zMMa%FkXdbilL|Me} zomR8+@rSes$-xwuHeVOfU0SYkm6GM=!Ov?HbOYqE7za`g(|u^O@qI~GH`Dg2seFn( z-xt(md^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m)57V60rYf_m4&7U*bK#))g=T`iji@haP9t#QApeI3o1Sag6zxu0n$}<@Bqx)s6=| z(_o^7kAn6g4sr{LV$t_!(DydTz&rRa&b3Rf_U~B33nRDW&<6Qymw?bR-zu$^QvM7R z7>DT%fQETBw!EKlSKy`5Et^a@k$hKVZ^)=+q{1T6u!hIpW8R?mGaalqA z&m9e~7n+1-xH>dkv-ldZ3PtR0RYr=2!Lc&Jt+$%QX1eTLa)*oB&H5cQ7i7DiT;%ME zBFv$*%Uu;lTu>B63izhOoYd+AQBRSE@gI(kxs*bGxTHf}Ho1i&0Z1M}Ee}1ii2zp? zRv7DbYQ2#+uOqCfH@lOa+(zygIZ7I7nA5;rZ^k)YG}pkQzwMmO?XqS#xK&HY z1rYu4v~w7!8f>SwN7*feO|@~!4dKfXX?duW5q~C3-=DAe1`j4NISzpd8CASb*L*!5 zih!ho^j(~!Tgb_yme& "Deploy Custom Files With Agent" with +# "Deploy Custom Files With Agent" including "amd_gpu". + +foreach ($Item in Get-ChildItem "HKLM:\SYSTEM\CurrentControlSet\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}" -Name -Include 000*) { + $Name = Get-ItemPropertyValue "HKLM:\SYSTEM\CurrentControlSet\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}\$Item" "DriverDesc" + if ($Name -match 'Radeon') { + $GpuBytesTotal = Get-ItemPropertyValue "HKLM:\SYSTEM\CurrentControlSet\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}\$Item" "HardwareInformation.qwMemorySize" + $GpuRawName = Get-ItemPropertyValue "HKLM:\SYSTEM\CurrentControlSet\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}\$Item" "HardwareInformation.AdapterString" + break + } +} + +$GpuName = [System.Text.Encoding]::Unicode.GetString($GpuRawName) +$GpuPercent = (((Get-Counter "\GPU Engine(*)\Utilization Percentage" ).CounterSamples).CookedValue | measure -sum).sum +$GpuBytesUsed = (((Get-Counter "\GPU Process Memory(*)\Dedicated Usage").CounterSamples).CookedValue | measure -sum).sum + +Write-Output "<<>>", $GpuName, $GpuPercent, $GpuBytesUsed, $GpuBytesTotal