Page 1 of 2

Service restart in AIX

Posted: Mon Jun 01, 2020 6:20 am
by keerthi.seetharaman
Hi Team,

Good Day.

I have downloaded the ncpa rpm package and installed the rpm package in AIX server. Version of the AIX server is 7.1 with technology level 05 and service pack 05. After installing RPM package i need to update the config file with community string which i did it .

We need to restart the service ncpa listener on AIX.

Can you please suggest me how to restart the service on the server.

Regards,
Keerthi Prashanth S

Re: Service restart in AIX

Posted: Mon Jun 01, 2020 2:17 pm
by jbrunkow
I believe the command to start NCPA on AIX would look similar to the following.

Code: Select all

/usr/local/ncpa/ncpa_listener --start
But, you may want to look at how other services are initialized on that machine, and model the command after that. This will most likely be an init type command.
managing services on IBM AIX

Do you want to configure the service to start every time the machine boots up, or start it just this once?

Re: Service restart in AIX

Posted: Mon Jun 01, 2020 10:23 pm
by keerthi.seetharaman
We would like to start it only one time because as per the document from Nagios says that once we install the rpm files and make the necessary changes in ncpa.cfg file we need to restart the listener service in order to communicate with Nagios XI and to add the server under monitoring.

Re: Service restart in AIX

Posted: Tue Jun 02, 2020 10:40 am
by jbrunkow
Do you see the listener in that folder?

Code: Select all

cd /usr/local/ncpa/
ls | grep ncpa
If so, run the command to start it from that location.

Code: Select all

/usr/local/ncpa/ncpa_listener --start
If the --start option is not correct, you may be able to see what options are available by opening that file with a text editor.

Code: Select all

vi ncpa_listener
If not, you could search for it.

Code: Select all

sudo find /usr -name ncpa_listener
Then check if it is running.

Code: Select all

ps -ef | grep ncpa

Re: Service restart in AIX

Posted: Wed Jun 03, 2020 1:44 am
by keerthi.seetharaman
Please find the below updates:-
Executed the below command:-

/usr/local/ncpa/ncpa_listener --start

and this is below error that i am facing while executing:-
[abc:root:/usr/local/ncpa:] /usr/local/ncpa/ncpa_listener --start
2020-06-03 09:36:49,428 15990884 ERROR failed to start due to an exception
Traceback (most recent call last):
File "/tmp/test/ncpa/agent/ncpadaemon.py", line 181, in start
File "/tmp/test/ncpa/agent/ncpadaemon.py", line 358, in check_pid_writable
SystemExit: unable to write to pidfile /usr/local/ncpa/var/run/ncpa_listener.pid
unable to write to pidfile /usr/local/ncpa/var/run/ncpa_listener.pid
[abc:root:/usr/local/ncpa:]

1. Permission for /usr/local/ncpa/var/run/ is correctly set to writable.
drwxrwxr-x 2 root nagios 256 Jun 3 09:33 /usr/local/ncpa/var/run/

2. Unable to edit as this is compiled file.
file /usr/local/ncpa/ncpa_listener
/usr/local/ncpa/ncpa_listener: executable (RISC System/6000) or object module

Please suggest what needs to be done.

Re: Service restart in AIX

Posted: Wed Jun 03, 2020 1:13 pm
by jbrunkow
Can you please share the contents of this script? ( either by PM or in the thread )

Code: Select all

/tmp/test/ncpa/agent/ncpadaemon.py
Let's have a look at what line 181 and 358 hold.

That's odd, it looks like you should have write access to that folder. Can you please try running the following commands to correct it anyways?

Code: Select all

chown -R nagios.nagios /usr/local/ncpa/var/run/*
chmod -R go+rw /usr/local/ncpa/var/run/*

Re: Service restart in AIX

Posted: Thu Jun 04, 2020 3:25 am
by keerthi.seetharaman
/tmp/test/ncpa/agent/ncpadaemon.py :- In the tmp folder i am not able to find the test folder and remaining folders.

[abc:root:/:] cd/tmp/test/ncpa/agent/
ksh: cd/tmp/test/ncpa/agent/: not found
[abc:root:/:]

Regarding the permission update:-

chown -R nagios.nagios /usr/local/ncpa/var/run/* :- From this directory till run is executable for which i have ran till the run and after that when checked the folder it is blank.
chmod -R go+rw /usr/local/ncpa/var/run/* :- Same comment as above.

Please suggest what needs to be done.

Re: Service restart in AIX

Posted: Thu Jun 04, 2020 9:51 am
by jbrunkow
I'm sorry I didn't see this sooner, but there is actually a method listed in the NCPA document.

Code: Select all

stopsrc -s ncpa_listener
startsrc -s ncpa_listener
Can you please try running that and let me know if it works?

Re: Service restart in AIX

Posted: Sat Jun 06, 2020 1:41 am
by keerthi.seetharaman
This I have already tried which says the service is started but when checked it reflects as inoperative before raising this case.
Tried stopping the service and statred back but no go.

Re: Service restart in AIX

Posted: Mon Jun 08, 2020 2:27 pm
by ssax
Are you using the ncpa 2.2.1 version from here or what version are you using?

https://www.nagios.org/ncpa/#downloads

What do you have for uid and gid in your ncpa.cfg? The defaults should be:

Code: Select all

uid = nagios
gid = nagios
What is the output of these commands?

Code: Select all

lsuser ALL nagios
lsgroup nagios
Run these commands and send us the full output (you can cut off the errpt to only show the ncpa related ones):

Code: Select all

stopsrc -s ncpa_listener
startsrc -s ncpa_listener
lssrc -s ncpa_listener
errpt
errpt -a