Configuring Nagios on Windows/IIS - cygwin

Tom Loebach loebach at yahoo.com
Wed Feb 2 05:31:38 CET 2005


Running Nagios on Windows

Here is a detailed guide on configuring Nagios to run on a Windows/IIS system. This guide is more about the "how" than the "why".

----

Required Software.

----

1. Cygwin

Cygwin is required to run Nagios.

Install cygwin by using the installaller located at http://sources.redhat.com/cygwin/setup.exe.

You will need to install the following cygwin packages and their dependencies:

o apache

o cygrunsrv

o gcc 

o gd

o jpeg

o libgd-devel

o libgd2

o libpng12-devel

o libpng12

o make

o perl

2. Nagios

Download Nagios from http://www.nagios.org/download/. Use version 1.2.

3. Nagios Plugins

Download Nagios Plugins from http://sourceforge.net/project/showfiles.php?group_id=29880. Use version 1.3.1

----

Building Nagios

----

1. Create a new user in windows with the username "nagios". Open a cygwin bash shell and run the commands:

# mkpasswd -l > /etc/passwd

# mkgroup -l > /etc/group 

to synchronize the windows user database with the cygwin /etc/passwd and /etc/groups file.

2. Build Nagios

Open a cygwin bash shell and untar the Nagios packages:

# tar xvzf nagios-1.2.tar.gz

# tar xvzf nagios-plugins-1.3.1

Run the configure script in the nagios-1.2 directory:

./configure --enable-cygwin --with-nagios-grp=Administrators

Build the software:

# make all

Install the software:

# make install

# make install-config

3. Build Nagios Plugins

Run the configure script in the nagios-plugins-1.3.1 directory:

./configure

Build the software. The "check_procs", "check_vsz", "check_dns", "check_by_ssh" and "check_swap" cannot be built in cygwin. The "-i" flag needs to be included to bypass the make errors.

# make -i all

Install the plugins:

# make -i install

----

Configuring IIS for Nagios.

----

It is possible to run Nagios on IIS. It is a hack but it can be done. Here are the steps to get this to work:

1. Add cygwin dll's to Windows system path

Add the e:\cygwin\bin and e:\cygwin\usr\X11R6\bin to your system path. My cygwin install lives on my e: drive under the \cygwin directory. IIS needs to be able to run the CGI's and the CGI's need the cygwin dll's.

2. Create a share to your cygwin install and mount it.

Share your cygwin root as "cygwin". For example my e:\cygwin directory is shared as "cygwin".

Locally mount the share.

# net use T: \\localhost\cygwin /persistent:yes

This will "chroot" the Windows cygwin structure.

3. Configure IIS

Add a virtual directory called "nagios" with the local path "T:\usr\local\nagios\share".

Under the "nagios" virtual directory, add another virtual directory called "cgi-bin" with the local path "T:\\usr\\local\\nagios\\sbin". Notice the "\\" syntax. This is very important, your cgi's will not run if you do not do this. 

Make sure your cgi-bin virtual directory can execute programs.

----

Configuring Apache for Nagios.

----

You can also configure Nagios to use apache rather than IIS as the web server. Follow the normal Nagios instructions for configuring an apache web server. Use cygwin's apache rather than the native Win32 apache. If you use the Win32 apache you will need to add the cywin dll's to the system path.

----

Test Nagios

----

Point your browser to "http://localhost/nagios/index.html". Your cgi's will not work yet, you will need to create your nagios.cfg, cgi.cfg and supporting config files. You may also need to restart IIS to get the cgi's to load.

----

Configure Nagios Hosts and Services

----

The sample config files in /usr/local/nagios/etc will need to be configured for your local environment. Follow the documented Nagios instructions to create a working configuration for your environement.

----

Configure Nagios to run as a service

----

These commands install Nagios as a windows service:

# cygrunsrv --install nagios -p /usr/local/nagios/bin/nagios.exe -a /usr/local/nagios/etc/nagios.cfg

# net start nagios

----

Problems with Nagios on WIndows

----

1. The ping command on Windows does not provide suitable output for Nagios. The check_ping and check-host-alive commands will not work. There is a standalone ping package provided in the cygwin setup, but it hangs the Nagios configure script and also does not produce suitable output. The linux ping command is provided in the inetutils package but the cygwin build of inetutils left out the ping command. Also, the cygwin inetutils package is using a very old version. 

I was able to download inetutils-1.4.0.tar.gz and inetutils-1.4.2.tar.gz and build a usable ping.exe in cygwin. Unfortunately, it is not as simple as running configure and "make all". First, you need to copy the xmalloc.c from the 1.4.0 tree into the 1.4.2 tree. Then, you need to run make -i and then go into the ping directory and do a "make ping.exe". Copy the built ping.exe to /usr/bin. Rerun the nagios-plugins configure script, rebuild and reinstall to pick the new ping.exe.

2. I have only tested the check_http command and it seems to work fine. I have no idea how well the other check_* commands work.

3. Authentication.

If you are using IIS, set use_authentication=0 in cgi.cfg. IIS authentication does not seem to work with the Nagios authentication mechanism. You can still authenticate the cgi-bin pages with IIS but the underlying security in Nagios will not be used.

----

nrpe and nsclient

----

Nsclient, nrpe_nt and nrpe work with Nagios on cygwin. 

----------------------------

Good luck in setting this up. If you are monitoring mission critical systems, you may want to consider running Nagios on a Linux system rather than trying to run Nagios on Windows with cygwin.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20050201/fa305178/attachment.html>


More information about the Users mailing list