check_ncpa.py for multiple separate process is bugged
check_ncpa.py for multiple separate process is bugged
Hi,
Im trying to use Check_ncpa.py to create a single ncpa process check that checks multiple processes,
https://support.nagios.com/kb/article/p ... _processes
From NCPA agent GUI, Active check sample shows me
./check_ncpa.py -H Server1 -P 5666 -t '<your token>' -M 'processes' -q 'name=crond,name=rsyslogd,combiner=or'
OK: Process count for processes named crond,rsyslogd was 8 | 'process_count'=8;;; 'cpu'=0.02%;;; 'memory'=0.4%;;; 'memory_vms'=2.16GB;;; 'memory_rss'=0.11GB;;;
Processes Matched
PID: Name: Username: Exe: Memory: CPU
-----------------------------------
1998: crond: root: 0.0 % (VMS 0.13 GB, RSS 0.00 GB): 0.00 %
2535: rsyslogd: root: 0.34 % (VMS 0.89 GB, RSS 0.11 GB): 0.02 %
3175: crond: root: 0.01 % (VMS 0.19 GB, RSS 0.00 GB): 0.00 %
3176: crond: root: 0.01 % (VMS 0.19 GB, RSS 0.00 GB): 0.00 %
3178: crond: root: 0.01 % (VMS 0.19 GB, RSS 0.00 GB): 0.00 %
3179: crond: root: 0.01 % (VMS 0.19 GB, RSS 0.00 GB): 0.00 %
3180: crond: root: 0.01 % (VMS 0.19 GB, RSS 0.00 GB): 0.00 %
30688: crond: root: 0.01 % (VMS 0.19 GB, RSS 0.00 GB): 0.00 %
Total Memory: 0.40 % (VMS 2.16 GB, RSS 0.11 GB)
Total CPU: 0.02 %
When executing the same command, the GUI recommends on the Nagios server , it shows only the result of Last service name [rsyslogd]
./check_ncpa.py -H server1 -P 5666 -t '<your token>' -M 'processes' -q 'name=crond,name=rsyslogd,combiner=or'
OK: Process count for processes named rsyslogd was 1 | 'process_count'=1;;; 'cpu'=0.0%;;; 'memory'=0.34%;;; 'memory_vms'=0.89GB;;; 'memory_rss'=0.11GB;;;
Processes Matched
PID: Name: Username: Exe: Memory: CPU
-----------------------------------
2535: rsyslogd: root: 0.34 % (VMS 0.89 GB, RSS 0.11 GB): 0.00 %
Total Memory: 0.34 % (VMS 0.89 GB, RSS 0.11 GB)
Total CPU: 0.00 %
How can i make this query work so i can add a Single NCPA process check that validates 15 of my service
Im trying to use Check_ncpa.py to create a single ncpa process check that checks multiple processes,
https://support.nagios.com/kb/article/p ... _processes
From NCPA agent GUI, Active check sample shows me
./check_ncpa.py -H Server1 -P 5666 -t '<your token>' -M 'processes' -q 'name=crond,name=rsyslogd,combiner=or'
OK: Process count for processes named crond,rsyslogd was 8 | 'process_count'=8;;; 'cpu'=0.02%;;; 'memory'=0.4%;;; 'memory_vms'=2.16GB;;; 'memory_rss'=0.11GB;;;
Processes Matched
PID: Name: Username: Exe: Memory: CPU
-----------------------------------
1998: crond: root: 0.0 % (VMS 0.13 GB, RSS 0.00 GB): 0.00 %
2535: rsyslogd: root: 0.34 % (VMS 0.89 GB, RSS 0.11 GB): 0.02 %
3175: crond: root: 0.01 % (VMS 0.19 GB, RSS 0.00 GB): 0.00 %
3176: crond: root: 0.01 % (VMS 0.19 GB, RSS 0.00 GB): 0.00 %
3178: crond: root: 0.01 % (VMS 0.19 GB, RSS 0.00 GB): 0.00 %
3179: crond: root: 0.01 % (VMS 0.19 GB, RSS 0.00 GB): 0.00 %
3180: crond: root: 0.01 % (VMS 0.19 GB, RSS 0.00 GB): 0.00 %
30688: crond: root: 0.01 % (VMS 0.19 GB, RSS 0.00 GB): 0.00 %
Total Memory: 0.40 % (VMS 2.16 GB, RSS 0.11 GB)
Total CPU: 0.02 %
When executing the same command, the GUI recommends on the Nagios server , it shows only the result of Last service name [rsyslogd]
./check_ncpa.py -H server1 -P 5666 -t '<your token>' -M 'processes' -q 'name=crond,name=rsyslogd,combiner=or'
OK: Process count for processes named rsyslogd was 1 | 'process_count'=1;;; 'cpu'=0.0%;;; 'memory'=0.34%;;; 'memory_vms'=0.89GB;;; 'memory_rss'=0.11GB;;;
Processes Matched
PID: Name: Username: Exe: Memory: CPU
-----------------------------------
2535: rsyslogd: root: 0.34 % (VMS 0.89 GB, RSS 0.11 GB): 0.00 %
Total Memory: 0.34 % (VMS 0.89 GB, RSS 0.11 GB)
Total CPU: 0.00 %
How can i make this query work so i can add a Single NCPA process check that validates 15 of my service
Last edited by Keystone on Mon Aug 19, 2019 2:41 pm, edited 1 time in total.
Re: check_ncpa.py for multiple separate process is bugged
What is the output that you see when you run the following command?
It is possible that nagios does not have the permissions to view the crond process. Do the check work if you change this:
to this:
in the ncpa.cfg and restart the ncpa_listener?
What is the version of the check_ncpa.py plugin and the NCPA agent that you are currently using?
Code: Select all
./check_ncpa.py -H server1 -P 5666 -t 'Str0ngT0k3n' -M 'processes' -q 'name=crond'Code: Select all
uid = nagios
gid = nagiosCode: Select all
uid = root
gid = rootWhat is the version of the check_ncpa.py plugin and the NCPA agent that you are currently using?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: check_ncpa.py for multiple separate process is bugged
its not that nagios cant get crond task , i see this pattern for all services.
From production server, i ran -q 'name=crond,name=rsyslogd,combiner=or' , it only shows the last process , in this case rsyslogd
[svcanagios@prodserver libexec]$ ./check_ncpa.py -H devserver -P 5666 -t '<your token>' -M 'processes' -q 'name=crond,name=rsyslogd,combiner=or' -c 2:2
CRITICAL: Process count for processes named rsyslogd was 1 | 'process_count'=1;;2:2; 'cpu'=0.0%;;; 'memory'=0.68%;;; 'memory_vms'=0.88GB;;; 'memory_rss'=0.11GB;;;
Processes Matched
PID: Name: Username: Exe: Memory: CPU
-----------------------------------
1828: rsyslogd: root: 0.68 % (VMS 0.88 GB, RSS 0.11 GB): 0.00 %
Total Memory: 0.68 % (VMS 0.88 GB, RSS 0.11 GB)
Total CPU: 0.00 %
Now i am reversing the order of my processess, -q 'name=rsyslogd,name=crond,combiner=or' , now it shows only crond
[svcanagios@prodserver libexec]$ ./check_ncpa.py -H devserver -P 5666 -t ''<your token>' -M 'processes' -q 'name=rsyslogd,name=crond,combiner=or' -c 2:2
CRITICAL: Process count for processes named crond was 101 | 'process_count'=101;;2:2; 'cpu'=0.0%;;; 'memory'=2.02%;;; 'memory_vms'=20.14GB;;; 'memory_rss'=0.0GB;;;
Processes Matched
PID: Name: Username: Exe: Memory: CPU
-----------------------------------
2021: crond: root: 0.02 % (VMS 0.14 GB, RSS 0.00 GB): 0.00 %
10559: crond: root: 0.02 % (VMS 0.20 GB, RSS 0.00 GB): 0.00 %
10560: crond: root: 0.02 % (VMS 0.20 GB, RSS 0.00 GB): 0.00 %
10561: crond: root: 0.02 % (VMS 0.20 GB, RSS 0.00 GB): 0.00 %
10562: crond: root: 0.02 % (VMS 0.20 GB, RSS 0.00 GB): 0.00 %
10563: crond: root: 0.02 % (VMS 0.20 GB, RSS 0.00 GB): 0.00 %
10564: crond: root: 0.02 % (VMS 0.20 GB, RSS 0.00 GB): 0.00 %
13669: crond: root: 0.02 % (VMS 0.20 GB, RSS 0.00 GB): 0.00 %
.
.
From production server, i ran -q 'name=crond,name=rsyslogd,combiner=or' , it only shows the last process , in this case rsyslogd
[svcanagios@prodserver libexec]$ ./check_ncpa.py -H devserver -P 5666 -t '<your token>' -M 'processes' -q 'name=crond,name=rsyslogd,combiner=or' -c 2:2
CRITICAL: Process count for processes named rsyslogd was 1 | 'process_count'=1;;2:2; 'cpu'=0.0%;;; 'memory'=0.68%;;; 'memory_vms'=0.88GB;;; 'memory_rss'=0.11GB;;;
Processes Matched
PID: Name: Username: Exe: Memory: CPU
-----------------------------------
1828: rsyslogd: root: 0.68 % (VMS 0.88 GB, RSS 0.11 GB): 0.00 %
Total Memory: 0.68 % (VMS 0.88 GB, RSS 0.11 GB)
Total CPU: 0.00 %
Now i am reversing the order of my processess, -q 'name=rsyslogd,name=crond,combiner=or' , now it shows only crond
[svcanagios@prodserver libexec]$ ./check_ncpa.py -H devserver -P 5666 -t ''<your token>' -M 'processes' -q 'name=rsyslogd,name=crond,combiner=or' -c 2:2
CRITICAL: Process count for processes named crond was 101 | 'process_count'=101;;2:2; 'cpu'=0.0%;;; 'memory'=2.02%;;; 'memory_vms'=20.14GB;;; 'memory_rss'=0.0GB;;;
Processes Matched
PID: Name: Username: Exe: Memory: CPU
-----------------------------------
2021: crond: root: 0.02 % (VMS 0.14 GB, RSS 0.00 GB): 0.00 %
10559: crond: root: 0.02 % (VMS 0.20 GB, RSS 0.00 GB): 0.00 %
10560: crond: root: 0.02 % (VMS 0.20 GB, RSS 0.00 GB): 0.00 %
10561: crond: root: 0.02 % (VMS 0.20 GB, RSS 0.00 GB): 0.00 %
10562: crond: root: 0.02 % (VMS 0.20 GB, RSS 0.00 GB): 0.00 %
10563: crond: root: 0.02 % (VMS 0.20 GB, RSS 0.00 GB): 0.00 %
10564: crond: root: 0.02 % (VMS 0.20 GB, RSS 0.00 GB): 0.00 %
13669: crond: root: 0.02 % (VMS 0.20 GB, RSS 0.00 GB): 0.00 %
.
.
Last edited by Keystone on Mon Aug 19, 2019 2:44 pm, edited 1 time in total.
Re: check_ncpa.py for multiple separate process is bugged
Also i did the same test from my dev nagios and it works fine
[svcanagios@devserver libexec]$ ./check_ncpa.py -H devserver -P 5666 -t '<your token>' -M 'processes' -q 'name=crond,name=rsyslogd,combiner=or'
OK: Process count for processes named crond,rsyslogd was 102 | 'process_count'=102;;; 'cpu'=0.0%;;; 'memory'=2.71%;;; 'memory_vms'=21.02GB;;; 'memory_rss'=0.11GB;;;
Processes Matched
PID: Name: Username: Exe: Memory: CPU
-----------------------------------
1828: rsyslogd: root: 0.69 % (VMS 0.88 GB, RSS 0.11 GB): 0.00 %
2021: crond: root: 0.02 % (VMS 0.14 GB, RSS 0.00 GB): 0.00 %
13669: crond: root: 0.02 % (VMS 0.20 GB, RSS 0.00 GB): 0.00 %
13670: crond: root: 0.02 % (VMS 0.20 GB, RSS 0.00 GB): 0.00 %
13671: crond: root: 0.02 % (VMS 0.20 GB, RSS 0.00 GB): 0.00 %
13676: crond: root: 0.02 % (VMS 0.20 GB, RSS 0.00 GB): 0.00 %
Dev server NCPA
Agent Information
Version 2.1.6
prod server NCPA
Agent Information
Version 2.1.6
in both NCPA cnf file
uid = nagios
gid = nagios
[svcanagios@devserver libexec]$ ./check_ncpa.py -H devserver -P 5666 -t '<your token>' -M 'processes' -q 'name=crond,name=rsyslogd,combiner=or'
OK: Process count for processes named crond,rsyslogd was 102 | 'process_count'=102;;; 'cpu'=0.0%;;; 'memory'=2.71%;;; 'memory_vms'=21.02GB;;; 'memory_rss'=0.11GB;;;
Processes Matched
PID: Name: Username: Exe: Memory: CPU
-----------------------------------
1828: rsyslogd: root: 0.69 % (VMS 0.88 GB, RSS 0.11 GB): 0.00 %
2021: crond: root: 0.02 % (VMS 0.14 GB, RSS 0.00 GB): 0.00 %
13669: crond: root: 0.02 % (VMS 0.20 GB, RSS 0.00 GB): 0.00 %
13670: crond: root: 0.02 % (VMS 0.20 GB, RSS 0.00 GB): 0.00 %
13671: crond: root: 0.02 % (VMS 0.20 GB, RSS 0.00 GB): 0.00 %
13676: crond: root: 0.02 % (VMS 0.20 GB, RSS 0.00 GB): 0.00 %
Dev server NCPA
Agent Information
Version 2.1.6
prod server NCPA
Agent Information
Version 2.1.6
in both NCPA cnf file
uid = nagios
gid = nagios
Last edited by Keystone on Mon Aug 19, 2019 2:48 pm, edited 1 time in total.
Re: check_ncpa.py for multiple separate process is bugged
Found this from Github
https://github.com/NagiosEnterprises/nc ... HANGES.rst
1.1.1
Fixed sending multiple query arguments not being sent to the API
and my prod server is using 1.1.0v of check_ncpa.py
Being still new to Nagios, Can you please let me know, if i can just update the check_ncpa.py from 1.1.0 to the latest 1.1.5 and not fully fully upgrade the agent to 2.1.8
https://github.com/NagiosEnterprises/nc ... HANGES.rst
1.1.1
Fixed sending multiple query arguments not being sent to the API
and my prod server is using 1.1.0v of check_ncpa.py
Being still new to Nagios, Can you please let me know, if i can just update the check_ncpa.py from 1.1.0 to the latest 1.1.5 and not fully fully upgrade the agent to 2.1.8
Re: check_ncpa.py for multiple separate process is bugged
Open a SSH (putty) session to your Nagios XI server, and make a backup of your original check_ncpa.py plugin:
Download the latest plugin:
and copy it over to the libexec directory:
Set the correct permissions:
Try your check again. Is it working now?
Code: Select all
mv /usr/local/nagios/libexec/check_ncpa.py /usr/local/nagios/libexec/check_ncpa.py.backupCode: Select all
cd /tmp
wget https://assets.nagios.com/downloads/ncpa/check_ncpa.tar.gz
tar xvf check_ncpa.tar.gzCode: Select all
cp check_ncpa.py /usr/local/nagios/libexec/Code: Select all
chown apache.nagios /usr/local/nagios/libexec/check_ncpa.py
chmod 775 /usr/local/nagios/libexec/check_ncpa.pyBe sure to check out our Knowledgebase for helpful articles and solutions!
Re: check_ncpa.py for multiple separate process is bugged
Ty for this detailed information,
i am going to do this in one of our lower environment and test it, but before i proceed to Prod, wanted to confirm the below as this plugin is being used to monitor several services and processes in Production.
1) is there any compatibility issue using Version 1.1.5 of check_ncpa.py on 5.4.7 version on Nagios XI
2) will this new version of check_ncpa plugin communicate properly to servers using lower version of NCPA agent [1.8] windows/linux/AIX
3) any issues that might show up for the running checks when we upgrade to version 1.1.5
4) is there any known issue that we need to be aware off for 1.1.5 version?
thanks
i am going to do this in one of our lower environment and test it, but before i proceed to Prod, wanted to confirm the below as this plugin is being used to monitor several services and processes in Production.
1) is there any compatibility issue using Version 1.1.5 of check_ncpa.py on 5.4.7 version on Nagios XI
2) will this new version of check_ncpa plugin communicate properly to servers using lower version of NCPA agent [1.8] windows/linux/AIX
3) any issues that might show up for the running checks when we upgrade to version 1.1.5
4) is there any known issue that we need to be aware off for 1.1.5 version?
thanks
Re: check_ncpa.py for multiple separate process is bugged
No, not that I am aware of.1) is there any compatibility issue using Version 1.1.5 of check_ncpa.py on 5.4.7 version on Nagios XI
It should, but keep in mind that NCPA 1.8 is VERY old. You may or may not experience issues with old checks. It is hard to say. I would recommend that you upgrade your NCPA agents as soon as you get a chance. Every Nagios XI License key is valid for 3 installs - production, test, and backup.2) will this new version of check_ncpa plugin communicate properly to servers using lower version of NCPA agent [1.8] windows/linux/AIX
https://support.nagios.com/kb/article/n ... s-145.html
I would recommend that you test your upgraded plugin and/or agent in a test environment first, before applying it to production.
The new plugin should be backwards compatible, but again, try it on your test server, before using it in production. If the new plugin doesn't work as expected, you can easily revert to using the old one, simply by running:3) any issues that might show up for the running checks when we upgrade to version 1.1.5
Code: Select all
cd /usr/local/nagios/libexec
cp -p check_ncpa.py.backup check_ncpa.pyYou can review all of the NCPA issues here:4) is there any known issue that we need to be aware off for 1.1.5 version?
https://github.com/NagiosEnterprises/ncpa/issues
Here's the changelog for the client (plugin):
https://github.com/NagiosEnterprises/nc ... HANGES.rst
Be sure to check out our Knowledgebase for helpful articles and solutions!