What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

How can I raise no alarm for PE009 (wmiprocesssensor) when process is not found?

Votes:

0

Hi,

I want to Monitor a process (especially usage of this process) and I am using wmiprocesssensor for this. This works fine as Long as the process runs. If the process is closed (which is normal) the sensor shouldn't raise an Alarm but continue to use Status OK instead.

Is there any (easy) way to configure this without creating a new custom WMI sensor?

Thanks for your reply

custom custom-sensor pe009 process ticket-duplicated wmi wmiprocesssensor

Created on Apr 8, 2014 1:52:18 PM

Last change on Dec 30, 2015 8:37:47 AM by  Felix Saure [Paessler Support]



Best Answer

Accepted Answer

Votes:

0

Hello there,

As mentioned before, this will be possible with a custom sensor which will allow you to define particular sensor states. You can i.e. use the PowerShell CMDlet

Get-WmiObject win32_process

to monitor the processes of a remote computer. I'll attach a script which will scan a target host for duplicated processes, this should give you a starting point to write your own sensor suiting your needs. Please note that this script comes at it is and we will not offer additional support for it:

# Description: Monitors Windows processes for duplicated entries
# Parameters:
# -Process: The name  you want to check for multiple instances
# -process "chrome.exe" -hostname %host -Username "%windowsdomain\%windowsuser" -Password "%windowspassword"


# Parameter list

param(
    [string]$process = "ProzessName",
    [string]$hostname = "TargetHostName",
    [string]$username = "YourUsername",
    [string]$password = "YourPassword"
)



# Variables
$result=0

# Generate Credentials Object
$SecPasswd  = ConvertTo-SecureString $Password -AsPlainText -Force
$Credentials= New-Object System.Management.Automation.PSCredential ($UserName, $secpasswd)

try{ $Objects = (Get-WmiObject win32_process -ComputerName $($hostname) -Filter "name like '%$($process)%'" | select Commandline | Group-Object commandline) }
catch{
$Objects = (Get-WmiObject win32_process -ComputerName $($hostname) -Credential $($Credentials) -Filter "name like '%$($process)%'" | select Commandline | Group-Object commandline)
}


write-host ($Objects | Measure-Object).Count ":" ($Objects | Measure-Object).Count " instance(s) of the process '$($process)' running"

Best regards, Felix

Created on Dec 30, 2015 8:36:11 AM by  Felix Saure [Paessler Support]

Last change on Nov 13, 2019 9:04:41 AM by  Felix Saure [Paessler Support]



7 Replies

Votes:

0

I'm afraid that isn't possible, sorry. If the process is no longer operational, PRTG will always mark the same as down.

Created on Apr 9, 2014 1:55:20 PM by  Patrick Hutter [Paessler Support] (7,225) 3 3



Votes:

0

It would be ok, if the process is marked as down. But can I adjust the sensor that it won't raise the alarm state by modifying channel attributes?

If I can't use the pre built sensor, will something like this be possible by using a custom sensor?

So want to "exclude" the sensor from my general warning list and use the sensor only for documentation purposes.

best regards

Created on Apr 9, 2014 2:39:18 PM



Votes:

0

Using a custom sensor you could define the state yourself, so yes, that would be possible.

Created on Apr 10, 2014 1:25:11 PM by  Patrick Hutter [Paessler Support] (7,225) 3 3



Votes:

0

I'm looking for this same functionality. I want to mimic everything the wmiprocesssensor does, except not throw an exception when the process is not found.

Created on Dec 29, 2015 8:19:27 PM



Accepted Answer

Votes:

0

Hello there,

As mentioned before, this will be possible with a custom sensor which will allow you to define particular sensor states. You can i.e. use the PowerShell CMDlet

Get-WmiObject win32_process

to monitor the processes of a remote computer. I'll attach a script which will scan a target host for duplicated processes, this should give you a starting point to write your own sensor suiting your needs. Please note that this script comes at it is and we will not offer additional support for it:

# Description: Monitors Windows processes for duplicated entries
# Parameters:
# -Process: The name  you want to check for multiple instances
# -process "chrome.exe" -hostname %host -Username "%windowsdomain\%windowsuser" -Password "%windowspassword"


# Parameter list

param(
    [string]$process = "ProzessName",
    [string]$hostname = "TargetHostName",
    [string]$username = "YourUsername",
    [string]$password = "YourPassword"
)



# Variables
$result=0

# Generate Credentials Object
$SecPasswd  = ConvertTo-SecureString $Password -AsPlainText -Force
$Credentials= New-Object System.Management.Automation.PSCredential ($UserName, $secpasswd)

try{ $Objects = (Get-WmiObject win32_process -ComputerName $($hostname) -Filter "name like '%$($process)%'" | select Commandline | Group-Object commandline) }
catch{
$Objects = (Get-WmiObject win32_process -ComputerName $($hostname) -Credential $($Credentials) -Filter "name like '%$($process)%'" | select Commandline | Group-Object commandline)
}


write-host ($Objects | Measure-Object).Count ":" ($Objects | Measure-Object).Count " instance(s) of the process '$($process)' running"

Best regards, Felix

Created on Dec 30, 2015 8:36:11 AM by  Felix Saure [Paessler Support]

Last change on Nov 13, 2019 9:04:41 AM by  Felix Saure [Paessler Support]



Votes:

1

The PowerShell .count function doesn't always works as expected. When $objects contains a single item, it returns null.

Suggested replacement (last line):

write-host ($Objects | Measure-Object).Count ":" ($Objects | Measure-Object).Count " instance(s) of the process '$($process)' running"

Created on Nov 13, 2019 7:59:01 AM



Votes:

0

Thanks for sharing it Jayvee!


Kind regards,
Felix Saure, Tech Support Team

Created on Nov 13, 2019 9:05:30 AM by  Felix Saure [Paessler Support]




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.