Forum Discussion

ldoodle's avatar
ldoodle
Icon for Advisor rankAdvisor
3 months ago
Solved

It there a Windows equivalent of 'VMware_vCenter_HostPerformance' DataSource

I’ve had a look but I can’t see one. So before I create one...

In my VMware dashboard I have CPU and mem combined in a single widget (to more closely resemble Windows Task Manager) because both stats are available in this DataSource:

I’d like to do the same for a Windows OS widget but without a DataSource that exposes both CPU and mem we can’t.

Thanks

  • I have been working on a new DataSource for this and I am very nearly there.

    One question I have is what is the best way in Groovy to convert between FILETIME and Epoch/Unix time?

    The SYSTEMUPTIME value from WMI is uint64 FILETIME type, so right now an example machine is 133527726265000000. To keep the widgets consistent with the VMware ones I want to get SYSTEMUPTIME in seconds, then I can use expression ‘<column>/60/60/24’ to get the result in days.

    This is what I have so far, but I feel like there’s a better way - I’m sure I’ve seen in other DataSources some functions for dealing with epoch but I can’t now find those DataSources!

        wmi_query_results.each
    { wmi_query_output ->
    wmi_query_output[0].each {
    key, value ->
    if(key == 'SYSTEMUPTIME') {
    def filetime = value as long
    def epochtime = System.currentTimeMillis()/1000
    def filetimeepoch = (filetime/10000000)-11644473600
    value = Math.round((epochtime-filetimeepoch))
    }
    println "${key}=${value}"
    }

    }

12 Replies