Table of Contents

How To Monitor Windows Server with Nagios XI and NCPA

Picture of Salamon Anzel
Salamon Anzel

Monitoring your Windows Server environment is essential for ensuring system performance, uptime, and security. By using Nagios XI alongside the Nagios Cross-Platform Agent (NCPA), you can efficiently monitor your server with a seamless integration between the two tools. NCPA collects critical system metrics, while Nagios XI provides a powerful interface for visualization, alerting, and management. In this guide, we’ll walk you through the process of setting up Windows Server monitoring using both NCPA and Nagios XI.

What is NCPA?

NCPA (Nagios Cross-Platform Agent) is a powerful and flexible monitoring agent that allows Nagios to gather performance metrics from Windows, Linux, and MacOS systems. It helps administrators monitor CPU usage, memory, disk space, processes, and much more with minimal configuration.

Active vs Passive

NCPA can be used for both Active and Passive monitoring:
• Active = Nagios is responsible for performing the check on a schedule
• Passive = NCPA is responsible for submitting check results in Nagios

The NCPA installer may prompt you for settings for active and passive. Active is the most common
method used. If you are not using passive monitoring, then you do not need to configure those
settings.

Graphical vs Silent

The key differences between a Graphical (GUI) Install and a Silent Install of NCPA lie in user interaction, customization, deployment efficiency, and installation speed. A GUI install involves a step-by-step wizard requiring manual input, making it ideal for users who prefer an interactive approach. It allows customization during installation but is not suitable for large-scale deployments. In contrast, a silent install runs automatically via command-line execution with predefined parameters, making it the best option for mass deployment across multiple servers. While the GUI install is slower due to manual input, the silent install is faster and more efficient, though it requires careful pre-configuration to avoid misconfigurations.


Step 1: Download NCPA

  1. Open a web browser and go to the official Nagios NCPA download page.
  2. Click on “Download”, then select the Windows version of NCPA.
  3. Save the ncpa-latest.exe installer to your preferred location on the Windows Server.
widowsinstaller
ncpa installer – windows

Step 2: Install NCPA

Option A: Graphical Install (Recommended)

To see how this is done in Nagios XI, check out this tutorial:

Follow these steps for a straightforward installation using the graphical interface:

1. Locate the downloaded ncpa-latest.exe file on your machine.

ncpa latest
ncpa-latest.exe

2. Double-click the installer to begin the installation process.

3. The Welcome screen will appear. Click Next to proceed.

welcome screen
welcome screen

4. License Agreement:

  • Review the license agreement.
  • Click I Agree to accept the terms and continue.
license agreement 1
license agreement


5. Listener Configuration:

listener config
listener configuration
  • Token: Enter a strong token (e.g., Str0ngTok3n) for API calls, which Nagios will use to connect.
  • Bind IP: Leave as 0.0.0.0 to bind to all available IPv4 addresses on the Windows machine.
  • Bind Port: By default, it binds to port 5693.
  • SSL Version: Choose the version (TLSv1.0–1.2). Default is TLSv1.2.
  • Log Level: Set this to warning unless you need additional details for debugging.

Click Next to proceed.

6. Setup the Passive Configuration (Optional):

passive config 1
passive configuration
  • URL: The URL on your Nagios Host that accepts passive check results.
  • NRDP Token: This token will be used for passing passive checks to Nagios. It’s different from the active check token.
  • Hostname: Specify the hostname for the passive checks on the Nagios Server.
  • Check Interval: How often the passive checks will be sent.

Click Next to proceed.

7. Select Passive Service Checks (Optional):

passive config 2 1
passive checks

Default passive service checks will be displayed. You can modify them as required.

Click Next to proceed.


8. Choose User Installation:

Decide whether to install NCPA for just the user account performing the installation or for all users.

image
choose user


Click Next to continue.

9. Choose Installation Directory:

The default installation directory is C:\Program Files (x86)\Nagios\NCPA. You can modify the installation path if needed.

install location 1
install location


Click Install to proceed.

10. Finish the Installation:

  • Once installation is complete, click Finish.
install 1
install in progress
install 2
install complete

Option B – Silent Install

To perform a silent installation, you’ll use the installer with specific arguments. These arguments are added to the command line to configure the installation.

Arguments Explained

VariableDescription
/STells the installer to perform a silent installation (no prompts).
/DSpecifies the directory where NCPA will be installed (optional).
/TOKENDefines the token for accessing the agent’s API and web interface.
/IPSpecifies the IP address to bind to (optional, default is 0.0.0.0 for all IPv4 addresses).
/PORTSpecifies the port to bind to (optional, default is 5693).
/NRDPURLThe URL on the Nagios server where passive check results are sent.
/NRDPTOKENThe hostname that the passive checks will be associated with on the Nagios server.
/NRDPHOSTNAMEThe hostname that the passive checks will be associated with on the Nagios server.


Silent Installation Example Command

In order to use the silent install, you must pass the /S value to the install as shown below.

The /D value is optional, but if included, it must be the last argument, cannot contain quotes, and must be an absolute path.


The below command will set the token in your ncpa.cfg to mytoken. The silent install will start the
NCPA listener and passive services. That’s all you need to do. Below is a reference for all available
configuration options for the silent install.

ncpa-latest.exe /S /TOKEN='mytoken' /<variable>='<value>' /D=<base directory> 



Here’s an example command using the arguments above:

ncpa-latest.exe /S /TOKEN='Str0ngT0k3n' /NRDPURL='http://10.25.5.12/nrdp/' /NRDPTOKEN='NRDP_T0k3n' /NRDPHOSTNAME='S1601'

Step 3: Verify Installation

1. Check the Nagios Cross-Platform Agent:

Press Windows Key + R, type services.msc, and press Enter.

image 1
windows + R – services.exe



Scroll through the list and locate Nagios Cross-Platform Agent to confirm it’s running.

image 2
NCPA service



Alternatively, use Command Prompt:

Open a command prompt and run sc query ncpa

Confirm the STATE of ncpa is RUNNING:

> sc query ncpa

If the service is running, you should see output like this:

SERVICE_NAME: ncpa

TYPE               : 10  WIN32_OWN_PROCESS

STATE              : 4  RUNNING

 (STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)

WIN32_EXIT_CODE    : 0  (0x0)

SERVICE_EXIT_CODE  : 0  (0x0)

CHECKPOINT         : 0x0

WAIT_HINT          : 0x0

Step 4: Test NCPA Installation

1. Open a web browser and navigate to: https://<NCPA_IP_Address>:5693/

2. Bypass the security warning due to self-signed certificates by clicking More Information and selecting Go onto the webpage.

image 3
site not secure

3. On the NCPA login page, enter the API token you configured in Step 2-6 and click Log In.

image 6
NCPA login screen

4. Upon successful login, you will be directed to the NCPA Dashboard.

image 5
NCPA UI dashboard

Step 5: Adding your NCPA to Nagios XI

1. Log into Nagios XI.

2. Go to Configure → Configuration Wizards.

image 7
Configuration Wizard


3. Select Windows Server from the list.

image 8
Windows Server

4. Enter the Windows Server’s IP Address and the NCPA API Token (from Step 2-6).

image 9
Windows Server Configuration

5. Select the services to monitor (e.g., CPU, Memory, Disk, Services).

NOTE: The default thresholds for the disk and memory space are a bit low, we recommended changing them to reflect your usage

image 34
Services to monitor
image 15
services to monitor
image 12
services to monitor

Click Next

6. Configure the Monitoring Settings:

The default is set to monitor every 5 minutes. When there is potential problem, it will recheck every one minute up to 5 times before sending a notification.

image 16
monitoring settings

Click Next

7. Configure Notification Settings:

image 17
notificaitons

Click Next

8. Add your Windows Server to any Host Groups, Service Groups, or Parent Host

image 18
Host Groups, Service Groups, or Parent Host

Click Next

9. Click Finish and Apply to finalize the configuration, or select Save as Template to use the same settings for future Windows servers.

image 19
Finish & Apply
image 21
Successful Install

Step 6: Confirm Monitoring of Windows Server on Nagios XI

1. on Nagios XI. Navigate to View > Host Detail

image 25
View > Host Detail

2. Select the Host in question:

image 26
select server

3. Confirm services are being monitored:

image 27
confirm services being monitored

Troubleshooting

Confirm firewall ports are open

NCPA by default uses port 5693. You can confirm this port is open by running netstat -an | findstr :5693

If port 5693 is open and listening, you will see output like:

image 30
confirm firewall port

NCPA expected to open this port during installation. If needed, the below command can be used to open it manually:

netsh advfirewall firewall add rule name="Allow Port 5693 Inbound" dir=in action=allow protocol=TCP localport=5693

Error opening file (servicemanager.pyd)

Example of Error:

image 31
servicemanager.pyd error

This issue can occur if NCPA was previously uninstalled, but a reboot was never performed. Reboot your Windows server and retry the install.

NCPA Installs, but fails to start after reboot

Check if Windows Event view for:

A timeout was reached (30000 milliseconds) while waiting for the Nagios Cross-Platform Agent service to connect.

The Nagios Cross-Platform Agent service failed to start due to the following error:
The service did not respond to the start or control request in a timely fashion.

If so, then set the Nagios Cross-Platform Agent to Startup Type of Automatic (Delayed Start)

Press Windows Key + R, type services.msc, and press Enter.

image 1
Windows + R – services.msc

Right-click on Nagios Cross-Platform Agent and select Properties

image 32
right-click – properties

Select the Startup type drop down box and select Automatic (Delayed Start)

image 33
general tab

Click OK


If you have additional questions or other support-related questions, please visit Nagios Support. The Nagios Support Knowledgebase is also a great support resource.

Share this post