Dashboard to Check if Services Are running

This gives this


Although @BoSen29 beat me to the buzzer this time, I see that neither of you looked at using the MACHINENAME output from get-service :clown_face: so you would of had a massive list of computer services not having a clue to which computer they related too…thats why it took me that little bit longer than @BoSen29 :grin:
I hope both these examples help you complete this dashboard

1 Like

Pfft, the code runs! :slight_smile:
Nice catch doe, good job bro!

Doh beat me to it man…must be a timezone thing :grin:

With that logic, you should’ve beat me by an hour…
Prolly better fiber from Norway to California, #justsayin

1 Like

@BoSen29 bro it’s 8pm see you at 9pm UK still has crappy internet…especially in my shed :smoking: so you had an hour headstart on me…told you it was a timezone thing :slight_smile:

Touché,

Nuff said above, but 20 character limit…

I did going by time zone :slight_smile:

1 Like

Doh… Nice catch! Thank you guys. You are Rockstars!

2 Likes

It’s really worth hanging about on this forum I have learnt so much by the code people are willing to share, and the questions being asked, and how they are answered…for example this just got posted by @wsl2001 who has good skills in the UD area look at this juicy script he kindly uploaded:-

Scroll right to the bottom but it’s there, only really pointing you to this as using the same colouring on the service, but @wsl2001 has also given it steroids so his dashboard here is monitoring lots of things…this is for one computer…however if you piped your computer list into a select list, then sync’d all the components on the page to the UD selection, you could monitor a load more things than just services for a computer.
I did this to monitor all of our severs, which then displays Ironman Software Marketplace - ud-bginfo
for the server I select from the drop down list
Hope this gives you some ideas for some of the cool things you can do with UD. Peace

1 Like

So here is how I am currently monitoring any given server in my environment…please note I used a tabbed menu for this dashboard, and this is ONE of many tabs…

  New-UDTab -Text "Server Info" -Content {
        New-UDLayout -Columns 2 -Content {
            New-UDInput -Title "Select" -Id "card1" -Content {
                New-UDInputField -Type 'select' -Name 'Servers' -Values @("Select Server","Server1","Server2","Server3","Server4")
                          } -Endpoint {
                              param($Servers)
                              $Cache:Loading = $True
                              Set-UDElement -Id 'output' -Content {$Servers}
                              $Session:ServerName = $Servers
                              @("Table1","Chart2","Monitor1","Monitor2","Monitor3","Monitor4","Grid1","Heading","Loading") | Sync-UDElement

                        }
    New-UDElement -Id Loading -Tag div -Endpoint {
        If ( $Cache:Loading -eq $True)
            {
            New-UDCard -Content {
                New-UDHeading -Text 'Loading data background components please wait' -Size 3
                New-UDPreloader -Size medium }
            }
        } -AutoRefresh -RefreshInterval 5
    }

    New-UDRow -Columns {
                    New-UdColumn -Size 6 -AutoRefresh -Endpoint {
                        if (-not($Session:ServerName -eq $null)) {
                    New-UdTable -Id Table1 -Title "Server Information" -Headers @(" ", " ") -Endpoint {
                        Sync-UDElement -Id card1
                        @{
                            'Computer Name'         = "$Session:ServerName"
                            'Operating System'      = (Get-WmiObject Win32_OperatingSystem -ComputerName "$Session:ServerName").Caption
                            'Total Disk Space (C:)' = (Get-WmiObject Win32_LogicalDisk -ComputerName "$Session:ServerName" -Filter "DeviceID = 'C:'").Size / 1GB | ForEach-Object { "$([Math]::Round($_, 2)) GBs " }
                            'Free Disk Space (C:)'  = (Get-WmiObject Win32_LogicalDisk -ComputerName "$Session:ServerName" -Filter "DeviceID = 'C:'").FreeSpace / 1GB | ForEach-Object { "$([Math]::Round($_, 2)) GBs " }
                        }.GetEnumerator() | Out-UDTableData -Property @("Name", "Value")

                    } -AutoRefresh
                }
                }

                   New-UdColumn -Size 6 -AutoRefresh -Endpoint {
                    Sync-UDElement -Id card1
                    if (-not($Session:ServerName -eq $null)) {
                    New-UdChart -Id Chart2 -Title "Disk Space by Drive" -Type Bar -AutoRefresh -RefreshInterval 5 -Endpoint {
                        Get-WmiObject Win32_LogicalDisk -ComputerName "$Session:ServerName" | ForEach-Object {
                            [PSCustomObject]@{ DeviceId = $_.DeviceID;
                                Size                    = [Math]::Round($_.Size / 1GB, 2);
                                FreeSpace               = [Math]::Round($_.FreeSpace / 1GB, 2);
                            } } | Out-UDChartData -LabelProperty "DeviceID" -Dataset @(
                            New-UdChartDataset -DataProperty "Size" -Label "Size" -BackgroundColor "#80962F23" -HoverBackgroundColor "#80962F23"
                            New-UdChartDataset -DataProperty "FreeSpace" -Label "Free Space" -BackgroundColor "#8014558C" -HoverBackgroundColor "#8014558C"
                        )

                    }
                }
                }
            }

    New-UdRow {
                New-UdColumn -Size 6 -AutoRefresh -Endpoint {
                    Sync-UDElement -Id card1
                    if (-not($Session:ServerName -eq $null)) {
                    New-UdMonitor -Id Monitor1 -Title "CPU (% processor time)" -Type Line -DataPointHistory 20 -RefreshInterval 5 -ChartBackgroundColor '#80FF6B63' -ChartBorderColor '#FFFF6B63'  -Endpoint {
                        try {
                            Get-Counter '\Processor(_Total)\% Processor Time' -ComputerName "$Session:ServerName" -ErrorAction SilentlyContinue | Select-Object -ExpandProperty CounterSamples | Select-Object -ExpandProperty CookedValue | Out-UDMonitorData
                        }
                        catch {
                            0 | Out-UDMonitorData
                        }
                    }
                }
            }
                New-UdColumn -Size 6 -AutoRefresh -Endpoint {
                    Sync-UDElement -Id card1
                    if (-not($Session:ServerName -eq $null)) {
                    New-UdMonitor -Id Monitor2 -Title "Memory (% in use)" -Type Line -DataPointHistory 20 -RefreshInterval 5 -ChartBackgroundColor '#8028E842' -ChartBorderColor '#FF28E842'  -Endpoint {
                        try {
                            Get-Counter '\memory\% committed bytes in use' -ComputerName "$Session:ServerName" -ErrorAction SilentlyContinue | Select-Object -ExpandProperty CounterSamples | Select-Object -ExpandProperty CookedValue | Out-UDMonitorData
                        }
                        catch {
                            0 | Out-UDMonitorData
                        }
                    }
                }
            }

            New-UdRow {
                New-UdColumn -Size 6 -AutoRefresh -Endpoint {
                    Sync-UDElement -Id card1
                    if (-not($Session:ServerName -eq $null)) {
                    New-UdMonitor -Id Monitor3 -Title "Network (IO Read Bytes/sec)" -Type Line -DataPointHistory 20 -RefreshInterval 5 -ChartBackgroundColor '#4392f1' -ChartBorderColor '#3d85dc'  -Endpoint {
                        try {
                            Get-Counter '\Process(_Total)\IO Read Bytes/sec' -ComputerName "$Session:ServerName" -ErrorAction SilentlyContinue | Select-Object -ExpandProperty CounterSamples | Select-Object -ExpandProperty CookedValue | Out-UDMonitorData
                        }
                        catch {
                            0 | Out-UDMonitorData
                        }
                    }
                }
            }
                New-UdColumn -Size 6 -AutoRefresh -Endpoint {
                    Sync-UDElement -Id card1
                    if (-not($Session:ServerName -eq $null)) {
                    New-UdMonitor -Id Monitor4 -Title "Disk (% disk time)" -Type Line -DataPointHistory 20 -RefreshInterval 5 -ChartBackgroundColor '#80E8611D' -ChartBorderColor '#FFE8611D'  -Endpoint {
                        try {
                            Get-Counter '\physicaldisk(_total)\% disk time' -ComputerName "$Session:ServerName" -ErrorAction SilentlyContinue | Select-Object -ExpandProperty CounterSamples | Select-Object -ExpandProperty CookedValue | Out-UDMonitorData
                        }
                        catch {
                            0 | Out-UDMonitorData
                        }

                    }
                }
            }
        }
        }

    New-UDRow {
            New-UDColumn -size 12 -AutoRefresh -Endpoint {
                Sync-UDElement -Id card1
                if ($Session:ServerName -eq $null)
                {New-UDHeading -id Heading -Text "Waiting for selection..."}
                if (-not($Session:ServerName -eq $null)) {
                New-UdGrid -Id Grid1 -Title "Processes" -Headers @("Name", "ID", "Working Set", "MachineName") -Properties @("Name", "Id", "WorkingSet", "MachineName") -AutoRefresh -Endpoint {
                    Get-Process -ComputerName "$Session:ServerName" | Out-UDGridData
                    $Cache:Loading = $False
                        Sync-UDElement -ID Loading

                }
            }

        }
}
}
1 Like

@psDevUK

Hey Adam i was testing your monitoring good above but am running into an issue i hope you have a answer.

the issue is related to -values @(“server1”,“server2”,“server3”) , if i put the the servers names like you did everything works fine but if i tried to pull the servers objects from a variable it wont work and i see err::abort 500 a lot in chrome dev tools.
my servers are located in aws and am pulling the instances names thru powershell and save them in a variable like $servers = (array of objects)

I think this overloaded my machine…personally now I would probably look at using that new-udselector component I did. Maybe could look at re-writing it…?

i see i was just wondering why it wont take objects array vs manually type them.

have you tried forcing your object into an array? [array]$servers I’m sure if it was recognised as an array it should work
I’ve recently used that new-udselector a lot for allowing multiple selection, which I am seeing would work in this scenario, of choosing a various servers which is populated via a CSV, SQL, NET VIEW, what-ever once it is in the list you can easily pass those values selected onto other commands.
Was thinking this would be a handy tool for monitoring remote computers:-


Might have to see if @augustin.ziegler is up for another team-up…?

If I get the time at work tomorrow, I could do with a monitoring tool again, one which won’t kill my computers’ CPU when I run it…so I will try to build something…but added a load more tasks on the gantt chart which I am using to monitor all my tasks, so got a lot on at the moment.

great idea this component looks very nice.

@psDevUK sure lets do it … But will do vacation till mid of next week in Croatia … After that i will be your man … :ok_hand:

1 Like

@augustin.ziegler hope you have a great time in Croatia, I had some spare time on my hands tonight as all my kids went to bed without issues tonight so I managed to put this working example together:-
GaugeChart

This is the code behind the component keeping it consistent with the other google charting components:-

New-UDGaugeChart -Id "GoogleGauge" -Height 200 -Width 480 -Data {
                   New-UDGaugeData -Label "CPU" -Value (Get-WmiObject win32_processor | Measure-Object -property LoadPercentage -Average | Select Average -ExpandProperty Average)
               }
           } -AutoRefresh -RefreshInterval 5

Will do my best to chuck this on the powershell gallery and universaldashboard marketplace over the weekend. You could monitor anything with this gauge chart just need a label and a value to pass to the component via the sub function New-UDGaugeData
@wsl2001 thinking this would be good to get stats back from local and remote computers and seems to work well in UD

1 Like

Thank you man , can you kindly post the component code as well so i can test and optimize if needed.

Sure man no worries, I will create a github repository for this and stick it all on there…close to mid-night now where I am…and I don’t want to turn into a pumpkin :crazy_face: so I need to get to bed soon…I will do a new topic for this so people know a new component is out there as this thread has gone off the original topic a bit and it has given birth to a new component

Cool thanks man i ll let you know if any update is done on code so you can update the version later.