$Cache:WebInstances | ForEach-Object {
$Cache:Server = $_
New-UdColumn -Size 6 -Content {
New-UdMonitor -Title "CPU (% processor time)" -Type Line -DataPointHistory 20 -RefreshInterval 5 -ChartBackgroundColor '#80FF6B63' -ChartBorderColor '#FFFF6B63' -Endpoint {
try {
Get-Counter '\Processor(_Total)\% Processor Time' -ComputerName $Cache:Server -ErrorAction SilentlyContinue | Select-Object -ExpandProperty CounterSamples | Select-Object -ExpandProperty CookedValue | Out-UDMonitorData
}
catch {
0 | Out-UDMonitorData
}
}
}
New-UdColumn -Size 6 -Content {
New-UdMonitor -Title "Memory (% in use)" -Type Line -DataPointHistory 20 -RefreshInterval 5 -ChartBackgroundColor '#8028E842' -ChartBorderColor '#FF28E842' -Endpoint {
try {
Get-Counter '\memory\% committed bytes in use' -ComputerName $Cache:Server -ErrorAction SilentlyContinue | Select-Object -ExpandProperty CounterSamples | Select-Object -ExpandProperty CookedValue | Out-UDMonitorData
}
catch {
0 | Out-UDMonitorData
}
}
}
}
am trying above code but it does not seem to be working, the computer name is always empty any idea why?