- Password expiration email notification with PowerShell - Mon, Aug 26 2013
- WSUS basics and troubleshooting tips - Mon, Sep 24 2012
- FREE: SolarWinds Diagnostic Tool for the WSUS Agent - Fri, Jul 13 2012
Nagios is one of the most popular Open Source IT infrastructure monitoring tools available. Originally developed to monitor network hosts for uptime, latency, and health, Nagios has been extended to perform a variety of functions through its plugin interface. Though it is Open Source and generally intended for the Linux crowd, the folks at IteF!x have developed a port of Nagios for Windows - or Nagwin - to allow a Windows host to run the Nagios process.
Nagwin - A complete Nagios implementation for Windows
Installing Nagwin ^
Nagwin uses several packages to acheive Nagios functionality on Windows, including lightweight versions of Cygwin (a Linux API for Windows), PHP, Perl, Blat (SMTP server), and Nginx (web server). Thankfully all of these are included in the download for Nagwin at SourceForge.
Once you download the installer, unzip and run the resultant Nagwin_1.2.0_Installer executable to get started. During the installation, you will be prompted for where you want to put the “ICW” folder (the cygwin root). I like to put this directly on the hard drive so it is easy to get to “C:\ICW,” but this is a matter of personal taste. Next, you will be prompted to enter a service account name and password. Accepting the defaults here is fine unless you would rather use an existing service account. The password that is prepopulated is randomly generated and if you accept defaults you should save this password somewhere safe. Click “Install” to proceed.
Configuring the Nagios process ^
Assuming you want Nagios to start automatically when your server starts, you should run the MMC console “services.msc” and scroll down to where all of the Nagwin services are. By default, these are manual startup services. If you go to Properties for each service you can configure them for an automatic startup. If they are running already, go ahead and stop them.
By default, the Nagios admin account (nagiosadmin) has the password “nagios” and that will not do, so let’s go ahead and change it. In a command prompt window, navigate to the ICW directory that you chose in the installation, then navigate to the “bin” folder. Now, run the command, replacing the italicized bit with your desired password:
htpasswd2 -b /etc/nginx/htpasswd nagiosadmin <em>your_password_here</em>
You can create additional accounts but that’s what we will use for now. You can also change the port that is used to access the web management interface. By default, this is port 80, but you will probably want to change it to a lesser known (and less likely to conflict) port. I chose port 81 but you can choose any TCP port that is not already in use. To do so, navigate to the folder “\etc\nginx\nginx.conf” under the ICW directory and find the “server” block. Now change the “listen” directive from 80 to whatever you desire.
Configuring Nagios to monitor a host ^
Now the real work begins. Let’s assume that our Nagios server is located at 10.1.1.14 in a 10.1.1.0/24 subnet, and that we want to monitor another Windows host located at 10.1.1.10 (called “fileserver”) on the same subnet. To monitor the host we simply define a new host in the file “\etc\nagios\nagwin\hosts.cfg” and restart (or start) the Nagios process. First, open the hosts.cfg file in your favorite text editor (if it does not exist, create the hosts.cfg file in the “\etc\nagios\nagwin” directory). Using our example above, the host configuration is as follows:
# Define a host for the local machine
Note: alias is simply what Nagios calls the host, and in many cases it is appropriate to have the alias match the host_name. The important pieces here are the use, host_name, and address directives.
That’s it! Now we need to start all of our Nagwin services (there are four) in services.msc.
Once you have started these services, navigate to http://localhost:PORT_NUMBER and login using the username “nagiosadmin” and the password you defined earlier. Go to “Hosts” and voilà! Our newly defined host should appear along with “localhost” (where the Nagios process is located). You will notice that it provides detail regarding packet loss, latency (ping), and host uptime. Nagios saves this information in a repository that allows systems administrators to check the health of hosts as well as connectivity.
Nagwin - Connectivity
In the next guide we will learn about Winrpe, a small daemon installed on Windows hosts to provide more detailed information about their health - CPU load, memory information, event logs and statuses - so that the Nagios process can probe these services and provide the administrator the information he or she needs to nip Windows host problems in the bud.