New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

300.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


Monitoring and alerting when high CPU and send a report that list top consumers

Votes:

0

Your Vote:

Up

Down

Hi,

I am trying to find a network/server monitoring tool that enables me to do the following:

Windows Server: When CPU goes over x% for more than x seconds, send a report/alert/notifications listing the top x processes at the time of the incident.

Out of the box PRTG does this most of what I want. Awesome.

The remaining requirements is:

In the report/alert:

1) List top processes (culprit) of that prolong high CPU usage. We are developing and testing software. We want to catch misbehaving processes during the deed.

It would be useful if the alert/report would say "CPU is over 80% for 5 minutes at x h:x m:x s, the following are the top processes at the time alert was triggered: .......".

2) List Windows Event Logs (Applications) inside the very same alert/report. Would be nice if we could specify a time period as well but not necessary.

-----

Is this all possible?

Can someone please point me to the right direction. Based on a similar thread, I have set the CPU sensor to run an exe (ps1 script) in certain conditions. What I haven't been able to figure out is how to use the output of the script inside prtg (as text only is fine) to use for alerting/reporting.

Can I have some examples if you don't mind.

Thanks! Senri

alerts cpu-usage event-log notifications processes sensor

Created on Jun 29, 2016 5:27:25 PM by  kusumah (0) 1



2 Replies

Votes:

0

Your Vote:

Up

Down

Try to add this. It will show in the Message field.

$result+="<prtg>`r`n"
$result+="   <text>OUTPUT OF YOUR SCRIPT</text>`r`n"
$result+="</prtg>`r`n"

Created on Jun 30, 2016 1:56:46 PM by  Jeroen Huurman (60) 2 1



Votes:

0

Your Vote:

Up

Down

Hi,

Thanks for the reply.

Just making sure I have this right:

1) I have a CPU Usage sensor with a threshold trigger set to: if CPU is over 80% for 15 seconds send notification. 2) The notification I created is called "CPUOver80", it is set to run an .exe (ps script). The output is something like: "Google Chrome (12%), Google Chrome (0%), Google Chrome (0%)".

If I were to use your suggestions the output will be:

<prtg>
   <text>Google Chrome (12%), Google Chrome (0%), Google Chrome (0%)</text>
</prtg>

This will be sent inside the email sent by the custom notification "CPUOver80"?

Thanks!

The script I'm running with "CPUOver80" notification:

$processes=gwmi Win32_PerfFormattedData_PerfProc_Process | select IDProcess,Name,PercentProcessorTime | where { $_.Name -ne "_Total" -and $_.Name -ne "Idle"} | sort PercentProcessorTime -Descending | select -First 3
$top1=new-object PSObject -Property @{
  name       =$Processes[0].Name
  CPU        =$Processes[0].PercentProcessorTime
  description=(Get-Process -Id $Processes[0].IDProcess).Description
}
$top2=new-object PSObject -Property @{
  name       =$Processes[1].Name
  CPU        =$Processes[1].PercentProcessorTime
  description=(Get-Process -Id $Processes[1].IDProcess).Description
}
$top3=new-object PSObject -Property @{
  name       =$Processes[2].Name
  CPU        =$Processes[2].PercentProcessorTime
  description=(Get-Process -Id $Processes[2].IDProcess).Description
}
$top1cpu=$top1.CPU -as [string]
$top2cpu=$top2.CPU -as [string]
$top3cpu=$top3.CPU -as [string]
if ($top1.description.length -gt 0) {
$top1.name=$top1.description
}
if ($top2.description.length -gt 0) {
$top2.name=$top2.description
}
if ($top3.description.length -gt 0) {
$top3.name=$top3.description
}
$result+="<prtg>`r`n"
$result+="   <text>" + $top1.name+" ("+$top1cpu+"%), "+$top2.name+" ("+$top2cpu+"%), "+$top3.name+" ("+$top3cpu+"%)" + "</text>`r`n"
$result+="</prtg>`r`n"
write-host $result

Created on Jun 30, 2016 4:21:39 PM by  kusumah (0) 1

Last change on Jul 1, 2016 6:50:05 AM by  Torsten Lindner [Paessler Support]



Please log in or register to enter your reply.


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.