Skip to content

Instantly share code, notes, and snippets.

@rchaganti
Last active December 20, 2017 05:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rchaganti/7d8d63b680bad4df384f728bb33b892f to your computer and use it in GitHub Desktop.
Save rchaganti/7d8d63b680bad4df384f728bb33b892f to your computer and use it in GitHub Desktop.
Start-UdDashboard -Content {
New-UdDashboard -Title "Performance Dashboard" -Color '#FF050F7F' -Content {
New-UdRow {
New-UdColumn -Size 6 -Content {
New-UdRow {
New-UdColumn -Size 12 -Content {
New-UdTable -Title "Server Information" -Headers @(" ", " ") -Endpoint {
@{
'Computer Name' = 'NODE01'
'Operating System' = (Get-CimInstance -ComputerName NODE01 -ClassName Win32_OperatingSystem).Caption
'Total Disk Space (C:)' = (Get-CimInstance -ComputerName NODE01 -ClassName Win32_LogicalDisk -Filter "DeviceID='C:'").Size / 1GB | ForEach-Object { "$([Math]::Round($_, 2)) GBs " }
'Free Disk Space (C:)' = (Get-CimInstance -ComputerName NODE01 -ClassName Win32_LogicalDisk -Filter "DeviceID='C:'").FreeSpace / 1GB | ForEach-Object { "$([Math]::Round($_, 2)) GBs " }
}.GetEnumerator() | Out-UDTableData -Property @("Name", "Value")
}
}
}
}
New-UdColumn -Size 6 -Content {
New-UdRow {
New-UdColumn -Size 6 -Content {
New-UdMonitor -Title "CPU (% processor time)" -Type Line -DataPointHistory 20 -RefreshInterval 2 -ChartBackgroundColor '#80FF6B63' -ChartBorderColor '#FFFF6B63' -Endpoint {
try {
Get-Counter -ComputerName NODE01, NODE02 '\Processor(_Total)\% Processor Time' -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 2 -ChartBackgroundColor '#8028E842' -ChartBorderColor '#FF28E842' -Endpoint {
try {
Get-Counter -ComputerName NODE01 '\memory\% committed bytes in use' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty CounterSamples | Select-Object -ExpandProperty CookedValue | Out-UDMonitorData
}
catch {
0 | Out-UDMonitorData
}
}
}
}
New-UdRow {
New-UdColumn -Size 6 -Content {
New-UdMonitor -Title "Network (IO Read Bytes/sec)" -Type Line -DataPointHistory 20 -RefreshInterval 2 -ChartBackgroundColor '#80E8611D' -ChartBorderColor '#FFE8611D' -Endpoint {
try {
Get-Counter -ComputerName NODE01 '\Process(_Total)\IO Read Bytes/sec' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty CounterSamples | Select-Object -ExpandProperty CookedValue | Out-UDMonitorData
}
catch {
0 | Out-UDMonitorData
}
}
}
New-UdColumn -Size 6 -Content {
New-UdMonitor -Title "Disk (% disk time)" -Type Line -DataPointHistory 20 -RefreshInterval 2 -ChartBackgroundColor '#80E8611D' -ChartBorderColor '#FFE8611D' -Endpoint {
try {
Get-Counter -ComputerName NODE01 '\physicaldisk(_total)\% disk time' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty CounterSamples | Select-Object -ExpandProperty CookedValue | Out-UDMonitorData
}
catch {
0 | Out-UDMonitorData
}
}
}
}
}
}
}
} -Port 10002
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment