Page 2 of 2

Re: Zombie process monitor using NCPA

Posted: Thu May 13, 2021 12:34 am
by IT-OPS-SYS
Would it be possible for us to run the script as admin/root user instead of nagios user.

Re: Zombie process monitor using NCPA

Posted: Thu May 13, 2021 10:50 am
by vtrac
Hi,
It is NOT recommended that you use "root" for this.

However, inside the "ncpa.cfg" file (on your NCPA remote agent) which defined user and group to run plugins.

Code: Select all

[listener]

#
# User and group to run plugins as (recommended to use nagios:nagios)
# Default: uid = nagios
# Default: gid = nagios
#
# ** Note - The daemon runs as root, but forks a child process when running a plugin
#    that is defined by the user, for security reasons. However, without the main daemon
#    running as root, much of the system information would be missing. This is typical behavior. **
#
# This is for Unix only (Linux, Mac OS X, etc)
#
uid = nagios
gid = nagios

What is the "log_file" path that your file is using?


Best Regards,
Vinh

Re: Zombie process monitor using NCPA

Posted: Fri May 14, 2021 1:03 am
by IT-OPS-SYS
i changed the permission but same issue. uploaded both the plugins for you to review.
log_file = /var/log
Permissions are :

ls -l kern.log
-rw-r----- 1 syslog adm 1185 May 13 22:29 kern.log

Re: Zombie process monitor using NCPA

Posted: Fri May 14, 2021 10:52 am
by vtrac
Hi,
Hope you are having a good day!!

Please change permission for "log_file":

Code: Select all

sudo chmod 644 /var/log/kern.log
Now try again:

Code: Select all

/usr/local/nagios/libexec/check_ncpa.py -H 10.0.60.35 -t 'cFvgpWMXjaZojGlk' -P 5693 -M 'plugins/nfs-error.py'
Best Regards,
Vinh

Re: Zombie process monitor using NCPA

Posted: Mon May 17, 2021 2:18 am
by IT-OPS-SYS
it worked. thanks for your assistance.

how about the script do you want me to make any changes to it .

Re: Zombie process monitor using NCPA

Posted: Mon May 17, 2021 9:47 am
by vtrac
Hi,
Hope you are having a good day!!

Your python script looks fine.

However, if your "log_file" is large, checking each line for a matching string might not be a good solution especially if your log_file does not rotate each night.

So keep an eye on that log_file, don't let it get too big ... :-)

May I close this thread?


Best Regards,
Vinh

Re: Zombie process monitor using NCPA

Posted: Mon May 17, 2021 10:08 am
by IT-OPS-SYS
sure. thanks and have a good one!!!

Re: Zombie process monitor using NCPA

Posted: Mon May 17, 2021 11:15 am
by vtrac
Great!! .... locking thread!! ... :-)