Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Monitor the performance of individual window service

I have 7 windows services. i want to monitor the performance of the individual services like the processor usage, memory usage etc.

If i use perfmon, it gives for the entire system but not the individual services. Can anyone please suggest how do i monitor the performance of individual services?

like image 694
Sachin Avatar asked Jul 27 '09 08:07

Sachin


People also ask

How do I monitor Windows performance?

To start, hit Windows Key + R and type: perfmon and hit Enter or click OK. From the left pane of the Performance Monitor app, expand Data Collector Sets > System > System Performance. Then right-click on System Performance and click Start. That will kick off the test in Performance Monitor.

How do I monitor a Windows service?

Go to Services and Processes tab. Click on Discover Services and Processes . This will discover the processes & services running in your Windows server. Select the service you wish to monitor and click Add Service and Process .

What does Windows performance monitoring tool do?

The Microsoft Windows Performance Monitor is a tool that administrators can use to examine how programs running on their computers affect the computer's performance. The tool can be used in real time and also be used to collect information in a log to analyze the data at a later time.


2 Answers

Perfmon can monitor individual processes! Just chose process in "Add counters/Performance objects" combo. For "quick" monitoring I have found that Sysinternals (now Microsoft) Process Explorer is easy and nice. Some services give you performance information (available by sockets/files etc) that can be displayed by tools such as MRTG or Cacti.

like image 98
Michał Niklas Avatar answered Oct 06 '22 00:10

Michał Niklas


To check the memory of individual services, you will have to change the service types to "Own Process". This Gist show the complete code. The central idea is trying to change the service type from the least intrusive to the most intrusive way:

$win32Service = Get-CimInstance -ClassName Win32_Service -Filter "Name = '$ServiceName'" -Verbose:$false

if ($win32Service)
{
    if (!(Set-ServiceTypeToOwnProcessByCim $win32Service))
    {
        if (!(Set-ServiceTypeToOwnProcessByWindowsRegistry $win32Service))
        {
            if (Grant-FullControlRightsOnServiceRegistryKeyToCurrentUser $win32Service)
            {
                Set-ServiceTypeToOwnProcessByWindowsRegistry $win32Service | Out-Null
            }
        }
    }
}
else
{
    Write-Warning "[$ServiceName] Service not found"
}

When putting the Set-ServiceTypeToOwnProcess.ps1 and Enable-Privilege.ps1 files in the same folder, you can execute the script like this:

.\Set-ServiceTypeToOwnProcess.ps1 -ServiceName 'Appinfo', 'gpsvc', 'Schedule', 'SENS', 'SessionEnv', 'wuauserv'
like image 33
Rosberg Linhares Avatar answered Oct 05 '22 23:10

Rosberg Linhares