MonitoreoPerfmonWindows6 min de lectura

Monitorear recursos del servidor

Monitoreá CPU, RAM, disco y red en Windows Server con Performance Monitor y PowerShell.


Conocer el estado de CPU, RAM y disco de tu VPS Windows te permite detectar problemas antes de que afecten tus servicios.

Task Manager (Administrador de tareas)

Abrilo con Ctrl + Shift + Esc o:

powershell
taskmgr

La pestaña «Rendimiento» muestra CPU, RAM, disco y red en tiempo real.

PowerShell — Información rápida

CPU

powershell
# Uso actual de CPU
Get-Counter '\Processor(_Total)\% Processor Time' -SampleInterval 2 -MaxSamples 5

# Procesos que más CPU usan
Get-Process | Sort-Object CPU -Descending | Select-Object -First 10 Name, CPU, WorkingSet64

RAM

powershell
# Memoria total y disponible
Get-CimInstance Win32_OperatingSystem | Select-Object @{N='Total (GB)';E={[math]::Round($_.TotalVisibleMemorySize/1MB,2)}}, @{N='Libre (GB)';E={[math]::Round($_.FreePhysicalMemory/1MB,2)}}

# Procesos que más RAM usan
Get-Process | Sort-Object WorkingSet64 -Descending | Select-Object -First 10 Name, @{N='RAM (MB)';E={[math]::Round($_.WorkingSet64/1MB,1)}}

Disco

powershell
# Espacio en disco
Get-PSDrive -PSProvider FileSystem | Select-Object Name, @{N='Usado (GB)';E={[math]::Round($_.Used/1GB,2)}}, @{N='Libre (GB)';E={[math]::Round($_.Free/1GB,2)}}

# Carpetas más grandes
Get-ChildItem C:\ -Directory | ForEach-Object { [PSCustomObject]@{Carpeta=$_.Name; 'Tamaño (GB)'=[math]::Round((Get-ChildItem $_.FullName -Recurse -ErrorAction SilentlyContinue | Measure-Object Length -Sum).Sum/1GB,2)} } | Sort-Object 'Tamaño (GB)' -Descending

Performance Monitor (perfmon)

powershell
perfmon

Permite crear contadores personalizados y alertas. Contadores útiles:

  • \Processor(_Total)\% Processor Time
  • \Memory\Available MBytes
  • \PhysicalDisk(_Total)\% Disk Time
  • \Network Interface(*)\Bytes Total/sec

Event Viewer (Visor de eventos)

powershell
eventvwr.msc

Revisá:

  • Windows Logs → System: errores de hardware y servicios
  • Windows Logs → Application: errores de aplicaciones

Desde PowerShell:

powershell
# Últimos 20 errores del sistema
Get-EventLog -LogName System -EntryType Error -Newest 20 | Format-Table TimeGenerated, Source, Message -Wrap

Script de resumen

Creá C:\Scripts\status.ps1:

powershell
Write-Host "=== CPU ===" -ForegroundColor Cyan
(Get-Counter '\Processor(_Total)\% Processor Time').CounterSamples.CookedValue
Write-Host "`n=== RAM ===" -ForegroundColor Cyan
Get-CimInstance Win32_OperatingSystem | Format-Table @{N='Total';E={"$([math]::Round($_.TotalVisibleMemorySize/1MB,1)) GB"}}, @{N='Libre';E={"$([math]::Round($_.FreePhysicalMemory/1MB,1)) GB"}}
Write-Host "=== Disco ===" -ForegroundColor Cyan
Get-PSDrive C | Format-Table @{N='Usado';E={"$([math]::Round($_.Used/1GB,1)) GB"}}, @{N='Libre';E={"$([math]::Round($_.Free/1GB,1)) GB"}}

¿Te resultó útil esta guía?