Page 2 of 4

Re: do not enough $ARG$ for my service

Posted: Wed Jul 28, 2021 8:23 pm
by sacom01
hi ben,
first, ncpa version : Agent_version was ['2.2.2']

the picture you send, "I'm able to view more than one line of output in the XI interface." Two lines you see, it was only ONE, you can see the PID and Mem_vms, it same.

"For testing purposes, can you adjust the thresholds so you definitely are returning more than one line? "
--> you can see thresholds in two server are the same but it show very different result.

i'm not clear what you mean in this.

Re: do not enough $ARG$ for my service

Posted: Thu Jul 29, 2021 10:19 am
by benjaminsmith
Hi sacom01,

When I tested this I was not able to notice a difference between running the plugin locally vs using NCPA. Overall the plugin returns an exit code and plugin output that Nagios can process.
the picture you send, "I'm able to view more than one line of output in the XI interface." Two lines you see, it was only ONE, you can see the PID and Mem_vms, it same
I believe this is an issue with the plugin itself and the way it outputs data. Can you provide more specifics are what you would expect to see, my apologies, but I'm not 100% clear on the requirements?

Thanks,
Benjamin

Re: do not enough $ARG$ for my service

Posted: Thu Jul 29, 2021 8:27 pm
by sacom01
"Can you provide more specifics are what you would expect to see, my apologies, but I'm not 100% clear on the requirements?"
--> the issue here is it was not show all alert exist in the server. E.g : when we run on the command, it have 80 process have been alerted. But on the Nagios, it show only one - itself process.

You can see the picture, it will show like that

Re: do not enough $ARG$ for my service

Posted: Fri Jul 30, 2021 1:22 pm
by benjaminsmith
Hi,

If it's returning in the CLI, but not in the GUI, I suspect it's maxing out the database field size. What is the output of the following command:

Code: Select all

echo 'desc nagios_servicechecks;desc nagios_hostchecks;' | mysql -u root -pnagiosxi nagios -t
--Benjamin

Re: do not enough $ARG$ for my service

Posted: Sun Aug 01, 2021 8:40 pm
by sacom01
hi,
"I suspect it's maxing out the database field size" --> i dont think so bro. At least it will show 7-8 rows, it work like that on UAT environment but in production it show just one as you known.

Re: do not enough $ARG$ for my service

Posted: Mon Aug 02, 2021 11:25 am
by benjaminsmith
Hi,

Thanks for posting the query, that looks okay. It looks like what is happening is when running the plugin, NCPA runs as the nagios user account and it can only see the processes for that user account.

If you want to see every process, then the plugin will have to run as sudo. In order to do this, NCPA has to be version 2.1 or higher.
New configuration options - New configuration options available:
run_with_sudo - Comma separated list of plugin names that should be ran through sudo
See:
https://www.nagios.org/ncpa/help/2.2/index.html
https://github.com/NagiosEnterprises/ncpa/issues/304

Try enabling sudo and test this once more. In the ncpa.cfg file on the remote host add the following

Code: Select all

run_with_sudo = /usr/local/ncpa/plugins/check_OSprocess.py
Then add the following to the "/etc/sudoers" file on your remote NCPA agent.

Code: Select all

nagios ALL=(ALL) NOPASSWD:/usr/local/ncpa/plugins/check_OSprocess.py
Be sure to restart the NPCA service after making those changes. If you get any error messages, please post them to the thread.

Code: Select all

systemctl restart  ncpa_listener

Re: do not enough $ARG$ for my service

Posted: Tue Aug 03, 2021 2:55 am
by sacom01
hi,
i tried add sudo for plugin but not effect.
then i tried run on remote server using nagios user but it not work as well :(

Re: do not enough $ARG$ for my service

Posted: Tue Aug 03, 2021 10:56 am
by ssax
What is the output of this command on the remote system (not the XI server)?

Code: Select all

mount | grep hidepid
I didn't need to use sudo on mine, all I had to do was change this in the ncpa.cfg:

Code: Select all

.py = python3 $plugin_name $plugin_args
If you run these commands as root on the remote system, do you see all the pids from other users?

Code: Select all

su - nagios
ps aux

Re: do not enough $ARG$ for my service

Posted: Tue Aug 03, 2021 9:11 pm
by sacom01
hi,
python3 already set for python on ncpa.cfg

Re: do not enough $ARG$ for my service

Posted: Wed Aug 04, 2021 4:45 pm
by benjaminsmith
Hi,

Thanks for checking that. Please open a support ticket for this issue and reference this post when opening a ticket. We'll have to get a remote session set up to take a closer look at the systems as we haven't been able to replicate the issue here.

To open a support ticket:

https://support.nagios.com/tickets/

Thanks,
Benjamin