Monitoring a service or process

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
lmeek
Posts: 6
Joined: Mon Aug 04, 2014 1:54 pm

Monitoring a service or process

Post by lmeek »

I have been asked to monitor a specific third party service
I can monitor the up/down state of the service but im looking for a way to get alerted based on memory/cpu usage.

Im not really sure where to go from here. I guess I should be using wmiPlus? If someone knows of a previously published writeup on the topic I can research it that way.
But my searching hasn't turned up anything useful.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Monitoring a service or process

Post by tmcdonald »

What platform is the service running on? It sounds like Windows based off of your WMI suggestion.
Are you looking to find out how much RAM and CPU that specific service is using?
Former Nagios employee
lmeek
Posts: 6
Joined: Mon Aug 04, 2014 1:54 pm

Re: Monitoring a service or process

Post by lmeek »

Nagios is running on Linux. But my enterprise is all Windows.
I used the preconfigure VM and purchased licensing.

Yes, I would like to be able to monitor CPU/RAM usage for that specific service and get alerted if it goes over a certain threshold.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Monitoring a service or process

Post by Box293 »

A service will be a running executable. Here are some examples:

Code: Select all

/usr/local/nagios/libexec/check_wmi_plus.pl -H 10.25.14.2 -u Administrator -p password -m checkproc -s cpu -a spoolsv%

OK (Sample Period 75 sec) - Found 1 Instance(s) of "spoolsv%" running. CPU_spoolsv(PID=504)=0.0%   |'Process Count'=1; 'Avg Utilisation CPU_spoolsv'=0.0%; 

Code: Select all

/usr/local/nagios/libexec/check_wmi_plus.pl -H 10.25.14.2 -u Administrator -p password -m checkproc -s memory -a spoolsv%

OK - Found 1 Instance(s) of "spoolsv%" running. Total Private Memory=5.617MB, Total Working Set=9.984MB, Total Virtual Memory=0.075GB\nProcesses Found are  spoolsv (PID=504|'Process Count'=1; 'Total Private Memory'=5890048Bytes; 'Total Working Set'=10469376Bytes; 'Total Virtual Memory'=80183296Bytes; 
For a full list of options including how to define warning and critical:

Code: Select all

/usr/local/nagios/libexec/check_wmi_plus.pl --itexthelp
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
lmeek
Posts: 6
Joined: Mon Aug 04, 2014 1:54 pm

Re: Monitoring a service or process

Post by lmeek »

I'm pretty new to Nagios, and Linux environments. So this has been a double whammy for me.
What do I do with those commands?

Here?
Image

I'll gladly read some documentation on how to do these basics I just had a hard time finding it.
jomann
Development Lead
Posts: 611
Joined: Mon Apr 22, 2013 10:06 am
Location: Nagios Enterprises

Re: Monitoring a service or process

Post by jomann »

What you showed is exactly where you need to add to the definition to get it to run what you want. Whatever you change there will only affect the service you're changing it on. Basically take the ending command (the -s and -a) and put it in for whatever windows process you're trying to monitor. You can check to see if your command is running fine by doing the "Test Check Command" and it should show you the command it is running so you can see if everything is getting added to it properly.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
lmeek
Posts: 6
Joined: Mon Aug 04, 2014 1:54 pm

Re: Monitoring a service or process

Post by lmeek »

I'm just not getting it. Would you be so kind as to post an example screenshot?
Ive tried every permutation of these commands in the screenshot above and it doesn't seem to be acknowledging them.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Monitoring a service or process

Post by Box293 »

These two screenshots should clearly explain it.
Selection_092.png
Selection_093.png
You do not have the required permissions to view the files attached to this post.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
lmeek
Posts: 6
Joined: Mon Aug 04, 2014 1:54 pm

Re: Monitoring a service or process

Post by lmeek »

That did it! The memory checker is working like a champ. But im having an issue with the CPU check.
its configured the same so not sure why this is happening.



Image

Error: UNKNOWN - Permission denied when trying to store the state data. Sometimes this happens if you have been testing the plugin from the command line as a different user to the Nagio process user. You will need to change the permissions on the file or remove
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Monitoring a service or process

Post by Box293 »

There are some files in /tmp that get created (probably when tested as root) and the nagios process cannot update them.

cwpss_checkcpu_1025142___.state
cwpss_checkproccpu_1025142_spoolsv__.state

Execute this command at the CLI and it should fix the problem:

Code: Select all

chmod a+rw /tmp/cwp*
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked