Nagwin - Nagios for Windows

Nagwin is a Nagios implementation for Windows systems. It is a packaging of Nagios Core and many other related tools to make it a complete and ready-to-use solution for system monitoring. You can use Nagwin to monitor your IT-infrastructure Nagios-way from Windows.

Nagios is a powerful monitoring system that enables organizations to identify and resolve IT infrastructure problems before they affect critical business processes. Nagios monitors your entire IT infrastructure to ensure systems, applications, services, and business processes are functioning properly. In the event of a failure, Nagios can alert technical staff of the problem, allowing them to begin remediation processes before outages affect business processes, end-users, or customers. Cygwin is a Linux-like environment for Windows. It consists of a DLL (cygwin1.dll), which emulates substantial Linux API functionality, and a collection of tools. Following tools are also a part of Nagwin: Nginx, Php, Perl, Net-SNMP, Pnp4NagiosRRDTool and Blat.

 

Itefix provides a virtual test lab in where you can try our products with full functionality. At the moment we have 7 hosts (Windows 7, Windows 2008 R2, Windows 2012 R2, Windows 10, Windows 2016, Windows 2019 and Lubuntu 16.04 for Unix scenarios). Our lab has no Internet access. All lab computers are refreshed every three hours.

Itefix software is available via a URL on the desktop. You have also access to some popular 3rd party software to test client scenarios. Download the software to lab computers which share the same network, so it is possible to experiment with multiple hosts. A network diagram showing the connectivity is available via the URL.

Our lab has also a Lubuntu 16.04 desktop to test Unix/X windows scenarios. In the case you need to login via ssh from an other test computer, you can use following credentials: user lab1user, pwd user1lab

Nagwin - Nagios for Windows
USD 295.00

The product consists of the Nagwin installer for 64-bit systems.

No limitations on the number of hosts that can be monitored.

Quantity is the number of computers to install the product.

Supported platforms : Vista/2008(R2)/7/8/2012(R2)/10/2016
 

Nagwin comes as a ZIP file containing an installer. Simply unzip your downloaded copy and run the package "Nagios_x.x.x_Installer.exe" :

  1. Accept License agreement.
  2. Specify an installation location.
  3. Specify a service account.
  4. Installation starts. By clicking 'Details' button, you can get more detailed information about installation. Check if everything seems ok.

At the end of the installation, Nagwin gives you some information about how to start. Simply start Nagwin services and point your browser to http://localhost.

Nagwin uses Nginx as web backend with PHP in FastCGI mode. As Nginx doesn't support CGI, a FastCGI wrapper is developed to serve Nagios CGIs.


Nagwin contains standard Nagios Core and should be able to monitor any device as long as you have monitoring plugins for it. Nagwin has already a small set of plugins ready to use in the /plugins directory, and there are a large number of plugins available at Nagios Exchange. However, due to Nagwin's limited environment and Windows, there may be a limited support. You need to try and find out yourself. 

 

 

 

By default, Nagwin is configured to monitor your local machine. See following pages for some basic examples. Nagios configuration files are located at etc\nagios directory. Main configuration file nagios.cfg is configured to accept all configuration files in the subdirectory nagwin.  Consult available Nagios documentation to move forward and extend your implementation. In the case there are discrepancies, you can use Nagwin forum available on this site.

For notification purposes, you can use blat, which is installed as a part of the package (see Nagios.cfg for examples).

 

 

 

PHP FastCGI crashing after heavy use of pnp4nagios

You need to increase the number of php-cgi processes (default is 1, parent process, terminates under heavy load)

  • run the following command from a command window (run as administrator):

setx PHP_FCGI_CHILDREN 2 /M

  • Restart Nagwin_Phpfcgi service
This will increase the number of working php-cgi processes to 2 (You may see up to three php-cgi processes in the task list as the one is parent process managing the others) and should be enough for most uses. You may increase it if your implementation still suffers.
 
Related background information FastCGI PHP:
 
There are a few tuning parameters that can be tweaked to control the
performance of FastCGI PHP. The following are environment variables that can
be set before running the PHP binary:
 
PHP_FCGI_CHILDREN  (default value: 0)
 
This controls how many child processes the PHP process spawns. When the
fastcgi starts, it creates a number of child processes which handle one
page request at a time. Value 0 means that PHP willnot start additional
processes and main process will handle FastCGI requests by itself. Note that
this process may die (because of PHP_FCGI_MAX_REQUESTS) and it willnot
respawned automatic. Values 1 and above force PHP start additioanl processes
those will handle requests. The main process will restart children in case of
their death. So by default, you will be able to handle 1 concurrent PHP page
requests. Further requests will be queued. Increasing this number will allow
for better concurrency, especially if you have pages that take a significant
time to create, or supply a lot of data (e.g. downloading huge files via PHP).
On the other hand, having more processes running will use more RAM, and letting
too many PHP pages be generated concurrently will mean that each request will
be slow.
 
PHP_FCGI_MAX_REQUESTS (default value: 500)
 
This controls how many requests each child process will handle before
exitting. When one process exits, another will be created. This tuning is
necessary because several PHP functions are known to have memory leaks. If the
PHP processes were left around forever, they would be become very inefficient.
 

How to monitor Nagwin itself ?

As you use Nagwin to monitor other hosts, you may wonder how the Nagwin itself can be monitored. This can be achieved by checking status.dat file age and existence of key processes. Here is a recipe to establish an out-of-band monitoring of Nagwin:

  • Make sure that your Nagwin installation is configured to send notifications. See FAQ for instructions.
  • Create bin/check_nagwin.sh script with the content below (Unix-format):
#!/bin/bash
# customize - start
server=smtp.server
# customize - end
 
instroot=$(cygpath -m /)
logdir=/var/log/check_nagwin
mkdir -p $logdir
logfile=$logdir/$(date +"%d").log
echo "***" `date` >> $logfile
 
# Function to report failure, message body as argument
CheckFail ()
{
printf "$1" | /bin/blat - -to $to -f $from -subject "Nagwin is not operational" -server $server >> $logfile
exit 1
}
 
# Function to check a process, process name and expected number of instances as arguments
CheckProcess ()
{
/plugins/check_winprocess --filter "imagename eq $1.exe" --compare lt --critical $2 >> $logfile
if (($? > 0)); then
CheckFail "Must be at least $2 $1 process(es) running."
fi
}
 
# check status.dat age
/plugins/check_winfile --target "$instroot/var/opt/nagios/status.dat" --filter "age lt -15 minutes" --critical 1 --compare eq >> $logfile
if (($? > 0)); then
CheckFail "Nagios status.dat getting old."
fi

# check processes

CheckProcess nagios 4
CheckProcess nginx 2
CheckProcess php-cgi 1
CheckProcess cgi2fcgi-wrapper 1
printf "\n" >> $logfile

You need to customize mail configuration (red) according to your setup. The script above checks if status.dat is updated within the last 15 minutes and if key processes are running with an expected number of intances. It will send an e-mail if any of the criteria are not met. Results from checks will be logged in /var/log/check_nagwin directory in a rotating manner for days of a month.

  • Create a Windows scheduled task by using the following command:

schtasks /create /sc minute /mo 15 /tn check-nagwin /tr "nagwin-inst-dir\bin\bash.exe -c /bin/check_nagwin.sh"

This command will create the scheduled task check-nagwin running the script above each 15 minutes.

How to enable Active Directory authentication for Nagwin ?

As of version 2.4.0, Nagwin's Nginx web server has built-in support for LDAP authentication allowing you to use AD authentication. Follow steps below:

  • Create a dedicated AD service account for LDAP queries (say ldapreq, domain example.local)
  • Start a text editor capable of editing a text file with Unix line endings (Wordpad or Notepad++ for example)
  • Edit file <Nagwin installation directory>\etc\nginx\nginx.conf
http {
....
ldap_server DCGC1 {
    url ldap://192.168.0.1:3268/DC=example,DC=local?sAMAccountName?sub?(objectClass=person);
    binddn "CN=xxxxx,CN=xxxxx,DC=example,DC=local";
    binddn_passwd password;
    group_attribute uniquemember;
    group_attribute_is_dn on;
    require valid_user;
}
 
ldap_server DCGC2 {
    url ldap://192.168.0.2:3268/DC=example,DC=local?sAMAccountName?sub?(objectClass=person);
    binddn "CN=xxxxx,CN=xxxxx,DC=example,DC=local";
    binddn_passwd password;
    group_attribute uniquemember;
    group_attribute_is_dn on;
    require valid_user;
}
  • Replace every occurence of
auth_basic "Restricted";
auth_basic_user_file htpasswd;
 
by
 
auth_ldap "Restricted";
auth_ldap_servers DCGC1,DCGC2;
 
NB! if you want basic authentication still available, you can simply add the ldap directives above instead of replacement. It is also possible to use groups. Check example configuration link below for more details.
 
  • Make sure that contact information is defined in the Nagios configuration for each AD user
  • Restart Nagwin_Nginx service
 
Useful links:
 

How to enable SSL secure communications for the Nagwin web server ?

Nagwin's Nginx web server has a built-in support for SSL communications. Assuming that you have required certificate files located at the etc/nginx/ssl directory, you may follow steps below to enable secure communications:

  • Start a text editor capable of editing a text file with Unix line endings (Wordpad or Notepad++ for example)
  • Edit file <Nagwin installation directory>\etc\nginx\nginx.conf:
.....
server {
       listen         80;
       server_name    your.server.name;
       return         301 https://$server_name$request_uri;
}
 
server {
listen 443 ssl;
ssl on;
ssl_certificate /etc/nginx/ssl/your.server.name.crt;
ssl_certificate_key /etc/nginx/ssl/your.server.name.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_protocols TLSv1.2;
 
 server_name  your.server.name;
 
... rest of the Nagwin related configuration
 
  • Setup above will automatically redirect http requests to https, making your server communicate securely all the time. 
  • Restart Nagwin_Nginx service
Useful links:
 

I get user error when I run "Check Nagios configuration" from the start menu !

FAQ

 

That may happen if your account is not properly defined as a user recognizable by the Cygwin layer, which provides user/group facilities. Try steps below:

 

  • Open a bash prompt by clicking <inst. directory>/bin/bash.exe
  • Run following commands:

 

mkpasswd > /etc/passwd

mkgroup > /etc/group

How can I get notified by e-mail in Nagwin ?

 

  • Nagwin has blat smtp mailer included. The first step is to let blat save your smtp server settings for later use:

bin/blat -SaveSettings -f from-address -server your.smtp.server [ -u login -pw password ]

 

  • You need also to specify your e-mail address for the contact nagiosadmin in etc/nagios/nagwin/contacts.cfg:

define contact{
        contact_name   nagiosadmin ; .....
        use generic-contact ; .....
        alias  Nagios Admin ; .....

        email ******@******    ; << CHANGE THIS TO YOUR EMAIL ADDRESS
}

 

  • As a last step, You need to update smtp server information in two notification commands etc/nagios/nagwin/commands.cfg:

# 'notify-host-by-email' command definition
define command{
    command_name    notify-host-by-email
    command_line    /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/blat - -to $CONTACTEMAIL$ -subject "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" -server smtp.server
    }

# 'notify-service-by-email' command definition
define command{
    command_name    notify-service-by-email
    command_line    /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/blat - -to $CONTACTEMAIL$ -subject "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" -server smtp.server
    }

Replace smtp.server by name/ip of your smtp server (your Exchange server for example). Make sure that your smtp server is configured to accept smtp requests from Nagwin machine.

  • Restart the Nagwin_Nagios service to apply changes.

 

You can issue the command below to test if your mail notification works:

echo "Test message" | bin\blat - -to mail@address -f from@address -subject "Test mail" -server smtp.server

 

How can I change the port number of Nagwin's built-in web server ?

You may observe that the Nagios web interface is not available directly via http://localhost, http://hostname or http://ip-address, because of the standard http port 80 is occupied by an other web server (IIS for example). The procedure below helps you to configure Nagwin web server to listen to an alternative port:

  • Start a text editor capable of editing a text file with Unix line endings (Wordpad for example)
  • Edit file <Nagwin installation directory>\etc\nginx\nginx.conf:
....   
server {
 listen 80; <-- replace by a new port, 2080 for example
        server_name  localhost;
....
  • Restart Nagwin_Nginx service.

What are the default login credentials for Nagwin and how can I change the password ?

Default password for the nagiosadmin user is nagios. It is strongly recommended that you change the password by using the procedure below:

  • Open a DOS command prompt
  • Change working directory to the Nagwin installation directory\bin (C:\Program Files\ICW\bin by default)
  • Run the following command to update the password:

htpasswd2 -b /etc/nginx/htpasswd nagiosadmin new-password

This package contains components with different terms of licensing:

Component Version Licensing
Nagios Core with a patch for external commands via plain files 4.4.5

Nagios license (GPL) Source code for Nagios is available here.

See attachments below for the patches

Nginx 1.17.3 Nginx license
Php 5.6.36 PHP License 

This product includes PHP software, freely available from <http://www.php.net/software/>

Cygwin and GNU tools 3.0.7 CYGWIN license (GPL) Source code for Cygwin and GNU Tools are available here.
Perl 5.26 Perl license
Net-SNMP 5.7.3 Net-SNMP license
Pnp4Nagios 0.6.26 Pnp4Nagios License
RRDTool 1.7.0 RRDTool license (GPL) Source code for RRDTool is available here.
Blat 2.7.6 Blat license
Nagwin (installer/tools)

3.4.0

Product edition: Itefix EULA