NagiosEnterprises / ncpa

Nagios Cross-Platform Agent
Other
176 stars 95 forks source link

Disabling passive functionality in NCPA Version 3.0.0 not possible -> Linux #1058

Closed Meloknight89 closed 7 months ago

Meloknight89 commented 7 months ago

Hello,

I'm reaching out to report an issue I've encountered with the NCPA Version 3.0.0. According to the change log for this version, there should be a new configuration option that allows users to enable only "Listener" or "Passive" functionality. This feature was supposedly added by a contributor, PhreditorNG.

However, upon reviewing the configuration file, I've noticed that there is no directive or option available to disable the passive functionality. This is contrary to what is described in the change log.

Could you please provide guidance or a fix on how to disable the passive functionality in version 3.0.0 as described in the change log?

Thank you for your attention to this issue.

pittagurneyi commented 7 months ago

What you are searching for seems to be this here:

https://github.com/NagiosEnterprises/ncpa/blob/master/agent/ncpa.py#L968C1-L976C22

If I read this right, then there are two new config options:

I haven't tested it yet, but it would seem like you'd need to set either of them to true for it to work.

Also it is not documented anywhere as far as I can see.

Meloknight89 commented 7 months ago

Hi pittagurneyi,

Thanks for your reply and hint. I've forgot to mention before, that i'm using NCPA in a Linux environment.

Ok, but this would require to build or recompile the NCPA binary or not?

pittagurneyi commented 7 months ago

Hi, no that is in the current build it seems. Here is the link to the 3.0.0 source code: https://github.com/NagiosEnterprises/ncpa/blob/v3.0.0/agent/ncpa.py#L968

EDIT: So just add it to the configuration file and take a look at the running processes I'd guess?

It seems that it is invoked only via command-line options:

https://github.com/NagiosEnterprises/ncpa/blob/v3.0.0/agent/ncpa.py#L1019

    parser.add_argument('-l', '--listener-only', action='store_true', default=False,
                        help='start listener without passive (if --passive-only is not selected)')

    parser.add_argument('-p', '--passive-only', action='store_true', default=False,
                        help='start passive without listener (if --listener-only is not selected)')

So you'd need to modify the systemd service file or whatever you use to start ncpa.

For example:

# Assuming it is located there ...
cp /lib/systemd/system/ncpa.service /etc/systemd/system/ncpa.service
# Replace
#   ncpa -n
# with
#   ncpa -n -l
# or
#   ncpa -n -p
#  depending on what you want.
vim /etc/systemd/system/ncpa.service

See https://github.com/NagiosEnterprises/ncpa/blob/v3.0.0/startup/default-service#L7C1-L7C28 .

I don't have time to look at it as I'm handling the updates because of the ZFS data corruption problem at the moment.

Meloknight89 commented 7 months ago

pittagurneyi,

Now i got it and it works like a charm. Many thanks for your assistance!