ncpa-2.1.8 On windows server 2008 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.
Locked
Alan
Posts: 86
Joined: Wed Aug 21, 2019 4:14 pm

ncpa-2.1.8 On windows server 2008 not working

Post by Alan »

I have installed the ncpa-2.1.8 On windows server 2008 R2 Enterprise and when I log into the NCPA web GUI from the server I can see the CPU, Memory, disks, and interfaces. Then I remote to the Nagios server which is running CentOS7 and I found a form to run a test so i CD to this location /usr/local/nagios/libexec and I run this command ./check_ncpa.py -H <Nagios server IP> -t <Mt token name setup in the NCPA installer> -M 'cpu/percent' -w 20 -c 40 -q 'aggregate=avg' -v

This returns:

Connecting to: https://X.X.X.X:5693/api/cpu/percent/?t ... regate=avg
File returned contained:
{
"perfdata": "'percent'=0.00%;20;40;",
"returncode": 0,
"stdout": "OK: Percent was 0.00 % | 'percent'=0.00%;20;40;"
}
OK: Percent was 0.00 % | 'percent'=0.00%;20;40;

But no matter how many times i run the commands
net stop ncpalistener
net start ncpalistener

net stop ncpapassive
net stop ncpapassive

I cannot get this windows host in the list of hosts on the Nagios server. This is what i followed when trying to get things setup - https://assets.nagios.com/downloads/nag ... installing

Does anyone happen to have any ideas on what I can try. I am trying to use the ncpa-2.1.8 client but if I cant get it to work then I might try the NSClient++. I was told from someone at Nagios that the NCPA is better supported. I also took the IP address out but it is the IP of the Nagios server.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: ncpa-2.1.8 On windows server 2008 not working

Post by tgriep »

When you run the check_ncpa.py plugin, you say that the IP address for the -H option is the Nagios server, is that true?
If you are trying to test the Windows 2008 server, then the IP address you should be using is the IP address of the Windows system, not the Nagios system.
Try that and see if it returns the data you are expecting.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Alan
Posts: 86
Joined: Wed Aug 21, 2019 4:14 pm

Re: ncpa-2.1.8 On windows server 2008 not working

Post by Alan »

Yes sorry the IP address in this command is the IP address of the Windows server:

./check_ncpa.py -H 172.16.10.45 -t 'tokenname' -M 'cpu/percent' -w 20 -c 40 -q 'aggregate=avg' -v[/code]

Out put from command is:

Connecting to: https://172.16.10.45:5693/api/cpu/perce ... regate=avg
File returned contained:
{
"perfdata": "'percent'=0.00%;20;40;",
"returncode": 0,
"stdout": "OK: Percent was 0.00 % | 'percent'=0.00%;20;40;"
}
OK: Percent was 0.00 % | 'percent'=0.00%;20;40;


I also ran this command:

./check_ncpa.py -H 172.17.20.3 -t 'tokenname' -M 'disk/logical/C:|' --units G

Out put from command is:

OK: Used disk space was 74.20 % (Used: 370.70 GB, Free: 128.75 GB, Total: 499.45 GB) | 'used'=370.70GB;;; 'free'=128.75GB;;; 'total'=499.45GB;;;
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: ncpa-2.1.8 On windows server 2008 not working

Post by tgriep »

Thanks for clarifying that the address is the Windows system.
To get a Host and Service check to show up in the Nagios Web Interface, you will have to manually create Host and Service Configurations files.
Installing an Agent on a remote Host, does not create the configuration files in Nagios.

Take a look at the following links for the Nagios Core Documentation.
The first link brings you to the mail help page but the second link brings you to the Monitoring Windows systems page.
Under this section "Creating new command, host and service definitions for monitoring the Windows machine" it has the details on how to create the check_ncpa command, Host and Service checks.
https://assets.nagios.com/downloads/nag ... n/toc.html
https://assets.nagios.com/downloads/nag ... ndows.html

Take a look at it and let us know if you have any further questions.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Alan
Posts: 86
Joined: Wed Aug 21, 2019 4:14 pm

Re: ncpa-2.1.8 On windows server 2008 not working

Post by Alan »

I did also do this. I am assuming it is configured wrong somewhere though. The first part that I did was in the commands.cfg which was located in this location - /usr/local/nagios/etc/objects This is what I added to it:

Code: Select all

			define command{
					command_name check_nrpe
					command_line nagiosadmin/check_nrpe -H 172.16.10.45 -c $ARG1$
			}
I have also tried:

Code: Select all

			define command{
					command_name check_nrpe
					command_line $USER1$/check_nrpe -H 172.16.10.45 -c $ARG1$
			}
I have also tired the windows IP address and the Nagios server IP address in the place of the IP address.


I did also create the ncpa.cfg file in this location - /usr/local/nagios/etc/objects
This is what is in the file. I did Replace the -t 'mytoken' with my own token. I just put it back as 'mytoken' for posting reasons:

Code: Select all

			define host {
				host_name               Svr-Backup
				address                 172.16.10.45
				check_command           check_ncpa!-t 'mytoken' -P 5693 -M system/agent_version
				max_check_attempts      5
				check_interval          5
				retry_interval          1
				check_period            24x7
				contacts                nagiosadmin
				notification_interval   60
				notification_period     24x7
				notifications_enabled   1
				icon_image              ncpa.png
				statusmap_image         ncpa.png
				register                1
			}

			define service {
				host_name               Svr-Backup
				service_description     CPU Usage
				check_command           check_ncpa!-t 'mytoken' -P 5693 -M cpu/percent -w 20 -c 40 -q 'aggregate=avg'
				max_check_attempts      5
				check_interval          5
				retry_interval          1
				check_period            24x7
				notification_interval   60
				notification_period     24x7
				contacts                nagiosadmin
				register                1
			}

			define service {
				host_name               Svr-Backup
				service_description     Memory Usage
				check_command           check_ncpa!-t 'mytoken' -P 5693 -M memory/virtual -w 50 -c 80 -u G
				max_check_attempts      5
				check_interval          5
				retry_interval          1
				check_period            24x7
				notification_interval   60
				notification_period     24x7
				contacts                nagiosadmin
				register                1
			}

			define service {
				host_name               Svr-Backup
				service_description     Process Count
				check_command           check_ncpa!-t 'mytoken' -P 5693 -M processes -w 150 -c 200
				max_check_attempts      5
				check_interval          5
				retry_interval          1
				check_period            24x7
				notification_interval   60
				notification_period     24x7
				contacts                nagiosadmin
				register                1
	

This is what is in these locations. I am not 100% sure the commands.cfg and the ncpa.cfg are in the right place or not. The commands.cfg was actually already there I did not have to create it:

[alan@Svr-Monitor etc]$ pwd
/usr/local/nagios/etc
[alan@Svr-Monitor etc]$ ll
total 72
-rw-rw-r--. 1 nagios nagios 12267 Aug 15 10:01 cgi.cfg
-rw-r--r--. 1 root root 50 Aug 20 11:50 htpasswd.users
-rw-rw-r--. 1 nagios nagios 44830 Aug 15 10:12 nagios.cfg
-rw-r--r--. 1 nagios nagios 7988 Aug 15 10:09 nrpe.cfg
drwxrwxr-x. 2 nagios nagios 183 Aug 21 10:27 objects
-rw-rw----. 1 nagios nagios 1312 Aug 15 10:01 resource.cfg
drwxr-xr-x. 2 root root 6 Aug 15 10:13 servers



[alan@Svr-Monitor objects]$ pwd
/usr/local/nagios/etc/objects
[alan@Svr-Monitor objects]$ ll
total 52
-rw-rw-r--. 1 nagios nagios 7922 Aug 28 14:33 commands.cfg
-rw-rw-r--. 1 nagios nagios 2107 Aug 15 10:14 contacts.cfg
-rw-rw-r--. 1 nagios nagios 5375 Aug 15 10:01 localhost.cfg
-rw-r--r--. 1 root root 1902 Aug 21 09:41 ncpa.cfg
-rw-rw-r--. 1 nagios nagios 3096 Aug 15 10:01 printer.cfg
-rw-rw-r--. 1 nagios nagios 3265 Aug 15 10:01 switch.cfg
-rw-rw-r--. 1 nagios nagios 10621 Aug 15 10:01 templates.cfg
-rw-rw-r--. 1 nagios nagios 3180 Aug 15 10:01 timeperiods.cfg
-rw-rw-r--. 1 nagios nagios 3998 Aug 20 15:24 windows.cfg

As far as adding configuring on the windows host for the part of "Add checks to your ncpa configuration" in the location - C:\Program Files (x86)\Nagios\NCPA\etc\ncpa.cfg.d there is a nrpd.cfg file that has this in it:

Code: Select all

#
			# AUTO GENERATED NRDP CONFIG FROM WINDOWS INSTALLER
			#

			[passive checks]

			# Host check  - This is to stop "pending check" status in Nagios
			%HOSTNAME%|__HOST__ = system/agent_version

			# Service checks
			%HOSTNAME%|CPU Usage = cpu/percent --warning 80 --critical 90 --aggregate avg
			%HOSTNAME%|Disk Usage = disk/logical/C:|/used_percent --warning 80 --critical 90 --units Gi
			%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


Do I need to add the Configure your NRDP settings to this config file of:

			[nrdp]
			parent = http:/<nrdp address>/nrdp/
			token = nrdptoken
			hostname = NCPA 2 Host

and 

			[passive]
			handlers = nrdp
Does this all look correct? Thanks for all your help on this.
Last edited by tgriep on Thu Aug 29, 2019 8:56 am, edited 1 time in total.
Reason: Added Code Wraps around large output.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: ncpa-2.1.8 On windows server 2008 not working

Post by tgriep »

Since you are using the check_ncpa.py plugin, you have to create a check_ncpa command.
What you have shown is that you created a check_nrpe command and that is not what you need.

Edit this file

Code: Select all

/usr/local/nagios/etc/objects/commands.cfg
And add this command.

Code: Select all

define command {
    command_name    check_ncpa
    command_line    $USER1$/check_ncpa.py -H $HOSTADDRESS$ $ARG1$
}
You said that you created the ncpa.cfg file and the settings look to be OK.
But to get Nagios to use that file, you have to add it to the main config file.

Edit the /usr/local/nagios/etc/nagios.cfg file and add the following line

Code: Select all

cfg_file=/usr/local/nagios/etc/objects/ncpa.cfg
Under the "# OBJECT CONFIGURATION FILE(S)" section.

That way, when Nagios starts up, it will load the /usr/local/nagios/etc/objects/ncpa.cfg file.

Then, you should verify the configuration files by running this command.

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
If there are any errors, it will display them and you will have to fix them and re-run the verification until they all pass.
Then you can restart nagios to load the new checks.

Verify Your Nagios Core Configuration information.
https://assets.nagios.com/downloads/nag ... onfig.html

The settings from the NCPA.cfg file from the Windows host are just for Passive Checks. That is a whole different setup and requires NRDP to be installed on the Nagios server and other settings. See these links for more details.
https://assets.nagios.com/downloads/nag ... hecks.html
https://github.com/NagiosEnterprises/nrdp
Be sure to check out our Knowledgebase for helpful articles and solutions!
Alan
Posts: 86
Joined: Wed Aug 21, 2019 4:14 pm

Re: ncpa-2.1.8 On windows server 2008 not working

Post by Alan »

Thank you for the info. I will make sure everything is setup like this and see if it will work. I will post back an update. Thanks again for the help.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: ncpa-2.1.8 On windows server 2008 not working

Post by tgriep »

Your welcome. If you get any errors, post them here as well and all of the configuration files so we can check the syntax, etc. for the checks or commands.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Alan
Posts: 86
Joined: Wed Aug 21, 2019 4:14 pm

Re: ncpa-2.1.8 On windows server 2008 not working

Post by Alan »

Thank you. I made those changed then restarted the Nagios service and it did now pull the windows server into to Nagios GUI. Thanks for the help with this.

-Alan
Locked