NCPA & NRDP on Nagios Core Help please

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.
Slodge123
Posts: 9
Joined: Mon Jun 06, 2016 9:36 am

Re: NCPA & NRDP on Nagios Core Help please

Post by Slodge123 »

Hello

Checked Token etc. and all works fine from NRDP Web interface on the child Server.

Decreased the time to 50 abd restarted the service but the NCPA agent has been running since yesterday still nothing getting to the log file :-(

sudo dpkg -l selinux* returns in selinux-policy-default none none no description available

Checked the log again and still nothing.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: NCPA & NRDP on Nagios Core Help please

Post by npolovenko »

@Slodge123, There's a PowerShell script you can run on windows to send NRDP check result manually from the windows host to Nagios. This will be very helpful in our case.
1. Extract the script called ps_nrdp.ps1 from the zip file that I attached.
2. Put the script somewhere on your Windows computer, like in C://
3. Open Windows Powershell as administrator (you can search for it in windows search, it's a default program).
4. Type Set-ExecutionPolicy RemoteSigned to allow PowerShell script execution
5. Navigate to the folder where your script is and run it:

Code: Select all

.\ps_nrdp.ps1 -url http://YOUR_NAGIOS_IP -token YOUR_TOKEN -hostname test -service test -state OK -output test -delim 1
6. You should see something like:

Code: Select all

SUCCESS - checks succesfully sent, NRDP returned: <?xml version="1.0" encoding="utf-8"?>
<result>
  <status>0</status>
  <message>OK</message>
    <meta>
       <output>1 checks processed.</output>
    </meta>
</result>
)
Great!
On your nagios server run tail -f /usr/local/nagios/var/nagios.logtail -f /usr/local/nagios/var/nagios.logto live track incoming nrdp data.
Do you see anything now?

Also, in your ncpa.cfg file on windows change:

Code: Select all

#
loglevel =debug
logfile = var/log/ncpa_listener.log
pidfile = var/run/ncpa_listener.pid
#
Restart Ncpa service.
And on Nagios server check for these log files. There could be some debugging information in there as well.
Attachments
psnrdp-master.zip
(12.16 KiB) Downloaded 231 times
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Slodge123
Posts: 9
Joined: Mon Jun 06, 2016 9:36 am

Re: NCPA & NRDP on Nagios Core Help please

Post by Slodge123 »

With all your help I stumbled across this article https://support.nagios.com/forum/viewto ... 9&start=20 which said I needed to install php-simplexml because my server runs on Ubuntu, Did this and I am now getting the expected "Error: Got check" errors from the remote host.

I guess all I need to do now is put the checks somewhere in a config file, any pointers to what goes where greatly appreciated
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: NCPA & NRDP on Nagios Core Help please

Post by npolovenko »

@Slodge123 , Glad it worked! Yes, we've got the most important part out of the way and we only need to create host/services definitions.

On your Nagios Server:

Navigate to:

Code: Select all

/usr/local/nagios/etc/objects 
Open the file called templates.cfg and paste the following code in HOST TEMPLATES section:

Code: Select all

define host {
    use                        generic-host
    name                     passive_host
    active_checks_enabled        0
    passive_checks_enabled        1
    flap_detection_enabled        0
    register                    0
    check_period                24x7
    max_check_attempts        1
    check_interval            5
    retry_interval            1
    check_freshness            0
    contact_groups            admins
    check_command            check_dummy!0
    notification_interval    60
    notification_period        24x7
    notification_options        d,u,r
}
And paste the following code in SERVICE TEMPLATES section:

Code: Select all

define service {
    use                        generic-service
    name                        passive_service
    active_checks_enabled        0
    passive_checks_enabled        1
    flap_detection_enabled        0
    register                    0
    check_period                24x7
    max_check_attempts        1
    check_interval            5
    retry_interval            1
    check_freshness            0
    contact_groups            admins
    check_command            check_dummy!0
    notification_interval    60
    notification_period        24x7
    notification_options        w,u,c,r
}
Save and exit out of the file.
In the same directory /usr/local/nagios/etc/objects
Create a new file new_host.cfg
And add this code inside(you can change the host name to whatever you like):

Code: Select all

define host {
    use            passive_host
    host_name        S1601
}
define service {
    use                    passive_service
    service_description    CPU Usage
    host_name                S1601
}
define service {
    use                    passive_service
    service_description    Disk Usage
    host_name                S1601
}
define service {
    use                    passive_service
    service_description    Swap Usage
    host_name                S1601
}
define service {
    use                    passive_service
    service_description    Memory Usage
    host_name                S1601
}
define service {
    use                    passive_service
    service_description    Process Count
    host_name                S1601
}
Save and exit out of the file.
Then go to: /usr/local/nagios/etc/
And modify the file called nagios.cfg
Add your new config path in this section:

Code: Select all

cfg_file=/usr/local/nagios/etc/objects/commands.cfg
cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg
cfg_file=/usr/local/nagios/etc/objects/templates.cfg
cfg_file=/usr/local/nagios/etc/objects/remotehost.cfg
Add this
cfg_file=/usr/local/nagios/etc/objects/new_host.cfg

Save and exit.
Run

Code: Select all

service nagios restart
Should be all done.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Slodge123
Posts: 9
Joined: Mon Jun 06, 2016 9:36 am

Re: NCPA & NRDP on Nagios Core Help please

Post by Slodge123 »

Added to the files as per your post.

When I restart the Nagios service it fails to restart, when I check the config by /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg i get the following errors

Error: Service check command 'check_dummy!0' specified in service 'CPU Usage' for host 'Enter123' not defined anywhere

I get the same for all 5 checks ie CPU Usage, Disk, Memory, Process & Swap

I also get Error: Host check command 'check_dummy!0' specified for host 'Enter123' is not defined anywhere!

Thanks again for your advice and help,
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: NCPA & NRDP on Nagios Core Help please

Post by npolovenko »

@Slodge123 I appologize i missed one part:

Please open this file:
/usr/local/nagios/etc/objects/commands.cfg
And paste this definition anywhere in the Sample Service Checks Commands:

Code: Select all

define command {
    command_name            check_dummy
    command_line            $USER1$/check_dummy $ARG1$
}
Here's the reference just in case: https://support.nagios.com/kb/article/n ... tions.html
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Slodge123
Posts: 9
Joined: Mon Jun 06, 2016 9:36 am

Re: NCPA & NRDP on Nagios Core Help please

Post by Slodge123 »

I cant thank you enough :-)

I am now seeing the passive check results in the Nagios Dashboard :-)
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: NCPA & NRDP on Nagios Core Help please

Post by npolovenko »

@Slodge123, Nice! Not a problem :) I will go ahead and lock this topic but if you'll have any other problems feel free to create a new one.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked