How to run check_ncpa.py as a plug-in through NCPA server

268 Views Asked by At

I have a pair of servers each running NCPA. One is publicly accessible and the other is hidden behind the other one.

Let's call them outer.example.com and inner.example.com where inner.example.com is 10.0.0.1.

From the public internet, I'd like to be able to ask inner.example.com e.g. how much memory is in use. Doing that on the outer server is easy:

$ check_ncpa.py -H outer.example.com -t mytoken -M memory/virtual
OK: Memory usage was 59.40 % (Available: 3.06 GiB, blah blah blah

Using the outer server to get to the inner server using check_ncpa.py as a plugin within the NCPA server should be possible using something like this:

$ check_ncpa.py -H outer.example.com -t mytoken -M 'plugins/check_ncpa.py/-H/10.0.0.1/-t/mytoken/-M/memory/virtual'

But I get this response instead:

UNKNOWN: Unable to run check on node without check method. Requested 'memory' node.

Aha! Since / is used as a parameter delimiter, that must be the problem. So I url-encode the slash:

check_ncpa.py -H 10.0.0.1 -t mytoken -M 'plugins/check_ncpa.py/-H/10.0.0.1/-t/mytoken/-M/memory%2fvirtual'
UNKNOWN: The node (memory%2fvirtual) requested does not exist. You may be trying to access the 'memory' node.

☹️

Okay, it looks like we can use the -a switch to pass parameters instead of using path segments. This is more actually more readable and, in my opinion, preferable:

$ check_ncpa.py -H outer.example.com -t mytoken -M 'plugins/check_ncpa.py' -a '-H 10.0.0.1 -t mytoken -M memory/virtual'
UNKNOWN: Unable to run check on node without check method. Requested 'memory' node.

☹️☹️

Do I really have to write my own plug-in (on outer.example.com) to call NCPA-through-NCPA because pretty much every single metric in NCPA requires the use of a slash. Is this a bug in check_ncpa/py, the NCPA server, or am I just doing it wrong?

UPDATE 2023-09-27

I filed a bug report with NCPA about this and it looks like it's something that ought to be supported but isn't quite supported at the moment.

0

There are 0 best solutions below