do not enough $ARG$ for my service

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
sacom01
Posts: 194
Joined: Wed Dec 23, 2020 10:15 pm

Re: do not enough $ARG$ for my service

Post by sacom01 »

hi ben,
Thanks for your info. I can open the ticket, but our system is a high security system, offline system and you are unable to remote to the system from outside.
So is there another way to check this issue? do we need open the ticket as well?
Thanks.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: do not enough $ARG$ for my service

Post by ssax »

Try doing this on the remote system:

Code: Select all

mkdir /home/nagios
chown nagios.nagios /home/nagios
chmod 0700 /home/nagios
Then restart the ncpa_listener and try again.
sacom01
Posts: 194
Joined: Wed Dec 23, 2020 10:15 pm

Re: do not enough $ARG$ for my service

Post by sacom01 »

hi ben,
i tried but no luck, nothing changed.
only its process show when run the plugin.
You do not have the required permissions to view the files attached to this post.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: do not enough $ARG$ for my service

Post by ssax »

Add this to your /etc/sudoers:

Code: Select all

nagios ALL=NOPASSWD: /bin/python3 /usr/local/ncpa/plugins/unix_check_OSprocess.py *
Make sure these are set in your ncpa.cfg:

Code: Select all

.py = python3 $plugin_name $plugin_args
run_with_sudo = unix_check_OSprocess.py
Restart the ncpa_listener service:

Code: Select all

systemctl restart ncpa_listener
Then test:

Code: Select all

/usr/local/nagios/libexec/check_ncpa.py -H X.X.X.X -P 5693 -t 'xxxxxx' -P 5693  -M 'plugins/unix_check_OSprocess.py' -q 'args=-wC 1 -cC 2  -wR 10 -cR 20 -wW 10 -cW 20 -wV 150 -cV 200'
That should do it. The sudo was required because the plugin is unable to get this info for the non-nagios services:

Code: Select all

		if(data["io_counters"] == None) :
			continue
sacom01
Posts: 194
Joined: Wed Dec 23, 2020 10:15 pm

Re: do not enough $ARG$ for my service

Post by sacom01 »

hi ssax,
i tried but no luck.
it was not work from both nagios xi and remote server.
You do not have the required permissions to view the files attached to this post.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: do not enough $ARG$ for my service

Post by ssax »

Try removing the /bin from the python3 in the sudoers, I had to do that with mine.

Set your run_with_sudo to this (it's not asking for a full path):

Code: Select all

run_with_sudo = unix_check_OSprocess.py
After both of those changes, restart the ncpa_listener service and test again.
sacom01
Posts: 194
Joined: Wed Dec 23, 2020 10:15 pm

Re: do not enough $ARG$ for my service

Post by sacom01 »

I tried but not effect bro.
You do not have the required permissions to view the files attached to this post.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: do not enough $ARG$ for my service

Post by ssax »

The run_with_sudo one shouldn't be in the /etc/sudoers.

Edit your /etc/sudoers, and add this:

Code: Select all

nagios ALL=NOPASSWD: /usr/bin/python3 /usr/local/ncpa/plugins/unix_check_OSprocess.py
Make sure this line is in your /usr/local/ncpa/etc/ncpa.cfg on the remote system under the [plugin directives] section:

Code: Select all

run_with_sudo = unix_check_OSprocess.py
Make sure you can sudo with it now:

Code: Select all

su - nagios
sudo /usr/bin/python3 /usr/local/ncpa/plugins/unix_check_OSprocess.py
Then restart the ncpa_listener service and test:
- Remove the | wc -l from the command so that I can see the output from the command

Code: Select all

systemctl restart ncpa_listener
sacom01
Posts: 194
Joined: Wed Dec 23, 2020 10:15 pm

Re: do not enough $ARG$ for my service

Post by sacom01 »

hi,
i tried and able to execute the command in remote server now.
But still not work fine from nagios xi using ncpa. How to do run with sudo from nagios xi?
(wc -l just for shortly and count the result)
You do not have the required permissions to view the files attached to this post.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: do not enough $ARG$ for my service

Post by ssax »

Is this in your ncpa.cfg on the remote system? (it needs to be under the [plugin directives], then restart the ncpa_listener service)

Code: Select all

run_with_sudo = unix_check_OSprocess.py
Locked