Top 3 processes consuming CPU

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
linearstack
Posts: 26
Joined: Tue Nov 07, 2017 7:35 pm

Top 3 processes consuming CPU

Post by linearstack »

How can we get the information of Top 3 Processes consuming CPU using wmi and snmp in NagiosXI??

Can we use any plugin or shell script to get this information?
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Top 3 processes consuming CPU

Post by cdienger »

I'm not certain about snmp or vmi, but here is a powershell script:

https://exchange.nagios.org/directory/P ... 29/details

I think it will need to be slightly modified on line 33 to return top three:

Code: Select all

	$cpuhog = (get-process -computername $servername | sort-object CPU -descending | select-object -first 3)
and a shell script:

https://exchange.nagios.org/directory/P ... es/details

again needing a slight modification on line 201:

Code: Select all

COMMAND=`UNIX95= ps -e -o pcpu,comm,pid | sort -n -r | grep -v "%CPU" | head -3`
and 205:

TOPFIVE="Top 3 CPU Processes(cpu%,pname,pid):" ;
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
linearstack
Posts: 26
Joined: Tue Nov 07, 2017 7:35 pm

Re: Top 3 processes consuming CPU

Post by linearstack »

Will this work as a plugin?

let's suppose, I save this script in Nagios host. Can we set some parameters using nagios GUI interface in a way that whenever we receive a Warning/Critical alert, this script will flick another alert stating the top5 processes consuming memory/ CPU.
????
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Top 3 processes consuming CPU

Post by lmiltchev »

Are you trying to monitor the "top 3" most CPU intensive processes on a remote machine (Windows, Linux, etc.) or on the Nagios XI server itself? Can you clarify?

With any 3rd party plugin (that is not included in XI by default), the process would be the same:

1. Test the plugin from the command line to make sure it works as expected
2.Define a command in Nagios XI
3. Add a service
4. Verify your service is working

For more information please review our official documentation on managing plugins in Nagios XI here:

https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked