NCAP 2.0.0 installation issues on Linux

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
corkyman
Posts: 120
Joined: Wed Jul 13, 2016 12:58 pm

NCAP 2.0.0 installation issues on Linux

Post 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.
Last edited by dwhitfield on Thu Dec 29, 2016 11:28 am, edited 2 times in total.
Reason: marking with green check mark
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: NCAP 2.0.0 installation issues on Linux

Post by avandemore »

Does nagcmd exist in /etc/group?
Previous Nagios employee
corkyman
Posts: 120
Joined: Wed Jul 13, 2016 12:58 pm

Re: NCAP 2.0.0 installation issues on Linux

Post by corkyman »

No, only nagios.
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: NCAP 2.0.0 installation issues on Linux

Post by avandemore »

Try this:

Code: Select all

# groupadd nagcmd
# usermod -a -G nagcmd nagios
Previous Nagios employee
corkyman
Posts: 120
Joined: Wed Jul 13, 2016 12:58 pm

Re: NCAP 2.0.0 installation issues on Linux

Post 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
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: NCAP 2.0.0 installation issues on Linux

Post 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.
Previous Nagios employee
corkyman
Posts: 120
Joined: Wed Jul 13, 2016 12:58 pm

Re: NCAP 2.0.0 installation issues on Linux

Post 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?
jomann
Development Lead
Posts: 611
Joined: Mon Apr 22, 2013 10:06 am
Location: Nagios Enterprises

Re: NCAP 2.0.0 installation issues on Linux

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
corkyman
Posts: 120
Joined: Wed Jul 13, 2016 12:58 pm

Re: NCAP 2.0.0 installation issues on Linux

Post 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.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: NCAP 2.0.0 installation issues on Linux

Post 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.
Locked