mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
Modified mem_percent_used win32 plugin
This commit is contained in:
parent
b2489e90aa
commit
268cff6d55
@ -3,14 +3,16 @@
|
|||||||
' Pandora FMS Plugin, (c) 2017 Fermin Hernandez
|
' Pandora FMS Plugin, (c) 2017 Fermin Hernandez
|
||||||
' ------------------------------------------
|
' ------------------------------------------
|
||||||
|
|
||||||
Dim usedMEM, totalMEM, Percent
|
Dim usedMEM, Percent
|
||||||
|
Dim totalMEM
|
||||||
|
|
||||||
strComputer = "."
|
strComputer = "."
|
||||||
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||||
|
Set colRAMs = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
|
||||||
|
|
||||||
Set colRAMs = objWMIService.ExecQuery("Select capacity from Win32_PhysicalMemory")
|
totalMEM = 0
|
||||||
For Each total in colRAMs
|
For Each total in colRAMs
|
||||||
totalMEM = total.capacity
|
totalMEM = total.totalPhysicalMemory
|
||||||
Next
|
Next
|
||||||
|
|
||||||
Set colUSEDs = objWMIService.ExecQuery("Select freePhysicalMemory from Win32_OperatingSystem")
|
Set colUSEDs = objWMIService.ExecQuery("Select freePhysicalMemory from Win32_OperatingSystem")
|
||||||
@ -37,7 +39,7 @@ End If
|
|||||||
on error goto 0
|
on error goto 0
|
||||||
|
|
||||||
'Print only when there's results
|
'Print only when there's results
|
||||||
If (NOT flag) Then
|
If (NOT flag AND totalMEM <> 0) Then
|
||||||
Percent = round (100 - (usedMEM / totalMEM) * 100, 2)
|
Percent = round (100 - (usedMEM / totalMEM) * 100, 2)
|
||||||
Wscript.StdOut.WriteLine "<module>"
|
Wscript.StdOut.WriteLine "<module>"
|
||||||
Wscript.StdOut.WriteLine " <name><![CDATA[Memory_Used]]></name>"
|
Wscript.StdOut.WriteLine " <name><![CDATA[Memory_Used]]></name>"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user