Now comes the fun part...tailoring Nagios to your environment!
Configuring the Windows Clients
Before we start configuring Nagios to look at our servers, we need to prep the servers by installing a client service on them to help collect data.
Look at
SourceForge.net for the latest Win32 zip file. The version I have and that this documentation is referring to is 0.3.9. This will be much easier to rollout than the MSI file...trust me.
I also do not want the Nagios clients installed on the servers to communicate to anything but the Nagios server and must also use a password for additional security and utilize a non-default port number (anything but 12489)
Now extract the zip file to a folder called "NSClient" (or extract it and then rename the folder). Preferable location would be on your file server where you keep your other software to distribute and is accessible by all servers.
Edit the
nsc.ini file.
In the "modules" section, uncomment the 1st block of DLL files by removing the semicolon which should look like this when done:
Code: Select all
[modules]
;# NSCLIENT++ MODULES
;# A list with DLLs to load at startup.
; You will need to enable some of these for NSClient++ to work.
; ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
; * *
; * N O T I C E ! ! ! - Y O U H A V E T O E D I T T H I S *
; * *
; ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
FileLogger.dll
CheckSystem.dll
CheckDisk.dll
NSClientListener.dll
NRPEListener.dll
SysTray.dll
CheckEventLog.dll
CheckHelpers.dll
CheckWMI.dll
CheckNSCP.dll
;
; Script to check external scripts and/or internal aliases.
;CheckExternalScripts.dll
;
; NSCA Agent if you enable this NSClient++ will talk to NSCA hosts repeatedly (so dont enable unless you want to use NSCA)
;NSCAAgent.dll
;
; LUA script module used to write your own "check deamon".
;LUAScript.dll
;
; RemoteConfiguration IS AN EXTREM EARLY IDEA SO DONT USE FOR PRODUCTION ENVIROMNEMTS!
;RemoteConfiguration.dll
; Check other hosts through NRPE extreme beta and probably a bit dangerous! :)
;NRPEClient.dll
; Extreamly early beta of a task-schedule checker
;CheckTaskSched.dll
In the "Settings" section, you need to uncomment "allowed_hosts" and set it equal to your Nagios server's IP address. Also uncomment "password" and set it to
myservicepass. It should look something like this:
Code: Select all
[Settings]
;# OBFUSCATED PASSWORD
; This is the same as the password option but here you can store the password in an obfuscated manner.
; *NOTICE* obfuscation is *NOT* the same as encryption, someone with access to this file can still figure out the
; password. Its just a bit harder to do it at first glance.
;obfuscated_password=Jw0KAUUdXlAAUwASDAAB
;
;# PASSWORD
; This is the password (-s) that is required to access NSClient remotely. If you leave this blank everyone will be able to access the daemon remotly.
password=myservicepass
;
;# ALLOWED HOST ADDRESSES
; This is a comma-delimited list of IP address of hosts that are allowed to talk to the all daemons.
; If leave this blank anyone can access the deamon remotly (NSClient still requires a valid password).
; The syntax is host or ip/mask so 192.168.0.0/24 will allow anyone on that subnet access
allowed_hosts=192.168.107.21
;
;# USE THIS FILE
; Use the INI file as opposed to the registry if this is 0 and the use_reg in the registry is set to 1
; the registry will be used instead.
use_file=1
;
; # USE SHARED MEMORY CHANNELS
; This is the "new" way for using the system tray based on an IPC framework on top shared memmory channels and events.
; It is brand new and (probably has bugs) so dont enable this unless for testing!
; If set to 1 shared channels will be created and system tray icons created and such and such...
;shared_session=0
I am not a fan of default settings so we are going to change the default communication port number from 12489 to 12500. In the "NSClient" section, uncomment "port" and change the value to 12500. Even if you do not change it from the default, you should still uncomment it to ensure it uses that exact port. It should look something like this:
Code: Select all
[NSClient]
;# ALLOWED HOST ADDRESSES
; This is a comma-delimited list of IP address of hosts that are allowed to talk to NSClient deamon.
; If you leave this blank the global version will be used instead.
;allowed_hosts=
;
;# NSCLIENT PORT NUMBER
; This is the port the NSClientListener.dll will listen to.
port=12500
;
;# BIND TO ADDRESS
; Allows you to bind server to a specific local address. This has to be a dotted ip adress not a hostname.
; Leaving this blank will bind to all avalible IP adresses.
;bind_to_address=
;
;# SOCKET TIMEOUT
; Timeout when reading packets on incoming sockets. If the data has not arrived withint this time we will bail out.
;socket_timeout=30
That concludes the changes to the nsc.ini file. Save and close it.
Now create a new text file in the same folder called "service-install.txt" and copy the following into it:
Code: Select all
@ECHO OFF
NSClient++.exe -install
START NET START NSClientpp /WAIT
PAUSE
Now create another text file called "service-uninstall.txt" and copy the following into it:
Code: Select all
@ECHO OFF
START NET STOP NSClientpp /WAIT
NSClient++.exe -uninstall
PAUSE
If you cannot see the .txt extension of known files, you might have to change windows to allow you to view the file extensions. This is important because you now need to rename both of those files from .txt to .bat. If you don't know how, then open a command prompt, change to the drive and folder where the files are located and type "ren service-install.txt service-install.bat"
All you have to do now is copy this "NSClient" folder to your server's C: drive (or wherever) and double-click on the "service-install.bat" file to install the service and start it up. No reboot required! If you want to uninstall it from the server, simply double-click the "service-uninstall.bat" which will stop the service and then remove it. You are then free to delete the folder. No reboot required!
The Win32 NSClient folder will work for your 64-bit servers as well. The only problem is if you need to check for the existence of running processes such as Explorer.exe or Notepad.exe which are 64-bit. The Win32 client cannot properly detect 64-bit programs. If this specific case is required, you can instead install the 64-bit MSI installer and manually configure it. NOTE: The 0.3.9 version does not have a 64-bit client, you will need to go back one revision to 0.3.8 to find one.
Nagios Configuration Files
As noted once already, I have several Windows and Linux servers that I will want to monitor. Each will have some common items and many will have unique items to monitor or some degree of variation.
I've opted to organize the structure where each server will have its own configuration file. To make things a bit easier, I will configure Nagios to simply look in a server folder to find all the configuration files rather than listing each one in the main configuration file.
The 1st server I configure will contain the most common aspects to all servers...basically being the most complex. Once configured, I then copy that file to a new server file and change the parts specific to the new server and remove any bits that do not apply.
...WILL COME BACK LATER...
Researching
Linux server clients