Passive Alerts With NSCA not working

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.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Passive Alerts With NSCA not working

Post by tgriep »

I took a look at the ncpa_passive.log file and for some reason, it looks like the NCPA agent is running the checks every second and not every 300 seconds like it should.
Can you upload the ncpa.cfg file and all of the files in the ncpa.cfg.d folder from the remote host so we can view them?

Thanks.
Be sure to check out our Knowledgebase for helpful articles and solutions!
cybergene
Posts: 92
Joined: Wed Aug 10, 2016 7:38 am
Location: Ottawa, Ontario, Canada

Re: Passive Alerts With NSCA not working

Post by cybergene »

@tgriep see attached.
Attachments
ncpa.cfg.7z
(2.77 KiB) Downloaded 175 times
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Passive Alerts With NSCA not working

Post by tgriep »

Thanks for the config files. You have the passive commands in both the ncpa.cfg file and the nrdp.cfg file and that could be causing the checks to run every second as they are duplicated.

What I would do is to remove this section from the ncpa.cfg file

Code: Select all

[passive checks]

%HOSTNAME%|__HOST__ = system/agent_version
%HOSTNAME%|Disk Usage = disk/logical/C:|/used_percent --warning 80 --critical 90 --units Gi
%HOSTNAME%|CPU Usage = cpu/percent --warning 60 --critical 80 --aggregate avg
%HOSTNAME%|Swap Usage = memory/swap --warning 60 --critical 80 --units Gi
%HOSTNAME%|Memory Usage = memory/virtual --warning 80 --critical 90 --units Gi
%HOSTNAME%|Process Count = processes --warning 300 --critical 400
%HOSTNAME%|Disk Used = disk/logical/|/used_percent --warning 80 --critical 90
And I would edit the nrdp.cfg file and change this line from

Code: Select all

%HOSTNAME%|Disk Usage = disk/logical/C:|/used_percent --warning 80 --critical 90 --units Gi
to

Code: Select all

%HOSTNAME%|Disk Usage = disk/logical/|/used_percent --warning 80 --critical 90 --units Gi
(That is changing the check to monitor the root partition and not the C Drive as it doesn't exist.)

Save the files a restart both the ncpa_passive and ncpa_listener services.

Then in the ncpa_passive.log file, you should see the passive services trying to send data to the Nagios server every 5 minutes and not every second.
Be sure to check out our Knowledgebase for helpful articles and solutions!
cybergene
Posts: 92
Joined: Wed Aug 10, 2016 7:38 am
Location: Ottawa, Ontario, Canada

Re: Passive Alerts With NSCA not working

Post by cybergene »

Hi @tgriep

I reverted the ncpa.cfg since I didn't had them in the first place. And restarted the services. It is still trying to connect every second.
Attachments
Screenshot_40.png
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Passive Alerts With NSCA not working

Post by tgriep »

I took a look at the code and I think when debugging is turned on, it is logging every second.
Did, after cleaning up the duplicate checks, did the checks get sent to the Nagios server at the 5 minute interval?
Be sure to check out our Knowledgebase for helpful articles and solutions!
cybergene
Posts: 92
Joined: Wed Aug 10, 2016 7:38 am
Location: Ottawa, Ontario, Canada

Re: Passive Alerts With NSCA not working

Post by cybergene »

Turned debugging off and restarted the services.

The ncpa_passive.log is showing this error:

Code: Select all

2018-01-09 11:31:21,817 7722 INFO Running check: processes --warning 300 --critical 400
2018-01-09 11:31:21,959 7722 INFO Running check: disk/logical/|/used_percent --warning 80 --critical 90
2018-01-09 11:31:22,063 7722 ERROR no element found: line 1, column 0
Traceback (most recent call last):
  File "ncpa_passive.py", line 45, in run_all_handlers
  File "/root/ncpa/agent/passive/nrdp.py", line 124, in run
  File "/root/ncpa/agent/passive/nrdp.py", line 179, 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-09 11:32:59,572 7722 INFO stopped
2018-01-09 11:33:00,199 7837 INFO started
2018-01-09 11:33:00,207 7837 INFO Running check: system/agent_version
2018-01-09 11:33:00,218 7837 INFO Did not receive normal values. Unable to find meaningful check.
2018-01-09 11:33:00,244 7837 INFO Running check: disk/logical/|/used_percent --warning 80 --critical 90 --units Gi
2018-01-09 11:33:00,273 7837 INFO Running check: cpu/percent --warning 60 --critical 80 --aggregate avg
2018-01-09 11:33:01,301 7837 INFO Running check: memory/swap --warning 60 --critical 80 --units Gi
2018-01-09 11:33:01,344 7837 INFO Running check: memory/virtual --warning 80 --critical 90 --units Gi
2018-01-09 11:33:01,372 7837 INFO Running check: processes --warning 300 --critical 400
2018-01-09 11:33:01,520 7837 INFO Running check: disk/logical/|/used_percent --warning 80 --critical 90
2018-01-09 11:33:01,632 7837 ERROR no element found: line 1, column 0
Traceback (most recent call last):
  File "ncpa_passive.py", line 45, in run_all_handlers
  File "/root/ncpa/agent/passive/nrdp.py", line 124, in run
  File "/root/ncpa/agent/passive/nrdp.py", line 179, 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-09 11:35:55,683 7837 INFO stopped
2018-01-09 11:35:56,303 7923 INFO started
2018-01-09 11:35:56,313 7923 INFO Running check: system/agent_version
2018-01-09 11:35:56,324 7923 INFO Did not receive normal values. Unable to find meaningful check.
2018-01-09 11:35:56,359 7923 INFO Running check: disk/logical/|/used_percent --warning 80 --critical 90 --units Gi
2018-01-09 11:35:56,394 7923 INFO Running check: cpu/percent --warning 60 --critical 80 --aggregate avg
2018-01-09 11:35:57,419 7923 INFO Running check: memory/swap --warning 60 --critical 80 --units Gi
2018-01-09 11:35:57,453 7923 INFO Running check: memory/virtual --warning 80 --critical 90 --units Gi
2018-01-09 11:35:57,484 7923 INFO Running check: processes --warning 300 --critical 400
2018-01-09 11:35:57,626 7923 INFO Running check: disk/logical/|/used_percent --warning 80 --critical 90
2018-01-09 11:35:57,731 7923 ERROR no element found: line 1, column 0
Traceback (most recent call last):
  File "ncpa_passive.py", line 45, in run_all_handlers
  File "/root/ncpa/agent/passive/nrdp.py", line 124, in run
  File "/root/ncpa/agent/passive/nrdp.py", line 179, 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
And no, no checks were sent to Nagios server at all.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Passive Alerts With NSCA not working

Post by tgriep »

Which Linux OS and release number are you using on the system you have installed NCPA on?
Please run the following on that system and post the output.

Code: Select all

uname -a
cat /etc/*release*
Be sure to check out our Knowledgebase for helpful articles and solutions!
cybergene
Posts: 92
Joined: Wed Aug 10, 2016 7:38 am
Location: Ottawa, Ontario, Canada

Re: Passive Alerts With NSCA not working

Post by cybergene »

Here you go:

uname -a

Code: Select all

Linux hanjin 4.10.0-40-generic #44-Ubuntu SMP Thu Nov 9 14:49:09 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
cat /etc/*release*

Code: Select all

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=17.04
DISTRIB_CODENAME=zesty
DISTRIB_DESCRIPTION="Ubuntu 17.04"
NAME="Ubuntu"
VERSION="17.04 (Zesty Zapus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 17.04"
VERSION_ID="17.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=zesty
UBUNTU_CODENAME=zesty
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Passive Alerts With NSCA not working

Post by tgriep »

I just spun up a Ubuntu 17.04 system and installed the NCPA agent version 2.1.1 on it and it worked without any errors.
What I suggest is to remove the NCPA Agent and to reinstall it by following this procedure.

Login to the server as root and remove the existing agent and delete all of the files and folders in the /usr/local/ncpa folder

Next, change to the /tmp folder

Code: Select all

cd /tmp
Download the NCPA Agent by running

Code: Select all

wget https://assets.nagios.com/downloads/ncpa/ncpa-2.1.1.amd64.deb
Install it by running

Code: Select all

dpkg -i ncpa-2.1.1.amd64.deb
Then, go to the /usr/local/ncpa/etc/ncpa.cfg.d folder and edit the example.cfg file.
Uncomment out all of the settings for the passive check and for the Disk Usage check, remove the C: as the system does not have a C: Drive.
If should look like this

Code: Select all

%HOSTNAME%|Disk Usage = disk/logical/|/used_percent --warning 80 --critical 90 --units Gi
Save the file.

Then edit the /usr/local/ncpa/etc/ncpa.cfg file and update the following settings to the following

Under the [api] section change this option

Code: Select all

community_string = Str0ngT0k3n
Under the [passive] section change this option

Code: Select all

handlers = nrdp
Under the [nrdp] section change these option

Code: Select all

parent = http://54.165.9.118/nrdp/
token = cda35gtdfu72
hostname = hanjin

Save the file and restart the ncpa_passive service and see if that works for you.
Be sure to check out our Knowledgebase for helpful articles and solutions!
cybergene
Posts: 92
Joined: Wed Aug 10, 2016 7:38 am
Location: Ottawa, Ontario, Canada

Re: Passive Alerts With NSCA not working

Post by cybergene »

Re-installed and made the changes. It is still not working.

Check the attached logs.
Attachments
ncpa_passive.log
(6.1 KiB) Downloaded 461 times
Locked