Problem: I have create this script -> memory.vbs
Code: Select all
Set objArgs = wscript.Arguments
Computer = objArgs.item(0)
set WMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & Computer & "\root\cimv2")
set memory = WMI.ExecQuery( "Select TotalVisibleMemorySize,FreePhysicalMemory from Win32_OperatingSystem",,48 )
For each counter in memory
totalmemory = counter.TotalVisibleMemorySize
freememory = counter.FreePhysicalMemory
Next
fixedtotalmemory = totalmemory * 1024
fixedfreememory = freememory * 1024
fixedusedmemory = fixedtotalmemory - fixedfreememory
WScript.Echo "totalmemory:" & fixedtotalmemory & " usedmemory:" & fixedusedmemory
Code: Select all
cscript //nologo memory.vbs computername
I have created a new Data Input Method called "Windows - Memory Usage". It's a "Script/Command" and "cscript.exe //nologo <path_cacti>/scripts/memory.vbs <computername>" is in the Input String field. I have created an input field called "computername" with only the Friendly Name field filled in with "PC Name". I have created two output fields, one titled "totalmemory" friendly name "Total Memory" and then "usedmemory" friendly name "Used Memory" to match the results of running the script.
Have I done anything wrong so far? I haven't seen ANYWHERE that I can tell cacti what to plug into the <computername> input field. What else do I need to do, what am I missing? Please help.