ldoodle
11 months agoAdvisor
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 stat...
- 10 months ago
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}"
}
}