I’m creating a Dashboard that monitors 30 servers.
in this, i have a page that shows an overview for all the servers.
So this page will have 30 monitors, 1 per server.
So when i open this page it starts to collect data for all 30 servers at the same time.
but when i navigate to another page, that page with the 30 monitors still continue to collect the data.
i just want it to work when im in that page, and when i navigate out, it should stop.
is there a way to achieve this ?
Hmmm it shouldn’t be continuing to run those monitors as the components should be unmounted. Kind of sounds like a bug. Can you post some script with what you are doing?
Thank you responding.
so for example, i have this “Overview” page broken into Tabs, and each tab does its own thing.
The “Ram” tab has 30 UDMonitors to monitor the ram of 30 servers.
and below is the code.
$ServerList has the names of the servers taken from a text file, and by using a ForEach Loop the UDMonitor is duplicated 30 times and refreshes every 5 seconds as per the default setting.
so when i visit this tab, the monitors start to work all together, but when i move to another tab or another page from the navigation bar, it still continues as i can see the traffic from the Task Manager.
and only stop when i stop the Dashboard.
New-UDTab -Text 'RAM' -Content {
New-UDLayout -Columns 2 -Content {
foreach($serverRam in $ServerList){
$memTitle = $server + " - Memory (% in use)"
New-UdMonitor -Title $memTitle -Type Line -DataPointHistory 20 -ChartBackgroundColor '#8028E842' -ChartBorderColor '#FF28E842' -Endpoint {
try {
Get-Counter '\memory\% committed bytes in use' -ComputerName $serverRam -ErrorAction SilentlyContinue | Select-Object -ExpandProperty CounterSamples | Select-Object -ExpandProperty CookedValue | Out-UDMonitorData
}
catch {
0 | Out-UDMonitorData
}
}#end of monitor
}#end of ForEach Loop
}#end of layout
}#end of tab
Ah, ok! What you should do is make sure you have 2.8.2 installed and you can use the -RenderOnActive parameter on New-UDTabContainer to avoid rendering all the tabs at once. They should only pull data when you have them shown.
Thanks a lot for that update. I’ve now updated the module and applied the parameter. But now an issue that was affecting one part of the code seems to be replicated to all sections now.
So what im doing here is getting the server list from a text file.
and iterating the ServerList using a ForEach loop, and within this loop the respective layout is duplicated.
the problem is, the variable $ServerRam only provides the value up to the Title Parameter, but returns Empty/Null when inside the -endpoint.
Previously this happened to only the UDTable, but now seems its happening to UDChart and UDMonitor as well.