Monitor and Server Health Group

 View Only
  • 1.  Creating Custom Monitoring metric

    Posted Sep 14, 2011 03:24 PM

    I have a VBScript that finds the % memory in use, but I'm not sure how to create it as a custom metric to monitor?

     

    here is the script:

     

    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" _
        & strComputer & "\root\cimv2")
    Set colSettings = objWMIService.ExecQuery _
        ("Select * from Win32_ComputerSystem")
    For Each objComputer in colSettings
        'Wscript.Echo "Total Physical Memory: " & _
            'objComputer.TotalPhysicalMemory
    dim TotMemByte

    TotMemByte = objComputer.TotalPhysicalMemory

    dim TotMem

    TotMem = TotMemByte / 1048576

    Next

    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" _
        & strComputer & "\root\cimv2")
    Set colSettings = objWMIService.ExecQuery _
        ("Select * from Win32_OperatingSystem")
    For Each objOperatingSystem in colSettings
        'Wscript.Echo "Available Physical Memory: " & _
           'objOperatingSystem.FreePhysicalMemory

    dim FreeMemMeg

    FreeMemMeg = objOperatingSystem.FreePhysicalMemory

    dim FreeMem

    FreeMem = FreeMemMeg / 1024

    Next

    dim c

    c = FreeMem / TotMem * 100
    dim d
    d = round(c)

    dim f

    f = 100 - d

    wscript.echo f & "%"
    wscript.quit

    Any Ideas?



  • 2.  RE: Creating Custom Monitoring metric

    Posted Sep 15, 2011 10:44 AM

    I see you are using WMI calls in your VBS. Even though you can use WMI in Monitor Solution, you may rather use performance counters instead. Your choice really.

    I would start by viewing this video https://www-secure.symantec.com/connect/videos/monitor-solution-7-custom-monitor-pack-disk-space-custom-monitor-packs-made-easy and then change out disk space counters for memory counters.



  • 3.  RE: Creating Custom Monitoring metric

    Posted Sep 15, 2011 05:37 PM

    Hi RufusUCS,

    I agree with MonitorMan that the easiest way to do this is via Performance Counter Metrics unless you have a specific requirement to use WMI.

    Kind Regards,



  • 4.  RE: Creating Custom Monitoring metric

    Posted Sep 16, 2011 12:47 AM

    Hi all,

     

    thanks for the help, managed to get the same result but with a compound key, between the built in perfmon counters like MonitorMan sugested, works for now...

     

    Kind Regards,