Page 1 of 1

NCAP 2.0.0 installation issues on Linux

Posted: Wed Dec 28, 2016 2:53 pm
by corkyman
1) I tried to install NCPA gent on Linux RHEL 5 system using RPM and received python errors. When my Linux admin investigated them he saw a reliance on a new version of Python that we do not have on our systems.
2) The installation was reworked using YUM and worked fine but there were problems with restarting the services. The following is the output from the ITMS job that installed the agent:

Script errors: Traceback (most recent call last):

Code: Select all

File "/usr/local/lib/python2.7/site-packages/cx_Freeze/initscripts/Console.py", line 27, in <module>
File "ncpa_listener.py", line 83, in <module>
File "/root/ncpa/agent/ncpadaemon.py", line 64, in main
File "/root/ncpa/agent/ncpadaemon.py", line 117, in read_basic_config
File "/root/ncpa/agent/ncpadaemon.py", line 371, in get_uid_gid
KeyError: 'getgrnam(): name not found: nagcmd'
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/cx_Freeze/initscripts/Console.py", line 27, in <module>
File "ncpa_listener.py", line 83, in <module>
File "/root/ncpa/agent/ncpadaemon.py", line 64, in main
File "/root/ncpa/agent/ncpadaemon.py", line 117, in read_basic_config
File "/root/ncpa/agent/ncpadaemon.py", line 371, in get_uid_gid
KeyError: 'getgrnam(): name not found: nagcmd' 
Script:  Installing NCPA Agent for RHEL 6 
Loaded plugins: refresh-packagekit, rhnplugin
This system is receiving updates from RHN Classic or RHN Satellite.
Setting up Local Package Process
Examining /tmp/ncpa-2.0.0.el6.x86_64.rpm: ncpa-2.0.0-1.el6.x86_64
Marking /tmp/ncpa-2.0.0.el6.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package ncpa.x86_64 0:2.0.0-1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
ncpa x86_64 2.0.0-1.el6 /ncpa-2.0.0.el6.x86_64 14 M

Transaction Summary
================================================================================
Install 1 Package(s)

Total size: 14 M
Installed size: 14 M
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction

Installing : ncpa-2.0.0-1.el6.x86_64 1/1 
Starting NCPA Listener: [ OK ]
Starting NCPA Passive: [ OK ]

Verifying : ncpa-2.0.0-1.el6.x86_64 1/1 

Installed:
ncpa.x86_64 0:2.0.0-1.el6 

Complete!
Writing ncpa.cfg...
Stopping NCPA Listener: [FAILED]
Starting NCPA Listener: [FAILED]
Restarting NCPA agent with updated config file...
Setting user rights...
Done. 


The script installs the agent, then copied a new version of ncpa.cfg and restarts the listener and passive services.
3) When I run
/etc/init.d/ncpa_listener status
I get

Code: Select all

File "/usr/local/lib/python2.7/site-packages/cx_Freeze/initscripts/Console.py", line 27, in <module>
File "ncpa_listener.py", line 83, in <module>
File "/root/ncpa/agent/ncpadaemon.py", line 64, in main
File "/root/ncpa/agent/ncpadaemon.py", line 117, in read_basic_config
File "/root/ncpa/agent/ncpadaemon.py", line 371, in get_uid_gid
KeyError: 'getgrnam(): name not found: nagcmd'  
It feels like it is related to the change in 2.0.0 to use a different group name -- nagios vs nagcmd.

Re: NCAP 2.0.0 installation issues on Linux

Posted: Wed Dec 28, 2016 2:59 pm
by avandemore
Does nagcmd exist in /etc/group?

Re: NCAP 2.0.0 installation issues on Linux

Posted: Wed Dec 28, 2016 3:37 pm
by corkyman
No, only nagios.

Re: NCAP 2.0.0 installation issues on Linux

Posted: Wed Dec 28, 2016 3:56 pm
by avandemore
Try this:

Code: Select all

# groupadd nagcmd
# usermod -a -G nagcmd nagios

Re: NCAP 2.0.0 installation issues on Linux

Posted: Wed Dec 28, 2016 4:07 pm
by corkyman
This fixed the problem but I am confused at this point. What went wrong? What happened to this:
•Updated Linux and Mac OS X installs to use nagios group instead of nagcmd group like other Nagios products

Re: NCAP 2.0.0 installation issues on Linux

Posted: Wed Dec 28, 2016 4:42 pm
by avandemore
No idea why you are seeing that and I can't replicate it.

On Cent5, I get a startup error:

Code: Select all

[root@avandemore-centos5 tmp]# rpm -ivh ncpa-2.0.0.el5.x86_64.rpm
Preparing...                ########################################### [100%]
   1:ncpa                   ########################################### [100%]
Starting NCPA Listener: Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/cx_Freeze/initscripts/Console.py", line 27, in <module>
  File "ncpa_listener.py", line 8, in <module>
  File "/root/ncpa/agent/listener/certificate.py", line 2, in <module>
  File "/usr/local/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
  File "/usr/local/lib/python2.7/site-packages/OpenSSL/rand.py", line 12, in <module>
  File "/usr/local/lib/python2.7/site-packages/OpenSSL/_util.py", line 6, in <module>
  File "/usr/local/lib/python2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 14, in <module>
  File "ExtensionLoader_cryptography_hazmat_bindings__openssl.py", line 25, in <module>
  File "ExtensionLoader_cryptography_hazmat_bindings__openssl.py", line 17, in __bootstrap__
ImportError: libffi.so.5: cannot open shared object file: No such file or directory
[FAILED]
Starting NCPA Passive:  [  OK  ]
I installed this RPM: ftp://ftp.pbone.net/mirror/centos.karan ... x86_64.rpm
and it now starts correctly. There is no nagcmd group on this system.

Re: NCAP 2.0.0 installation issues on Linux

Posted: Wed Dec 28, 2016 5:27 pm
by corkyman
So why does creating the nagcmd group fix the ncpa 2.0.0 installation? Something is wrong with this picture. What do I go from here?

Re: NCAP 2.0.0 installation issues on Linux

Posted: Wed Dec 28, 2016 5:31 pm
by jomann
In your ncpa.cfg you have two sections ([listener] and [passive]) that take 'uid' and 'gid' variables, which are the user and group names that the NCPA services should run as. It looks like you have some sort of wrapper on your RPM that is setting them to a default that you have pre-defined? Our default ncpa.cfg file does not have nagcmd in it anymore. Old versions (1.8.1 and below) used to use nagcmd as the group.

As for the CentOS/RHEL 5 issue, you have to run:

Code: Select all

yum install epel-release -y
yum install libffi -y
Since libffi is only in EPEL for CentOS/RHEL 5 for whatever reason and is required to run NCPA.

Re: NCAP 2.0.0 installation issues on Linux

Posted: Thu Dec 29, 2016 9:58 am
by corkyman
Your explanation about uid and gid shed the light on the problem. I know what went wrong now and how to fix it. On Windows I run the install commands with options that let me configure ncpa.cfg file the way I want it. On Linux I don't have this option and have to resort to install, then copying the modified ncpa.cfg and restarting ncpa. I completely forgot to update the ncpa.cfg file that was modified to contain the custom parameters and the old one has the default gid=nagcmd.
Sorry about this user problem and thank you very much for your time. Please close.

Re: NCAP 2.0.0 installation issues on Linux

Posted: Thu Dec 29, 2016 11:27 am
by dwhitfield
corkyman wrote: Sorry about this user problem and thank you very much for your time. Please close.
No problem at all! Sometimes it just takes a fresh set of eyes at a problem.

I'll go ahead and lock this up, but I will leave you with a thought about Linux installs...have you looked at puppet/chef/ansible/etc? We are agnostic on the management issue, but I know for a fact people have used puppet with Nagios Core at the very least. If that's something you'd like more info about, please feel free to open another thread.