I’m working on outputting my server environment’s overall status. I have scripts set up already in PowerShell for this so I copied my already created scripts into the dashboard, but I’m having some issues with getting the data to output.
Code Example:
New-UDGrid -Title “Clustered Services” -Headers @(“Name”, “OwnerNode”, “State”) -Properties @(“Name”, “OwnerNode”, “State”) -AutoRefresh -RefreshInterval 60 -Endpoint {Get-ClusteredResource -Cluster “Cluster Name Here” | Format-Table Name, OwnerNode, State | Out-UDGridData}
Any ideas on how my logic might be wrong? I’m fairly new to dashboard and unsure if maybe the formatting is different compared to what it needs to be.
I would get that “Get-ClusterResource” into a variable, or cached variable, and then select only the objects you want like so:-
indent preformatted text by 4 spaces
New-UDGrid -Headers @(“Vehicle_ID”, “HireCompany”, “Registration”, “Weight”, “Status”, “EngineType”, “Active”, “Round_Name”) -Properties @(“Vehicle_ID”, “HireCompany”, “Registration”, “Weight”, “Status”, “EngineType”, “Active”, “Round_Name”) -DefaultSortColumn “Vehicle_ID” -PageSize 7 -BackgroundColor “#ffffff” -FontColor “#000000” -Endpoint {
$Cache:BrandonVehicles | Select-Object “Vehicle_ID”, “Agreement”, “HireCompany”, “Registration”, “Weight”, “Status”, “EngineType”, “Active”, “Round_Name” | Out-UDGridData} -AutoRefresh -RefreshInterval 10
don’t use format-table…look at my example
I will attempt to use that format instead. I did already try putting it into a variable with no luck. I also tried removing format-table, this was just what i currently have in there. i’ve used format-list, and tried using select-object as well with no luck.
I haven’t tried $cache yet though so I’ll get on that.
Hopefully this will work for you, more information on the cache variable and how to use it can be foundhere:-
https://docs.universaldashboard.io/endpoints/custom-variable-scopes
have you tried something like:-
$data = get-clusteredresource -cluster “cluster name here”
New-UDGrid -ID -Title “Clusters” -headers @(“Name”,“OwnerNode”,“State”) -properties @(“Name”,“OwnerNode”,“State”) -DefaultSortColumn “Name” -EndPoint { $data | select-object “Name”,“OwnerNode”,“State” | Out-UDGridData} -AutoRefresh -RefreshInterval 10
Receiving an error when attempting to use a variable like you just suggested in the last comment.
Minified React error #31
UPDATE $Cache:Computers did not work either.
I’m sorry to hear your still having issues @boysch2000 was hoping those examples would sort it. i have personally never used the Get-ClusteredResource cmlet before. So once I get some free time I will look at putting an example together using this cmdlet. In the mean-time I would suggest having a read of:-
https://docs.universaldashboard.io/components/grids
and getting those examples to work in a dashboard. I am sure once you do you will get the get-clusteredresource working in a grid…or worse comes to worse cheat, out-put it as a CSV then read the CSV into a grid
Thank you very much for your help. If anything else comes to mind please let me know.