EDIT: Fixed!
here is a code example, especially under ever refreshing multi input conditions on monitors / charts this might be helpful to reduce CPU usage, under try/catch conditions its possible to define variables
= read out once, use again later
New-UdRow `
{
New-UdColumn -Size 3 -Content `
{
New-UDMonitor -Title "CPU" -Id "CPUMonitor" -ChartBackgroundColor @("#80962F23", "#8014558C") -DataPointHistory 500 -RefreshInterval 1 -ChartBorderColor @("#80962F23", "#8014558C") -Label @("LOAD", "TEMP") -Type Line -EndPoint `
{
Out-UDMonitorData -Data `
@(
try `
{
$CONCREAD = Get-Content -Path C:\logs\data.log -Raw
(((Select-String -InputObject $CONCREAD -Pattern "Ident:'/intelcpu/0/load/0' Value:'(\d+).*'").Matches.Groups[1])).Value
}
catch `
{
0
}
try `
{
(((Select-String -InputObject $CONCREAD -Pattern "Ident:'/intelcpu/0/temperature/0' Value:'(\d+).*'").Matches.Groups[1])).Value
}
catch `
{
0
}
)
}
}
}
Good day everyone, I’ve been testing Powershell Dashboard since today and i’m very impressed what its been capable of so far !
I’d have a question regarding defining and upating variables within endpoints, i came up with something like this so far;
EDIT: OLD CODE REMOVED
TLDR; how can i pass changing content from my logfile to a variable and have POSHUD refresh it each turn the content (endpoint) gets refreshed ?
Thanks in advance for your help, greetings!
Christoph