Page 1 of 4

ncpa error messages and bugs 1.0/1.1

Posted: Thu Dec 05, 2013 1:37 pm
by kendallchenoweth
I'm using Nagios XI 2012R2.5 on a Centos VM provided by Nagios and have created a NRDS config which passively runs a command on the client server. When running NCPA 1.0 and starting the passive listener process, I get the following error.

Code: Select all

2013-12-05 09:46:17,543 27250 INFO started
2013-12-05 09:46:17,545 27250 INFO Hostname is being assigned as the domain name of this computer.
2013-12-05 09:46:17,546 27250 INFO HOSTNAME was not explicitly declared. Using kchenowe-ubuntu
2013-12-05 09:46:17,546 27250 INFO Hostname is being assigned as the domain name of this computer.
2013-12-05 09:46:17,546 27250 INFO HOSTNAME was not explicitly declared. Using kchenowe-ubuntu
2013-12-05 09:46:17,547 27250 INFO Hostname is being assigned as the domain name of this computer.
2013-12-05 09:46:17,547 27250 INFO HOSTNAME was not explicitly declared. Using kchenowe-ubuntu
2013-12-05 09:46:17,548 27250 ERROR No option 'CONFIG_NAME' in section: 'nrds'
Traceback (most recent call last):
  File "ncpa_posix_passive.py", line 41, in run_all_handlers
  File "/usr/local/ncpa/passive/nrds.py", line 21, in run
    if self.config_update_is_required():
  File "/usr/local/ncpa/passive/nrds.py", line 91, in config_update_is_required
    'configname':   self.config.get('nrds', 'CONFIG_NAME'),
  File "/usr/lib/python2.6/ConfigParser.py", line 541, in get
NoOptionError: No option 'CONFIG_NAME' in section: 'nrds'
This is my ncpa.cfg.

Code: Select all

[passive]
uid = nagios
handlers = nrds
loglevel = info
gid = nagcmd
sleep = 300
logfile = var/ncpa_passive.log
pidfile = var/ncpa_passive.pid

[api]
community_string = mytoken

[plugin directives]
.sh = /bin/sh $plugin_name $plugin_args
.pl = perl $plugin_name $plugin_args
plugin_path = plugins/
.ps1 = powershell -ExecutionPolicy Unrestricted $plugin_name $plugin_args
.vbs = cscript $plugin_name $plugin_args //NoLogo

[listener]
uid = nagios
certificate = adhoc
loglevel = info
ip = 0.0.0.0
gid = nagcmd
logfile = var/ncpa_listener.log
port = 5693
pidfile = var/ncpa_listener.pid

[nrds]
config_version = None
config_name = sample_config
update_plugins = on
config_os = None
update_config = on
token = mytoken
url = https://172.28.154.55/nrdp

[nrdp]
token = mytoken
hostname = kchenowe-ubuntu.dhcp.mycompany.com
parent = https://172.28.154.55/nrdp

[passive checks]
%hostname%|swap usage = /memory/swap/percent --warning 40 --critical 80
%hostname%|cpu usage = /cpu/percent --warning 20 --critical 30
%hostname%|memory usage = /memory/virtual/percent --warning 60 --critical 80

I update the agent to version 1.1 (i386), configured the ncpa agent. I noticed that the ncpa.cfg originally had CONFIG_NAME and CONFIG_VERSION in upper case, but these returned to lower case after I used the URL to configure the client. I still get the error below

Code: Select all

2013-12-05 11:38:47,889 32257 INFO HOSTNAME was not explicitly declared. Using kchenowe-ubuntu
2013-12-05 11:38:47,890 32257 ERROR No option 'CONFIG_NAME' in section: 'nrds'
Traceback (most recent call last):
  File "ncpa_posix_passive.py", line 41, in run_all_handlers
  File "/usr/local/ncpa/passive/nrds.py", line 21, in run
    if self.config_update_is_required():
  File "/usr/local/ncpa/passive/nrds.py", line 91, in config_update_is_required
    'configname':   self.config.get('nrds', 'CONFIG_NAME'),
  File "/usr/lib/python2.6/ConfigParser.py", line 541, in get
NoOptionError: No option 'CONFIG_NAME' in section: 'nrds'
and the api doesn't show up in the HUD for the client https://kchenowe-ubuntu.dhcp.mycompany.com:5693/ when clicking on the Api link in the NCPA interface, I get the following URL and error

https://kchenowe-ubuntu.dhcp.mycompany. ... ot%20exist.

Code: Select all

Web page content
{
  "error": "Referencing node that does not exist."
}
Here is the new ncpa.cfg

Code: Select all

[passive]
uid = nagios
handlers = nrds
loglevel = info
gid = nagcmd
sleep = 300
logfile = var/ncpa_passive.log
pidfile = var/ncpa_passive.pid

[api]
community_string = mytoken

[plugin directives]
.sh = /bin/sh $plugin_name $plugin_args
plugin_path = plugins/
.ps1 = powershell -ExecutionPolicy Unrestricted $plugin_name $plugin_args
pl = perl $plugin_name $plugin_args
.vbs = cscript $plugin_name $plugin_args //NoLogo

[listener]
uid = root
certificate = adhoc
loglevel = info
ip = 0.0.0.0
gid = root
logfile = var/ncpa_listener.log
port = 5693
pidfile = var/ncpa_listener.pid

[nrds]
config_version = None
config_name = sample_config
update_plugins = on
config_os = None
update_config = on
token = mytoken
url = https://172.28.154.55/nrdp/

[nrdp]
token = mytoken
hostname = kchenowe-ubuntu.dhcp.mycompany.com
parent = https://172.28.154.55/nrdp/

[passive checks]
%hostname%|swap usage = /memory/swap/percent --warning 40 --critical 80
%hostname%|cpu usage = /cpu/percent --warning 20 --critical 30
%hostname%|memory usage = /memory/virtual/percent --warning 60 --critical 80

Throughout this exercise, the NRDS configuration is updated (via nrds_updater -h <host>) and those files are unchanged.

Is there a bug in the 1.0 version of the NCPA client regarding the CONFIG_* variables?
Is there a bug in the 1.1 version of the NCPA linux client (running ubuntu 13.10)? (Why would the client config change the case on the CONFIG_* variable keys?
I have the 1.0 client from a previous download, but didn't see it on the internet. Where are both (and future) versions of the NCPA client available on the web?
Should I use NCPA version 1.0 or 1.1?


We are in the process of purchasing Nagios XI. Thank you in advance for your help.

Re: ncpa error messages and bugs 1.0/1.1

Posted: Thu Dec 05, 2013 5:45 pm
by slansing
What NRDS config name are you using in nagios xi for this host? Is it actually "nrds"?

Re: ncpa error messages and bugs 1.0/1.1

Posted: Fri Dec 06, 2013 9:24 am
by kendallchenoweth
I'm using "sample_config". That's what I have listed in the nrds,cfg file as a value for the CONFIG_NAME argument. This worked with ncpa agent version 1.0 but not version 1.1.

Code: Select all

CONFIG_VERSION="3.7"
CONFIG_OS="Linux"
CONFIG_NAME="sample_config"
URL="http://172.28.154.55/nrdp/"
TOKEN="mytoken"
PLUGIN_DIR="/usr/local/ncpa/plugins"
SEND_NRDP="/usr/local/nrdp/clients/send_nrdp.sh"
TMPDIR="/usr/local/nrdp/clients/tmp"
COMMAND_PREFIX=""
LOG_FILE="/usr/local/nrdp/clients/nrds.log"
UPDATE_CONFIG="1"
UPDATE_PLUGINS="1"

command[ncpa-random]=/usr/local/ncpa/plugins/check_ncpa.py -H `hostname -A` -t mytoken  -P 5693 -M  'agent/plugin/random.pl' -w 5 -c 7

Re: ncpa error messages and bugs 1.0/1.1

Posted: Fri Dec 06, 2013 2:46 pm
by slansing
Going back to the API issue for a moment, it almost seems as if your API token for the local ncpa install is incorrect. No back to the nrds issue, you did try using both upper and lower case "CONFIG_NAME" on version 1.1 correct?

Re: ncpa error messages and bugs 1.0/1.1

Posted: Fri Dec 06, 2013 4:24 pm
by kendallchenoweth
The API token is correct, however I don't think the software thinks it is correct, perhaps because of a misidentification of the hostname.

Passive and active check do work. However the ncpa_passive.log is being flooded with...

Code: Select all

ImportError: No module named expat; use SimpleXMLTreeBuilder instead
2013-12-06 16:16:35,887 47698 INFO Hostname is being assigned as the domain name of this computer.
2013-12-06 16:16:35,887 47698 INFO HOSTNAME was not explicitly declared. Using kchenowe-ubuntu
2013-12-06 16:16:35,888 47698 INFO Hostname is being assigned as the domain name of this computer.
2013-12-06 16:16:35,888 47698 INFO HOSTNAME was not explicitly declared. Using kchenowe-ubuntu
2013-12-06 16:16:35,889 47698 INFO Hostname is being assigned as the domain name of this computer.
2013-12-06 16:16:35,889 47698 INFO HOSTNAME was not explicitly declared. Using kchenowe-ubuntu
2013-12-06 16:16:35,892 47698 INFO Starting new HTTPS connection (1): 172.28.154.55
2013-12-06 16:16:35,946 47698 ERROR No module named expat; use SimpleXMLTreeBuilder instead
Traceback (most recent call last):
  File "ncpa_posix_passive.py", line 41, in run_all_handlers
  File "/usr/local/ncpa/passive/nrds.py", line 21, in run
    if self.config_update_is_required():
  File "/usr/local/ncpa/passive/nrds.py", line 99, in config_update_is_required
    response_xml = ET.fromstring(url_request.content)
  File "/usr/lib/python2.6/xml/etree/ElementTree.py", line 962, in XML
  File "/usr/lib/python2.6/xml/etree/ElementTree.py", line 1118, in __init__
ImportError: No module named expat; use SimpleXMLTreeBuilder instead

and the http get to the API subtree on the URL HUD doesn't work as described earlier. The cause for both of them could be hostname resolution.

Code: Select all

nagios@kchenowe-ubuntu:/usr/local/ncpa/plugins$ /usr/local/ncpa/plugins/check_ncpa.py -H `hostname -A` -t mytoken  -P 5693 -M cpu/percent
OK: Percent was 2.0%,4.0%|'percent_0'=2.0% 'percent_1'=4.0%
nagios@kchenowe-ubuntu:/usr/local/ncpa/plugins$ /usr/local/ncpa/plugins/check_ncpa.py -H kchenowe-ubuntu -t mytoken  -P 5693 -M cpu/percent
OK: Percent was 8.9%,7.1%|'percent_0'=8.9% 'percent_1'=7.1%

So my only real problem is that the ncpa_passive.log is spitting out (bogus?) error message out of control and, less important, the HUD on the agent web page doesn't work. (I'm more concerned about the first problem.)

-Kendall Chenoweth

Re: ncpa error messages and bugs 1.0/1.1

Posted: Mon Dec 09, 2013 1:41 pm
by slansing
Looking into this one too. Thank you!

Re: ncpa error messages and bugs 1.0/1.1

Posted: Tue Dec 10, 2013 11:54 am
by nscott
Kendall,

You're absolutely correct, NRDS goes case sensitive in this case, good catch.

I've found a bug that would be causing the API to be dumping bad results on some systems to (ie: the no results for node). I'm working on fixing the release, but I need to do some testing.

Re: ncpa error messages and bugs 1.0/1.1

Posted: Wed Feb 19, 2014 2:13 pm
by kendallchenoweth
I'm just curious what the release schedule is for the bug fix. No rush. Thanks!

-Kendall Chenoweth

Re: ncpa error messages and bugs 1.0/1.1

Posted: Wed Feb 19, 2014 5:18 pm
by slansing
Thank you for bumping this! I think Nick is actually working on building the new release, don't quote me on that since he is out right now, but it should be soon!

Re: ncpa error messages and bugs 1.0/1.1

Posted: Thu May 01, 2014 9:48 am
by questrad
Hello,

Any update on this issue?
Is there any new package of NCPA agent with fix?