Zombie process monitor using NCPA

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
IT-OPS-SYS
Posts: 184
Joined: Sun Jan 07, 2018 12:56 pm

Zombie process monitor using NCPA

Post by IT-OPS-SYS »

hi team,

we were able to monitor the zombie process using nrpe : $USER1$/check_procs -s Z -c 1 , but we tried using the ncpa agent in Ubuntu machine host but it did not work.

./check_ncpa.py -H 10.25.13.36 -t 'Str0ngT0k3n' -P 5693 -M processes -s Z -c 1

thanks for the assistance.
User avatar
vtrac
Posts: 903
Joined: Tue Oct 27, 2020 1:35 pm

Re: Zombie process monitor using NCPA

Post by vtrac »

Hi,
How are you doing?

On the remote NCPA machine, copy "check_procs" to the NCPA's plugins folder or use symbolic link instead:

Code: Select all

cp /usr/local/nagios/libexec/check_procs /usr/local/ncpa/plugins/check_procs
chmod 775 /usr/local/ncpa/plugins/check_procs
or

Code: Select all

ln -s /usr/local/nagios/libexec/check_procs /usr/local/ncpa/plugins/check_procs
Now open a command prompt on your XI machine:

Code: Select all

/usr/local/nagios/libexec/check_ncpa.py  -H 10.25.13.36 -t 'Str0ngT0k3n' -M 'plugins/check_procs' -a '-s Z -c 1'

Best Regards,
Vinh
IT-OPS-SYS
Posts: 184
Joined: Sun Jan 07, 2018 12:56 pm

Re: Zombie process monitor using NCPA

Post by IT-OPS-SYS »

i am doing good buddy but since we have NCPA installed on the linux host why do we need to copy the plugins from /usr/local/nagios/libexec/check_procs location to the NCPA location. Ideally while installing the NCPA agent its should place the plugins to the /usr/local/ncpa/plugins/ location.

Do we have another option then this as we have 50+ servers with NCPA where we need to monitor the zombie processes.
User avatar
vtrac
Posts: 903
Joined: Tue Oct 27, 2020 1:35 pm

Re: Zombie process monitor using NCPA

Post by vtrac »

Hi,
Hope you are having a good day.

I'm sorry for the inconvenience, but NCPA was build to only run custom plugins out of the "plugins" folder.

Here's ALL the options available for "check_ncpa.py":
[root@vt-nagiosxi-62 libexec]# ./check_ncpa.py --help

Code: Select all

Usage: check_ncpa.py [options]

Options:
  -h, --help            show this help message and exit
  -H HOSTNAME, --hostname=HOSTNAME
                        The hostname to be connected to.
  -M METRIC, --metric=METRIC
                        The metric to check, this is defined on client system.
                        This would also be the plugin name in the plugins
                        directory. Do not attach arguments to it, use the -a
                        directive for that. DO NOT INCLUDE the api/
                        instruction.
  -P PORT, --port=PORT  Port to use to connect to the client.
  -w WARNING, --warning=WARNING
                        Warning value to be passed for the check.
  -c CRITICAL, --critical=CRITICAL
                        Critical value to be passed for the check.
  -u UNITS, --units=UNITS
                        The unit prefix (k, Ki, M, Mi, G, Gi, T, Ti) for b and
                        B unit types which calculates the value returned.
  -n UNIT, --unit=UNIT  Overrides the unit with whatever unit you define. Does
                        not perform calculations. This changes the unit of
                        measurement only.
  -a ARGUMENTS, --arguments=ARGUMENTS
                        Arguments for the plugin to be run. Not necessary
                        unless you're running a custom plugin. Given in the
                        same as you would call from the command line. Example:
                        -a '-w 10 -c 20 -f /usr/local'
  -t TOKEN, --token=TOKEN
                        The token for connecting.
  -T TIMEOUT, --timeout=TIMEOUT
                        Enforced timeout, will terminate plugins after this
                        amount of seconds. [60]
  -d, --delta           Signals that this check is a delta check and a local
                        state will kept.
  -l, --list            List all values under a given node. Do not perform a
                        check.
  -v, --verbose         Print more verbose error messages.
  -D, --debug           Print LOTS of error messages. Used mostly for
                        debugging.
  -V, --version         Print version number of plugin.
  -q QUERYARGS, --queryargs=QUERYARGS
                        Extra query arguments to pass in the NCPA URL.
  -s, --secure          Require successful certificate verification. Does not
                        work on Python < 2.7.9.
  -p, --performance     Print performance data even when there is none. Will
                        print data matching the return code of this script
As you can see from above outputs, there is NO other option for "check_ncpa.py" to call another executable (module) but only the "-M" option.

Another option is you could try searching for other module(s) on "Nagios Exchange" that might fit your needs.
https://exchange.nagios.org/


Best Regards,
Vinh
IT-OPS-SYS
Posts: 184
Joined: Sun Jan 07, 2018 12:56 pm

Re: Zombie process monitor using NCPA

Post by IT-OPS-SYS »

you mean to say that i have to copy the check_proc module from /usr/local/nagios/libexec/check_procs to all the ncpa/plugin location in order to work this out.
User avatar
vtrac
Posts: 903
Joined: Tue Oct 27, 2020 1:35 pm

Re: Zombie process monitor using NCPA

Post by vtrac »

Sorry, but yes.

Please pick just ONE of your NCPA machine and try it out first .... :-)

Regards,
Vinh
IT-OPS-SYS
Posts: 184
Joined: Sun Jan 07, 2018 12:56 pm

Re: Zombie process monitor using NCPA

Post by IT-OPS-SYS »

i am getting the permission denied error while running my plugin.

when i am copying the plugin to this directory , what should be the permission (755 or 775) and the who should be the owner (root/nagios) to execute this plugin since we are using root to execute these.

/usr/local/nagios/libexec/check_ncpa.py -H 10.0.60.35 -t 'cFvgpWMXjaZojGlk' -P 5693 -M 'plugins/nfs-error.py'
Traceback (most recent call last):
File "/usr/local/ncpa/plugins/nfs-error.py", line 9, in <module>
with open(log_file, 'r') as file:
IOError: [Errno 13] Permission denied: '
User avatar
vtrac
Posts: 903
Joined: Tue Oct 27, 2020 1:35 pm

Re: Zombie process monitor using NCPA

Post by vtrac »

Hi,
How are you doing?
As to setting permission on the script in plugins folder, (755 or 775) chould works. Owner should be "nagios.nagios".

Looks like your issue is not able to open a "log_file" for reading (line 9) of your nfs-error.py.
Please check the permission of the folder where "log_file" reside and its permission.
Make sure folder has (755 or 775) and "log_file" has (644) set.

Here's the error from your last reply:

Code: Select all

File "/usr/local/ncpa/plugins/nfs-error.py", line 9, in <module>
with open(log_file, 'r') as file:
IOError: [Errno 13] Permission denied: '
Best Regards,
Vinh
IT-OPS-SYS
Posts: 184
Joined: Sun Jan 07, 2018 12:56 pm

Re: Zombie process monitor using NCPA

Post by IT-OPS-SYS »

After making the above changes we still see the error "permission denied". i am running plugin on ubuntu machine. Below are the permission for the plugin folder in the host machine which is added to the nagios already.

root@iadoscomp025:/usr/local/ncpa/plugins# ll
total 260
drwxrwxr-x 2 root root 4096 May 11 13:41 ./
drwxr-xr-x 7 root root 4096 May 6 05:48 ../
-rwxrwxr-x 1 root root 248176 May 7 11:03 check_procs*
-rw-r--r-- 1 root root 0 Feb 11 16:25 .keep
-rw-r--r-- 1 nagios nagios 390 May 11 13:15 mount-error.py
-rw-r--r-- 1 nagios nagios 436 May 12 03:37 nfs-error.py
root@iadoscomp025:/usr/local/ncpa/plugins#


Would it be possible for us to run the script as admin/root user instead of nagios user.
User avatar
vtrac
Posts: 903
Joined: Tue Oct 27, 2020 1:35 pm

Re: Zombie process monitor using NCPA

Post by vtrac »

Hi,
Hope you are having a good day!!

Please change permission to "775" for "/usr/local/ncpa/plugins/nfs-error.py".

Also, could you please upload the "nfs-error.py" script here?

The error you are getting is not able to open "log_file" define in your script. What is the path and name of that file?
Please check the permission of that "log_file".


Regards,
Vinh
Locked