Page 1 of 1
Specific Process Monitoring
Posted: Fri Nov 01, 2019 2:52 am
by mindspring
Hi there,
I am trying to monitor a specific program which only shows up when I do a ps -aux
Code: Select all
[root@logapi-hz]# ps -aux | grep art
root 980 0.0 0.3 393240 25804 ? S 09:35 0:00 php /var/www/html/botapi/bot_api/artisan queue:work --sleep=3 --tries=3
So what I want to monitor specifically is the "artisan" process. This doesn't show up with a normal ps -A | grep art.
What would you recommend I use to monitor this process to check if I need to alert when the number of artisan processes drops to below X?
Thanks, appreciate it
Re: Specific Process Monitoring
Posted: Fri Nov 01, 2019 11:24 am
by scottwilkerson
I would suggest the NCPA agent and Wizard built into Nagios XI
Re: Specific Process Monitoring
Posted: Sat Nov 02, 2019 8:09 am
by mindspring
Thanks, it looks like this is almost what I would require. I see the attached option but how would I reverse it so that it warns me when process dip below a certain number?
Thanks
Re: Specific Process Monitoring
Posted: Sat Nov 02, 2019 8:17 am
by mindspring
I also seem to get this error when running from the command line:
Code: Select all
[root]@cloudnagios ~] $ /usr/local/nagios/libexec/check_ncpa.py -H xxxxx -t 'xxxxx' -P 5693 -M 'process/artisan/count' -w 50 -c 10
UNKNOWN: The node (process) requested does not exist. You may be trying to access the 'processes' node.
Re: Specific Process Monitoring
Posted: Mon Nov 04, 2019 7:26 am
by scottwilkerson
mindspring wrote:Thanks, it looks like this is almost what I would require. I see the attached option but how would I reverse it so that it warns me when process dip below a certain number?
Enter the number followed by a colon
for example, the following would alert if there was less than 2 processes
mindspring wrote:I also seem to get this error when running from the command line:
Code: Select all
[root]@cloudnagios ~] $ /usr/local/nagios/libexec/check_ncpa.py -H xxxxx -t 'xxxxx' -P 5693 -M 'process/artisan/count' -w 50 -c 10
UNKNOWN: The node (process) requested does not exist. You may be trying to access the 'processes' node.
Try
Code: Select all
[root]@cloudnagios ~] $ /usr/local/nagios/libexec/check_ncpa.py -H xxxxx -t 'xxxxx' -M 'processes' -w 50: -c 10: -q 'name=artisan'
Re: Specific Process Monitoring
Posted: Tue Nov 05, 2019 7:05 am
by mindspring
Brilliant, thank you so much. This works, the only issue I have is that it doesn't seem to reflect what the ps -aux command shows for processes.
It does show what the ps -A command shows. Any ideas on this one?
Code: Select all
[root]@cloudnagios~] $ /usr/local/nagios/libexec/check_ncpa.py -H xxxx -t 'xxxx' -M 'processes' -w 50: -c 10: -q 'name=artisan'
CRITICAL: Process count for processes named queue was 0 | 'process_count'=0;50:;10:;
Works nicely for php
Code: Select all
[root]@cloudnagios~] $ /usr/local/nagios/libexec/check_ncpa.py -H xxxxx -t 'xxxx' -M 'processes' -w 50: -c 10: -q 'name=php'
OK: Process count for processes named php was 72 | 'process_count'=72;50:;10:; 'cpu'=1.6%;;; 'memory'=30.64%;;; 'memory_vms'=30.01GB;;; 'memory_rss'=1.92GB;;;
Processes Matched
PID: Name: Username: Exe: Memory: CPU
-----------------------------------
38748: php: root: 0.46 % (VMS 0.45 GB, RSS 0.03 GB): 0.03 %
43566: php: root: 0.47 % (VMS 0.45 GB, RSS 0.03 GB): 0.05 %
44190: php: root: 0.45 % (VMS 0.45 GB, RSS 0.03 GB): 0.03 %
44317: php: root: 0.46 % (VMS 0.45 GB, RSS 0.03 GB): 0.03 %
44353: php: root: 0.46 % (VMS 0.45 GB, RSS 0.03 GB): 0.03 %
44731: php: root: 0.47 % (VMS 0.45 GB, RSS 0.03 GB): 0.03 %
Thanks
Re: Specific Process Monitoring
Posted: Tue Nov 05, 2019 7:24 am
by scottwilkerson
You may need to change up the command to something like this
Code: Select all
/usr/local/nagios/libexec/check_ncpa.py -H xxxx -t 'xxxx' -M 'processes' -q 'cmd=artisan,match=search'
or
Code: Select all
/usr/local/nagios/libexec/check_ncpa.py -H xxxx -t 'xxxx' -M 'processes' -q 'exe=artisan,match=search'
Re: Specific Process Monitoring
Posted: Mon Nov 11, 2019 4:45 am
by mindspring
Many thanks, this works great!
Re: Specific Process Monitoring
Posted: Mon Nov 11, 2019 8:11 am
by scottwilkerson
mindspring wrote:Many thanks, this works great!
Great!
Locking thread