NCPA - Run Check Command fails in GUI

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
jstormshak
Posts: 27
Joined: Mon May 04, 2020 11:41 am

NCPA - Run Check Command fails in GUI

Post by jstormshak »

When defining new Service Templates in the GUI, the option to "run check command" button is clicked and the check command fails with the following error. However, when pasting the EXACT same command line into the OS bash shell cmd-line, it works flawless and is successful. What is happening and Why? I've even tried to escape certain special chars but to no avail. See details below.

GUI Executed:
Check command: "check_xi_ncpa"
$USER1$/check_ncpa.py -H $HOSTADDRESS$ $ARG1$
$ARGS1$ = -t pass -P 5666 -M 'disk/logical/|var' --units G -w 90 -c 95

GUI-Run Check Command button executed:
[[email protected] ~]$ /usr/local/nagios/libexec/check_ncpa.py -H ch-nagios-p02 -t pass -P 5666 -M 'disk/logical/|var' --units G -w 90 -c 95
UNKNOWN: The node (\/var) requested does not exist. You may be trying to access the '/' node.

Same above command executed in OS BASH Shell:
Cmd-line: (Same host):
[root@li-nagios-p01 etc]# /usr/local/nagios/libexec/check_ncpa.py -H ch-nagios-p02 -t pass -P 5666 -M 'disk/logical/|var' --units G -w 90 -c 95
OK: Used disk space was 8.40 % (Used: 1.34 GB, Free: 14.56 GB, Total: 16.78 GB) | 'used'=1.34GB;15;16; 'free'=14.56GB;15;16; 'total'=16.78GB;15;16;

SYSTEM DETAILS:
Host where command is being defined and executed: RHEL 7.8
# rpm -qa ncpa
ncpa-2.2.2-1.el7.x86_64
# rpm -qa nagiosxi
nagiosxi-5.7.2-2.el7.x86_64

Destination Nagios XI: RHEL 7.8
# rpm -qa ncpa
ncpa-2.2.2-1.el7.x86_64
# rpm -qa nagiosxi
nagiosxi-5.7.2-2.el7.x86_64

# rpm -qi nagiosxi-nagiosplugins-5.7.2-2.el7.x86_64
Name : nagiosxi-nagiosplugins
Version : 5.7.2
Release : 2.el7
Architecture: x86_64
Install Date: Tue 28 Jul 2020 02:22:16 PM CDT
Group : Applications/System
Size : 10342254
License : Nagios Software License
Signature : RSA/SHA1, Thu 16 Jul 2020 04:58:32 PM CDT, Key ID 67a75c9bc62934a0
Source RPM : nagiosxi-5.7.2-2.el7.src.rpm
Build Date : Thu 16 Jul 2020 04:57:11 PM CDT
Build Host : localhost
Relocations : (not relocatable)
Vendor : Nagios Enterprises (http://www.nagios.com)
URL : http://www.nagios.com/
Summary : Base Nagios Plugins Package
Description :
Nagios XI specific Nagios Plugins Package

# ls -ltr /usr/local/nagios/libexec/check_ncpa.py
-rwxrwxr-x. 1 apache nagios 11845 Jul 28 14:24 /usr/local/nagios/libexec/check_ncpa.py
jstormshak
Posts: 27
Joined: Mon May 04, 2020 11:41 am

Re: NCPA - Run Check Command fails in GUI

Post by jstormshak »

On one other system, I used to monitor, I used the NCPA Wizard and noticed that it has a different reference its CCM written cfg file. I'm curious on how those NCPA checks works (NCPA wizard created) while the manual hand-crafted ones as listed in this post do not with that specific error message when executed in the GUI. For example, here's one that the wizard did.

In my manual service creation, it show "check_ncpa" while the wizard show "check_xi_ncpa" (below). Could that difference be causing the difference not to execute in the gui when testing the execution of the check commnd?

define service {
host_name linux_server_name
service_description Disk Usage on /
use xiwizard_ncpa_service
check_command check_xi_ncpa!-t 'pass' -P 5666 -M 'disk/logical/|' -w '70' -c '90'
max_check_attempts 5
check_interval 5
retry_interval 1
check_period xi_timeperiod_24x7
notification_interval 60
notification_period xi_timeperiod_24x7
contacts nagiosadmin
contact_groups admins
_xiwizard ncpa
register 1
}
User avatar
jbrunkow
Posts: 441
Joined: Fri Mar 13, 2020 10:45 am

Re: NCPA - Run Check Command fails in GUI

Post by jbrunkow »

It may not work as a test because of the way that the macros are being handled or the way a certain character from the password is being parsed. You could use an escape character before that character to get the test to work, but if it works in the command line, it should work in production.

That's odd it didn't write the /var part. Was the configuration file written like that on your old or new server?

You might want to rewrite your configuration files, just to see if it corrects the issue. Just navigate to Configure using the top bar of XI > click Core Config Manager under Advanced Configuration on the left pane > then click Config File Management under Tools > and perform the following steps on that page...
  1. 1. Click Delete Files. (Don't worry, they are easy to recreate.)
  • 2. Click Write Configs.
  • 3. Click Verify Files. If any errors are raised at this point, try to resolve them and then repeat steps one through three until they are cleared.
  • 4. Click Restart Nagios Core to apply the changes.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
jstormshak
Posts: 27
Joined: Mon May 04, 2020 11:41 am

Re: NCPA - Run Check Command fails in GUI

Post by jstormshak »

First, thanks for the response. As for the old to new, the migration from core to XI contains our current monitored hosts that are all using NRPE and just a couple are using NCPA. During this implementation, all hosts will use NCPA. I'm getting the cfg files into the CCM XI using the "import" process. In other words, these came in as "check_ncpa" in the original cfg file. I took one host and just used the NCPA wizard and that was where I noticed the "check_xi_ncpa" and tried that against the other host. Same results.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: NCPA - Run Check Command fails in GUI

Post by lmiltchev »

Testing commands from the GUI (CCM) may sometimes fail because of escaping issues. It is not meant to be a substitute for testing from the command line. It is placed in the CCM for convenience. It works in the majority of the cases, but not always. As long as your check works (shows the expected output when forcing an immediate check in the GUI), you should be fine.

The wizard uses the "check_xi_ncpa" command, but this is the same as using "check_ncpa". As you can see from the command definition, it uses the "check_ncpa.py" plugin.

Code: Select all

define command {
    command_name    check_xi_ncpa
    command_line    $USER1$/check_ncpa.py -H $HOSTADDRESS$ $ARG1$
}
So, the question is - what is the actual problem that you are having. Are you concerned about the failed test commands under the CCM (testing in the GUI), not being able to import configs or NCPA wizard not working for you? Please describe your issue in details.

Feel free to post any logs, output, and screenshots that might help us with the troubleshooting. Thanks!
Be sure to check out our Knowledgebase for helpful articles and solutions!
nmatsunaga
Posts: 6
Joined: Fri Feb 24, 2017 8:55 am

Re: NCPA - Run Check Command fails in GUI

Post by nmatsunaga »

I have the same issue since upgrading to 5.7.2 from 5.6.3
On older version it was working because there was no "over" escaping

Code: Select all

[nagios@nagiosxi libexec]$ /usr/local/nagios/libexec/check_ncpa.py -H 1.1.1.1 -t 'password' -P 5693 -M 'disk/logical/|' -w '70' -c '90'
OK: Used disk space was 34.90 % (Used: 3.19 GiB, Free: 5.96 GiB, Total: 9.66 GiB) | 'used'=3.19GiB;7;9; 'free'=5.96GiB;7;9; 'total'=9.66GiB;7;9;
I can replicate manually by escaping the pipe (|)

Code: Select all

[nagios@nagiosxi libexec]$ /usr/local/nagios/libexec/check_ncpa.py -H 1.1.1.1 -t 'password' -P 5693 -M 'disk/logical/\|' -w '70' -c '90'
UNKNOWN: The node (\/) requested does not exist. You may be trying to access the '/' node.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: NCPA - Run Check Command fails in GUI

Post by lmiltchev »

Most likely, the changes we made when fixing some security issues had an impact on the testing commands under the CCM. Our developers are aware of the problem, and we have an internal bug report filed on the issue (task ID = 15167). Thanks!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked