Ad Widget

Collapse

Calculated field not working for wmi keys

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • johnw230873
    Member
    • Aug 2010
    • 54

    #1

    Calculated field not working for wmi keys

    I'm trying to monitor drives that are SQL cluster, as these drives change their drive letters as they fail over between clusters I'm using a wmi query to monitor them by LogicalName.
    I'm using to items one monitoring the size of the drive and one to monitor free space. I also need to monitor free space by percent.

    Here are the keys for the wmi.get items
    Free space
    wmi.get[root\cimv2,SELECT FreeSpace FROM Win32_LogicalDisk where VolumeName = 'FSSQL01Data']
    Size
    wmi.get[root\cimv2,SELECT SizeFROM Win32_LogicalDisk where VolumeName = 'FSSQL01Data']

    A test Formula I'm using in my calculated item is
    last(wmi.get[root\cimv2,SELECT FreeSpace FROM Win32_LogicalDisk where VolumeName = 'FSSQL01Data'])


    This is just returning a not supported status with cannot evaluate function.

    I think it might be the extra single quotes (') in the wheres statement as this is the only thing that is different.

    Has anyone else been able to run calculated values off wmi.get values?
  • andreas777
    Junior Member
    • Jul 2022
    • 16

    #2
    I have the same problem.
    I want to divide the size with the freespace and multiply it with 100 in order to get the Space allocation in %.

    Are there any updates on that?

    johnw230873
    Were you able to solve this issue?

    Greetings

    Andreas

    Comment

    • andreas777
      Junior Member
      • Jul 2022
      • 16

      #3
      I couldn't solve the problem, but I did a workaround.

      I created an calculated item which substractes the used space from the total space.
      This gives me an item which the free space.

      Then i calculated from the free space item and the total space item the free space in percent.

      It is not the best thing to do ('cause you have to coordinate the check interval of the dependent items), but it works.

      Comment

      • mrportatoes
        Junior Member
        • Mar 2023
        • 6

        #4
        I was looking for a solution for this very problem and Iturns out it was just a syntax error on my part but I wanted to share incase anyone else came looking. You need to put 2 forward slashes "//" in front of the name of the get.wmi key for the expression to work. So in my case:

        100*last(//wmi.get[root\WMI,select FullChargedCapacity from BatteryFullChargedCapacity]) / last(//wmi.get[root\WMI,select DesignedCapacity from BatteryStaticData])

        Comment

        Working...