Passive check not working giving stale warning

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
tijov05
Posts: 2
Joined: Tue Jan 09, 2018 1:29 am

Re: Passive check not working giving stale warning

Post by tijov05 »

Code: Select all

root@client01:/usr/local/ncpa/etc# ls -l
total 20
-rw-r--r-- 1 nagios nagios 7484 Jan  5 09:32 ncpa.cfg
drwxr-xr-x 2 nagios nagios 4096 Jan  5 10:05 ncpa.cfg.d
-rw-r--r-- 1 nagios nagios 7388 Dec 21 16:15 ncpa.cfg.sample
root@client01:/usr/local/ncpa/etc# cat ncpa.cfg
#
#   NCPA Main Config File
#   ---------------------
#

#
# -------------------------------
# General Configuration
# -------------------------------
#

[general]

#
# Check logging is on by default, you can disable it if you do not want to record
# the check requests that are coming in or checks being sent over NRDP.
# Default: check_logging = 1
#
check_logging = 1

#
# Check logging time - how long in DAYS you'd like to keep checks in the database.
# Default: 30
#
check_logging_time = 30

#
# Excluded file system types removes these fs types from the disk metrics
# (This is mostly only noteable on UNIX systems but also works on Windows if you need it)
# Default: aufs,autofs,binfmt_misc,cifs,cgroup,debugfs,devpts,devtmpfs,encryptfs,
#          efivarfs,fuse,hugelbtfs,mqueue,nfs,overlayfs,proc,pstore,rpc_pipefs,
#          securityfs,smb,sysfs,tmpfs,tracefs
#
exclude_fs_types = aufs,autofs,binfmt_misc,cifs,cgroup,debugfs,devpts,devtmpfs,encryptfs,efivarfs,fuse,hugelbtfs,mqueue                           ,nfs,overlayfs,proc,pstore,rpc_pipefs,securityfs,smb,sysfs,tmpfs,tracefs

#
# The default unit to convert bytes (B) into if no unit is specified
# (Gi = 1024 MiB, G = 1000 MB)
#
default_units = Gi

#
# -------------------------------
# Listener Configuration (daemon)
# -------------------------------
#

[listener]

#
# User and group to run plugins as (recommended to use nagios:nagios)
# Default: uid = nagios
# Default: gid = nagios
#
# ** Note - The daemon runs as root, but forks a child process when running a plugin
#    that is defined by the user, for security reasons. However, without the main daemon
#    running as root, much of the system information would be missing. This is typical behavior. **
#
# This is for Unix only (Linux, Mac OS X, etc)
#
uid = nagios
gid = nagios

#
# IP address and port number for the Listener to use for the web GUI and API
# Default: ip = 0.0.0.0
# Default: port = 5693
#
ip = 0.0.0.0
port = 5693

#
# SSL connection and certificate config (if an SSL option is not available on some older
# operating systems it will default back to TLSv1)
# ssl_version options: TLSv1, TLSv1_1, TLSv1_2
#
ssl_version = TLSv1_2
certificate = adhoc

#
# Listener logging file level, location, and the PID location
# Default: loglevel = info (debug, info, warning, error)
# Default: logfile = var/log/ncpa_listener.log
# Default: pidfile = var/run/ncpa_listener.pid (leave listener in pid file name)
#
loglevel = debug
logfile = var/log/ncpa_listener.log
pidfile = var/run/ncpa_listener.pid

#
# Delay the listener (API & web GUI) from starting in seconds
# Default: 0
#
# delay_start = 30

#
# Allow admin functionality in the web GUI. When this is set to 0, the admin section will not
# be displayed in the header and will not be available to be accessed.
# Default: 1
#
admin_gui_access = 1

#
# Admin password for the admin section in the web GUI, by default there is no admin
# password and the admin section of the GUI can be accessed by anyone if admin_gui_access is set to 1.
# Default: None
#
# Note: Setting this value to 'None' will automatically log you in, setting it empty will allow you to
# log in using a blank password.
#
admin_password = None

#
# Require admin password to access ALL of the web GUI.
# This does not affect API access via token (community_string).
# Default: 0
#
admin_auth_only = 0

#
# -------------------------------
# Listener Configuration (API)
# -------------------------------
#

[api]

#
# The token that will be used to log into the basic web GUI (API browser, graphs, top charts, etc)
# and to authenticate requests to the API and requests through check_ncpa.py
#
community_string = efb46ftdfu74

#
# -------------------------------
# Passive Configuration (daemon)
# -------------------------------
#

[passive]

#
# Handlers are a comma separated list of what you would like the passive agent to run
# Default: None
# Options:
#   nrds, nrdp, kafkaproducer
#
# Example:
# handlers = nrds,nrdp,kafkaproducer
#
handlers = None

#
# User and group to run passive checks as (Recommended to use nagios:nagios)
# Default: uid = nagios
# Default: gid = nagios
#
uid = nagios
gid = nagios

#
# Passive check interval - the amount in seconds to wait between each passive check by default,
# this can be overwritten by adding on a "|<duration>" in seconds to the passive check config
# Default: 300 (5 minutes)
#
sleep = 60

#
# Passive logging file level, location, and the PID location
# Default: loglevel = info (debug, info, warning, error)
# Default: logfile = var/log/ncpa_passive.log
# Default: pidfile = var/run/ncpa_passive.pid (leave passive in pid file name)
#
loglevel = debug
logfile = var/log/ncpa_passive.log
pidfile = var/run/ncpa_passive.pid

#
# Delay passive checks from starting in seconds
# Default: 0
#
# delay_start = 30

#
# -------------------------------
# Passive Configuration (NRDP)
# -------------------------------
#

[nrdp]

#
# Connection settings to the NRDP server
# parent = NRDP server location (ex: http://<address>/nrdp)
# token = NRDP server token used to send NRDP results
#
parent = https://10.34.0.75/nrdp/
token = efb46ftdfu74

#
# The hostname that will replace %HOSTNAME% in the check definitions and will be
# sent to NRDP with the check name as the service description (service name)
#
hostname = client01

#
# -------------------------------
# Passive Configuration (NRDS)
# -------------------------------
#

[nrds]

#
# NRDS CONFIGURATION DOES NOT WORK YET. MORE TO COME IN VERSION 2.1.0.
#

#
# NRDS connection information
#
url =
token =
config_name =
config_version =
update_config = 1
update_plugins = 1

[kafkaproducer]

#
# -------------------------------
# Passive Configuration (Kafka)
# -------------------------------
#

hostname = None
servers = localhost:9092
clientname = NCPA-Kafka
topic = ncpa

#
# -------------------------------
# Plugin Configuration
# -------------------------------
#

[plugin directives]

#
# Plugin path where all plugins will be ran from.
#
plugin_path = plugins/

#
# Plugin execution timeout in seconds. Different than the check_ncpa.py timeout, which is
# normally for network connection issues. Will return a CRITICAL value and error when the plugin
# reaches the defined max execution timeout and kills the process.
# Default: 60
#
# plugin_timeout = 60

#
# Extensions for plugins
# ----------------------
# The extension for the plugin denotes how NCPA will try to run the plugin. Use this
# for setting how you want to run the plugin in the command line.
#
# NOTE: Plugins without an extension will be ran in the cmdline as follows:
#       $plugin_name $plugin_args
#
# Defaults:
# .sh = /bin/sh $plugin_name $plugin_args
# .py = python $plugin_name $plugin_args
# .ps1 = powershell -ExecutionPolicy Bypass -File $plugin_name $plugin_args
# .vbs = cscript $plugin_name $plugin_args //NoLogo
# .bat = cmd /c $plugin_name $plugin_args
#
# Since windows NCPA is 32-bit, if you need to use 64-bit powershell, try the following for
# the powershell plugin definition:
# .ps1 = c:\windows\sysnative\windowspowershell\v1.0\powershell.exe -ExecutionPolicy Unrestricted -File $plugin_name $p                           lugin_args
#

# Linux / Mac OS X
.sh = /bin/sh $plugin_name $plugin_args
.py = python $plugin_name $plugin_args

# Windows
.ps1 = powershell -ExecutionPolicy Bypass -File $plugin_name $plugin_args
.vbs = cscript $plugin_name $plugin_args //NoLogo
.wsf = cscript $plugin_name $plugin_args //NoLogo
.bat = cmd /c $plugin_name $plugin_args
root@client01:/usr/local/ncpa/etc#

Code: Select all

root@client01:/usr/local/ncpa/etc# cd ncpa.cfg.d
root@client01:/usr/local/ncpa/etc/ncpa.cfg.d# ls -l
total 12
-rw-r--r-- 1 nagios nagios 510 Dec 21 16:15 example.cfg
-rw-r--r-- 1 nagios nagios 697 Jan  5 10:05 nrdp.cfg
-rw-r--r-- 1 nagios nagios 100 Dec 21 16:15 README.txt
root@client01:/usr/local/ncpa/etc/ncpa.cfg.d# cat nrdp.cfg
#
#       Basic example of Passive checks being defined
#

[passive checks]

%HOSTNAME%|__HOST__ = system/agent_version
%HOSTNAME%|Uptime|60 = system/uptime
%HOSTNAME%|CPU Usage|30 = cpu/percent --warning 80 --critical 90 --aggregate avg
%HOSTNAME%|Memory Usage|30 = memory/virtual --warning 80 --critical 90 --units Gi
%HOSTNAME%|Swap Usage|60 = memory/swap --warning 80 --critical 90 --units Gi
%HOSTNAME%|Process Count|30 = processes --warning 400 --critical 500
%HOSTNAME%|Disk Used root|60 = disk/logical/|/used_percent --warning 80 --critical 90
%HOSTNAME%|NCPA Listener|60 = services?service=ncpa_listener&status=running
%HOSTNAME%|NCPA Passive|60 = services?service=ncpa_passive&status=running
root@client01:/usr/local/ncpa/etc/ncpa.cfg.d#
dpa.clt
Posts: 15
Joined: Tue Jan 02, 2018 4:42 am

Re: Passive check not working giving stale warning

Post by dpa.clt »

Please find the ncpa information below

root@client01:/usr/local/ncpa/etc# cat ncpa.cfg |grep -v '#'


[general]

check_logging = 1

check_logging_time = 30

exclude_fs_types = aufs,autofs,binfmt_misc,cifs,cgroup,debugfs,devpts,devtmpfs,encryptfs,efivarfs,fuse,hugelbtfs,mqueue,nfs,overlayfs,proc,pstore,rpc_pipefs,securityfs,smb,sysfs,tmpfs,tracefs

default_units = Gi


[listener]

uid = nagios
gid = nagios

ip = 0.0.0.0
port = 5693

ssl_version = TLSv1_2
certificate = adhoc

loglevel = debug
logfile = var/log/ncpa_listener.log
pidfile = var/run/ncpa_listener.pid


admin_gui_access = 1

admin_password = None

admin_auth_only = 0


[api]

community_string = xxxxxx


[passive]

handlers = nrdp

uid = nagios
gid = nagios

sleep = 60

loglevel = debug
logfile = var/log/ncpa_passive.log
pidfile = var/run/ncpa_passive.pid



[nrdp]

parent = https://10.x.x.x./nrdp/
token = xxxxxx

hostname = client01


[nrds]


url =
token =
config_name =
config_version =
update_config = 1
update_plugins = 1

[kafkaproducer]


hostname = None
servers = localhost:9092
clientname = NCPA-Kafka
topic = ncpa


[plugin directives]

plugin_path = plugins/



.sh = /bin/sh $plugin_name $plugin_args
.py = python $plugin_name $plugin_args

.ps1 = powershell -ExecutionPolicy Bypass -File $plugin_name $plugin_args
.vbs = cscript $plugin_name $plugin_args //NoLogo
.wsf = cscript $plugin_name $plugin_args //NoLogo
.bat = cmd /c $plugin_name $plugin_args

root@client01:/usr/local/ncpa/etc/ncpa.cfg.d# cat nrdp.cfg |grep -v '#'

[passive checks]

%HOSTNAME%|__HOST__ = system/agent_version
%HOSTNAME%|Uptime|60 = system/uptime
%HOSTNAME%|CPU Usage|30 = cpu/percent --warning 80 --critical 90 --aggregate avg
%HOSTNAME%|Memory Usage|30 = memory/virtual --warning 80 --critical 90 --units Gi
%HOSTNAME%|Swap Usage|60 = memory/swap --warning 80 --critical 90 --units Gi
%HOSTNAME%|Process Count|30 = processes --warning 400 --critical 500
%HOSTNAME%|Disk Used root|60 = disk/logical/|/used_percent --warning 80 --critical 90
%HOSTNAME%|NCPA Listener|60 = services?service=ncpa_listener&status=running
%HOSTNAME%|NCPA Passive|60 = services?service=ncpa_passive&status=running
root@client01:/usr/local/ncpa/etc/ncpa.cfg.d#
dpa.clt
Posts: 15
Joined: Tue Jan 02, 2018 4:42 am

Re: Passive check not working giving stale warning

Post by dpa.clt »

Also please note that we have not written any external commands for check dummy !0 or check dummy!2
Please find ncpa_passive log as below

2018-01-10 06:37:39,698 3386 INFO Running check: services?service=ncpa_listener&status=running
2018-01-10 06:37:39,745 3386 INFO Running check: services?service=ncpa_passive&status=running
2018-01-10 06:37:39,796 3386 ERROR no element found: line 1, column 0
Traceback (most recent call last):
File "/root/ncpa/agent/passive/nrdp.py", line 198, in submit_to_nagios
File "/root/ncpa/agent/passive/nrdp.py", line 145, in log_result
File "/usr/local/lib/python2.7/xml/dom/minidom.py", line 1928, in parseString
File "/usr/local/lib/python2.7/xml/dom/expatbuilder.py", line 940, in parseString
File "/usr/local/lib/python2.7/xml/dom/expatbuilder.py", line 223, in parseString
ExpatError: no element found: line 1, column 0
2018-01-10 06:37:44,806 3386 INFO Running check: cpu/percent --warning 80 --critical 90 --aggregate avg
2018-01-10 06:37:45,329 3386 INFO Running check: memory/virtual --warning 80 --critical 90 --units Gi
2018-01-10 06:37:45,346 3386 INFO Running check: processes --warning 400 --critical 500
2018-01-10 06:37:45,435 3386 ERROR no element found: line 1, column 0
Traceback (most recent call last):
File "/root/ncpa/agent/passive/nrdp.py", line 198, in submit_to_nagios
File "/root/ncpa/agent/passive/nrdp.py", line 145, in log_result
File "/usr/local/lib/python2.7/xml/dom/minidom.py", line 1928, in parseString
File "/usr/local/lib/python2.7/xml/dom/expatbuilder.py", line 940, in parseString
File "/usr/local/lib/python2.7/xml/dom/expatbuilder.py", line 223, in parseString
ExpatError: no element found: line 1, column 0



Not sure what we are missing .Kindly suggest
tijov05
Posts: 2
Joined: Tue Jan 09, 2018 1:29 am

Re: Passive check not working giving stale warning

Post by tijov05 »

Code: Select all

root@client01:/usr/local/ncpa/var/log# tail -1000 ncpa_passive.log
2018-01-10 06:21:19,356 2904 INFO Running check: services?service=ncpa_passive&status=running
2018-01-10 06:21:19,413 2904 ERROR no element found: line 1, column 0
Traceback (most recent call last):
  File "/root/ncpa/agent/passive/nrdp.py", line 198, in submit_to_nagios
  File "/root/ncpa/agent/passive/nrdp.py", line 145, in log_result
  File "/usr/local/lib/python2.7/xml/dom/minidom.py", line 1928, in parseString
  File "/usr/local/lib/python2.7/xml/dom/expatbuilder.py", line 940, in parseString
  File "/usr/local/lib/python2.7/xml/dom/expatbuilder.py", line 223, in parseString
ExpatError: no element found: line 1, column 0
2018-01-10 06:21:45,467 2904 INFO Running check: cpu/percent --warning 80 --critical 90 --aggregate avg
2018-01-10 06:21:45,987 2904 INFO Running check: memory/virtual --warning 80 --critical 90 --units Gi
2018-01-10 06:21:46,004 2904 INFO Running check: processes --warning 400 --critical 500
2018-01-10 06:21:46,104 2904 ERROR no element found: line 1, column 0
Traceback (most recent call last):
  File "/root/ncpa/agent/passive/nrdp.py", line 198, in submit_to_nagios
  File "/root/ncpa/agent/passive/nrdp.py", line 145, in log_result
  File "/usr/local/lib/python2.7/xml/dom/minidom.py", line 1928, in parseString
  File "/usr/local/lib/python2.7/xml/dom/expatbuilder.py", line 940, in parseString
  File "/usr/local/lib/python2.7/xml/dom/expatbuilder.py", line 223, in parseString
ExpatError: no element found: line 1, column 0
2018-01-10 06:22:16,162 2904 INFO Running check: cpu/percent --warning 80 --critical 90 --aggregate avg
2018-01-10 06:22:16,677 2904 INFO Running check: memory/virtual --warning 80 --critical 90 --units Gi
2018-01-10 06:22:16,690 2904 INFO Running check: processes --warning 400 --critical 500
2018-01-10 06:22:16,777 2904 ERROR no element found: line 1, column 0
Traceback (most recent call last):
  File "/root/ncpa/agent/passive/nrdp.py", line 198, in submit_to_nagios
  File "/root/ncpa/agent/passive/nrdp.py", line 145, in log_result
  File "/usr/local/lib/python2.7/xml/dom/minidom.py", line 1928, in parseString
  File "/usr/local/lib/python2.7/xml/dom/expatbuilder.py", line 940, in parseString
  File "/usr/local/lib/python2.7/xml/dom/expatbuilder.py", line 223, in parseString
ExpatError: no element found: line 1, column 0
2018-01-10 06:22:19,783 2904 INFO Running check: system/uptime
2018-01-10 06:22:19,796 2904 INFO Running check: memory/swap --warning 80 --critical 90 --units Gi
2018-01-10 06:22:19,809 2904 INFO Running check: disk/logical/|/used_percent --warning 80 --critical 90
2018-01-10 06:22:19,820 2904 INFO Running check: services?service=ncpa_listener&status=running
2018-01-10 06:22:19,864 2904 INFO Running check: services?service=ncpa_passive&status=running
2018-01-10 06:22:19,919 2904 ERROR no element found: line 1, column 0
Traceback (most recent call last):
  File "/root/ncpa/agent/passive/nrdp.py", line 198, in submit_to_nagios
  File "/root/ncpa/agent/passive/nrdp.py", line 145, in log_result
  File "/usr/local/lib/python2.7/xml/dom/minidom.py", line 1928, in parseString
  File "/usr/local/lib/python2.7/xml/dom/expatbuilder.py", line 940, in parseString
  File "/usr/local/lib/python2.7/xml/dom/expatbuilder.py", line 223, in parseString
ExpatError: no element found: line 1, column 0
2018-01-10 06:22:46,971 2904 INFO Running check: cpu/percent --warning 80 --critical 90 --aggregate avg
2018-01-10 06:22:47,653 2904 INFO Running check: memory/virtual --warning 80 --critical 90 --units Gi
2018-01-10 06:22:47,670 2904 INFO Running check: processes --warning 400 --critical 500
2018-01-10 06:22:47,756 2904 ERROR no element found: line 1, column 0
Traceback (most recent call last):
  File "/root/ncpa/agent/passive/nrdp.py", line 198, in submit_to_nagios
  File "/root/ncpa/agent/passive/nrdp.py", line 145, in log_result
  File "/usr/local/lib/python2.7/xml/dom/minidom.py", line 1928, in parseString
  File "/usr/local/lib/python2.7/xml/dom/expatbuilder.py", line 940, in parseString
  File "/usr/local/lib/python2.7/xml/dom/expatbuilder.py", line 223, in parseString
ExpatError: no element found: line 1, column 0
2018-01-10 06:23:17,815 2904 INFO Running check: cpu/percent --warning 80 --critical 90 --aggregate avg
2018-01-10 06:23:18,331 2904 INFO Running check: memory/virtual --warning 80 --critical 90 --units Gi
2018-01-10 06:23:18,345 2904 INFO Running check: processes --warning 400 --critical 500
2018-01-10 06:23:18,439 2904 ERROR no element found: line 1, column 0
Traceback (most recent call last):
  File "/root/ncpa/agent/passive/nrdp.py", line 198, in submit_to_nagios
  File "/root/ncpa/agent/passive/nrdp.py", line 145, in log_result
  File "/usr/local/lib/python2.7/xml/dom/minidom.py", line 1928, in parseString
  File "/usr/local/lib/python2.7/xml/dom/expatbuilder.py", line 940, in parseString
  File "/usr/local/lib/python2.7/xml/dom/expatbuilder.py", line 223, in parseString
ExpatError: no element found: line 1, column 0
2018-01-10 06:23:20,443 2904 INFO Running check: system/uptime
2018-01-10 06:23:20,461 2904 INFO Running check: memory/swap --warning 80 --critical 90 --units Gi
2018-01-10 06:23:20,476 2904 INFO Running check: disk/logical/|/used_percent --warning 80 --critical 90
2018-01-10 06:23:20,488 2904 INFO Running check: services?service=ncpa_listener&status=running
2018-01-10 06:23:20,531 2904 INFO Running check: services?service=ncpa_passive&status=running
2018-01-10 06:23:20,587 2904 ERROR no element found: line 1, column 0
Traceback (most recent call last):
  File "/root/ncpa/agent/passive/nrdp.py", line 198, in submit_to_nagios
  File "/root/ncpa/agent/passive/nrdp.py", line 145, in log_result
  File "/usr/local/lib/python2.7/xml/dom/minidom.py", line 1928, in parseString
  File "/usr/local/lib/python2.7/xml/dom/expatbuilder.py", line 940, in parseString
  File "/usr/local/lib/python2.7/xml/dom/expatbuilder.py", line 223, in parseString
ExpatError: no element found: line 1, column 0
2018-01-10 06:23:48,641 2904 INFO Running check: cpu/percent --warning 80 --critical 90 --aggregate avg
2018-01-10 06:23:49,155 2904 INFO Running check: memory/virtual --warning 80 --critical 90 --units Gi
2018-01-10 06:23:49,172 2904 INFO Running check: processes --warning 400 --critical 500
2018-01-10 06:23:49,259 2904 ERROR no element found: line 1, column 0
Traceback (most recent call last):
dpa.clt
Posts: 15
Joined: Tue Jan 02, 2018 4:42 am

Re: Passive check not working giving stale warning

Post by dpa.clt »

@npolovenko @Box293 Thanks a lot for your guidance .
We were able to fix the passive check issue by installing apt-get install php-simplexml package .
And now passive check is working as expected .

Thanks again :D
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Passive check not working giving stale warning

Post by tgriep »

@dpa.clt, thanks for posting your results and that the issue is solved.
@tijov05, can you install the same package of your system and see if that fixes the issue for you?
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Passive check not working giving stale warning

Post by Box293 »

dpa.clt wrote:We were able to fix the passive check issue by installing apt-get install php-simplexml package .
@dpa.clt what operating system and version did you install php-simplexml on? I wanted to document this in a KB article.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
dpa.clt
Posts: 15
Joined: Tue Jan 02, 2018 4:42 am

Re: Passive check not working giving stale warning

Post by dpa.clt »

Box293 wrote:
dpa.clt wrote:We were able to fix the passive check issue by installing apt-get install php-simplexml package .
@dpa.clt what operating system and version did you install php-simplexml on? I wanted to document this in a KB article.
@Box293 ,I installed this package on ubuntu 16.04LTS which is the core nagios server .This nagios server is a vm ware virtual machine .
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Passive check not working giving stale warning

Post by Box293 »

Excellent, thanks for that. I'll lock this topic now.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked