~ubuntu-branches/ubuntu/saucy/nagios3/saucy-proposed

« back to all changes in this revision

Viewing changes to html/docs/monitoring-windows.html

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Wirt
  • Date: 2009-08-16 14:14:23 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20090816141423-efjzq1r3jekwd7l7
Tags: 3.2.0-1
* New upstream release (Closes: #542957)
  - Timeperiods should work as expected now (Closes: #539882)
  - Recovery notifications fixed (Closes: #543657)
* Update standards version 
  - Add README.source
* Manpage errors fixed (Closes: #540554)
* Split up the webfrontend into its own package (Closes: #479338, #485466)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
 
 
3
 
<html>
4
 
<head>
5
 
<title>Monitoring Windows Machines</title>
6
 
 
7
 
<STYLE type="text/css">
8
 
<!--
9
 
        .Default { font-family: verdana,arial,serif; font-size: 8pt; }
10
 
        .PageTitle { font-family: verdana,arial,serif; font-size: 16pt; font-weight: bold; }
11
 
-->      
12
 
</STYLE>
13
 
 
14
 
</head>
15
 
 
16
 
<body bgcolor="#FFFFFF" text="black" class="Default">
17
 
 
18
 
<div align="center">
19
 
<img src="images/nagios.jpg" border="0" alt="Nagios" title="Nagios">
20
 
<h1 class="PageTitle">Monitoring Windows Machines</h1>
21
 
</div>
22
 
 
23
 
<hr>
24
 
 
25
 
<p>
26
 
<img src="images/upto.gif" border="0" align="middle" alt="Up To" title="Up To">Up To: <a href="toc.html">Contents</a><br>
27
 
<img src="images/seealso.gif" border="0" align="middle" alt="See Also" title="See Also"> See Also: <a href="quickstart.html">Quickstart Installation Guide</a>, <a href="monitoring-publicservices.html">Monitoring Publicly Available Services</a>
28
 
</p>
29
 
 
30
 
<p>
31
 
<strong><u>Introduction</u></strong>
32
 
</p>
33
 
 
34
 
<p>
35
 
This document describes how you can monitor "private" services and attributes of Windows machines, such as: 
36
 
</p>
37
 
 
38
 
<ul>
39
 
<li>Memory usage</li>
40
 
<li>CPU load</li>
41
 
<li>Disk usage</li>
42
 
<li>Service states</li>
43
 
<li>Running processes</li>
44
 
<li>etc.</li>
45
 
</ul>
46
 
 
47
 
<p>
48
 
Publicly available services that are provided by Windows machines (HTTP, FTP, POP3, etc.) can be monitored easily by following the documentation on <a href="monitoring-publicservices.html">monitoring publicly available services</a>.
49
 
</p>
50
 
 
51
 
<p>
52
 
<img src="images/note.gif" border="0" align="bottom" alt="Note" title="Note"> Note: These instructions assume that you've installed Nagios according to the <a href="quickstart.html">quickstart guide</a>.   The sample configuration entries below reference objects that are defined in the sample config files (<i>commands.cfg</i>, <i>templates.cfg</i>, etc.) that are installed if you follow the quickstart.
53
 
</p>
54
 
 
55
 
 
56
 
<p>
57
 
<strong><u>Overview</u></strong>
58
 
</p>
59
 
 
60
 
<img src="images/monitoring-windows.png" border="0" alt="Monitoring a Windows Machine" title="Monitoring a Windows Machine" style="float: right;">
61
 
 
62
 
<p>
63
 
Monitoring private services or attributes of a Windows machine requires that you install an agent on it.  This agent acts as a proxy between the Nagios plugin that does the monitoring and the actual service or attribute of the Windows machine.  Without installing an agent on the Windows box, Nagios would be unable to monitor private services or attributes of the Windows box.
64
 
</p>
65
 
 
66
 
<p>
67
 
For this example, we will be installing the <a href="http://sourceforge.net/projects/nscplus">NSClient++</a> addon on the Windows machine and using the <i>check_nt</i> plugin to communicate with the NSClient++ addon.  The <i>check_nt</i> plugin should already be installed on the Nagios server if you followed the quickstart guide.  
68
 
</p>
69
 
 
70
 
<p>
71
 
Other Windows agents (like <a href="http://sourceforge.net/projects/nc-net">NC_Net</a>) could be used instead of NSClient++ if you wish - provided you change command and service definitions, etc. a bit.  For the sake of simplicity I will only cover using the NSClient++ addon in these instructions.
72
 
</p>
73
 
 
74
 
 
75
 
 
76
 
<p>
77
 
<strong><u>Steps</u></strong>
78
 
</p>
79
 
 
80
 
<p>
81
 
There are several steps you'll need to follow in order to monitor a new Windows machine.  They are:
82
 
</p>
83
 
 
84
 
<ol>
85
 
<li>Perform first-time prerequisites</li>
86
 
<li>Install a monitoring agent on the Windows machine</li>
87
 
<li>Create new host and service definitions for monitoring the Windows machine</li>
88
 
<li>Restart the Nagios daemon</li>
89
 
</ol>
90
 
 
91
 
<p>
92
 
<strong><u>What's Already Done For You</u></strong>
93
 
</p>
94
 
 
95
 
<p>
96
 
To make your life a bit easier, a few configuration tasks have already been done for you:
97
 
</p>
98
 
 
99
 
<ul>
100
 
<li>A <i>check_nt</i> command definition has been added to the <i>commands.cfg</i> file.  This allows you to use the <i>check_nt</i> plugin to monitor Window services.</li>
101
 
<li>A Windows server host template (called <i>windows-server</i>) has already been created in the <i>templates.cfg</i> file.  This allows you to add new Windows host definitions in a simple manner.</li>
102
 
</ul>
103
 
 
104
 
<p>
105
 
The above-mentioned config files can be found in the <i>/usr/local/nagios/etc/objects/</i> directory.  You can modify the definitions in these and other definitions to suit your needs better if you'd like.  However, I'd recommend waiting until you're more familiar with configuring Nagios before doing so.  For the time being, just follow the directions outlined below and you'll be monitoring your Windows boxes in no time.
106
 
</p>
107
 
 
108
 
<p>
109
 
<strong><u>Prerequisites</u></strong>
110
 
</p>
111
 
 
112
 
<p>
113
 
The first time you configure Nagios to monitor a Windows machine, you'll need to do a bit of extra work.  Remember, you only need to do this for the *first* Windows machine you monitor.
114
 
</p>
115
 
 
116
 
<p>
117
 
Edit the main Nagios config file.
118
 
</p>
119
 
 
120
 
<pre>
121
 
vi /usr/local/nagios/etc/nagios.cfg
122
 
</pre>
123
 
 
124
 
<p>
125
 
Remove the leading pound (#) sign from the following line in the main configuration file:
126
 
</p>
127
 
 
128
 
<pre>
129
 
#cfg_file=/usr/local/nagios/etc/objects/windows.cfg
130
 
</pre>
131
 
 
132
 
<p>
133
 
Save the file and exit.
134
 
</p>
135
 
 
136
 
<p>
137
 
What did you just do?  You told Nagios to look to the <i>/usr/local/nagios/etc/objects/windows.cfg</i> to find additional object definitions.  That's where you'll be adding Windows host and service definitions.  That configuration file already contains some sample host, hostgroup, and service definitions.  For the *first* Windows machine you monitor, you can simply modify the sample host and service definitions in that file, rather than creating new ones.
138
 
</p>
139
 
 
140
 
 
141
 
<p>
142
 
<strong><u>Installing the Windows Agent</u></strong>
143
 
</p>
144
 
 
145
 
<p>
146
 
Before you can begin monitoring private services and attributes of Windows machines, you'll need to install an agent on those machines.  I recommend using the NSClient++ addon, which can be found at <a href="http://sourceforge.net/projects/nscplus">http://sourceforge.net/projects/nscplus</a>.  These instructions will take you through a basic installation of the NSClient++ addon, as well as the configuration of Nagios for monitoring the Windows machine.
147
 
</p>
148
 
 
149
 
<p>
150
 
1. Download the latest stable version of the NSClient++ addon from <a href="http://sourceforge.net/projects/nscplus">http://sourceforge.net/projects/nscplus</a>
151
 
</p>
152
 
 
153
 
<p>
154
 
2. Unzip the NSClient++ files into a new C:\NSClient++ directory
155
 
</p>
156
 
 
157
 
<p>
158
 
3. Open a command prompt and change to the C:\NSClient++ directory
159
 
</p>
160
 
 
161
 
<p>
162
 
4. Register the NSClient++ system service with the following command:
163
 
</p>
164
 
 
165
 
<pre>
166
 
        nsclient++ /install
167
 
</pre>
168
 
 
169
 
<p>
170
 
5. Install the NSClient++ systray with the following command ('SysTray' is case-sensitive):
171
 
</p>
172
 
 
173
 
<pre>
174
 
        nsclient++ SysTray
175
 
</pre>
176
 
 
177
 
<p>
178
 
6. Open the services manager and make sure the NSClientpp service is allowed to interact with the desktop (see the 'Log On' tab of the services manager).  If it isn't already allowed to interact with the desktop, check the box to allow it to.
179
 
</p>
180
 
 
181
 
<p>
182
 
<img src="images/nscpp.png" border="0" alt="NSClientpp">
183
 
</p>
184
 
 
185
 
<p>
186
 
7. Edit the NSC.INI file (located in the C:\NSClient++ directory) and make the following changes:
187
 
</p>
188
 
 
189
 
<ul>
190
 
<li>Uncomment all the modules listed in the [modules] section, except for CheckWMI.dll and RemoteConfiguration.dll</li>
191
 
<li>Optionally require a password for clients by changing the 'password' option in the [Settings] section.</li>
192
 
<li>Uncomment the 'allowed_hosts' option in the [Settings] section.  Add the IP address of the Nagios server to this line, or leave it blank to allow all hosts to connect.</li>
193
 
<li>Make sure the 'port' option in the [NSClient] section is uncommented and set to '12489' (the default port).</li>
194
 
</ul>
195
 
 
196
 
 
197
 
<p>
198
 
8. Start the NSClient++ service with the following command:
199
 
</p>
200
 
 
201
 
<pre>
202
 
        nsclient++ /start
203
 
</pre>
204
 
 
205
 
<p>
206
 
9. If installed properly, a new icon should appear in your system tray.  It will be a yellow circle with a black 'M' inside.
207
 
</p>
208
 
 
209
 
<p>
210
 
10. Success! The Windows server can now be added to the Nagios monitoring configuration...
211
 
</p>
212
 
 
213
 
 
214
 
<p>
215
 
<strong><u>Configuring Nagios</u></strong>
216
 
</p>
217
 
 
218
 
<p>
219
 
Now it's time to define some <a href="objectdefinitions.html">object definitions</a> in your Nagios configuration files in order to monitor the new Windows machine. 
220
 
</p>
221
 
 
222
 
<p>
223
 
Open the <i>windows.cfg</i> file for editing.
224
 
</p>
225
 
 
226
 
<pre>
227
 
vi /usr/local/nagios/etc/objects/windows.cfg
228
 
</pre>
229
 
 
230
 
<p>
231
 
Add a new <a href="objectdefinitions.html#host">host</a> definition for the Windows machine that you're going to monitor.   If this is the *first* Windows machine you're monitoring, you can simply modify the sample host definition in <i>windows.cfg</i>. Change the <i>host_name</i>, <i>alias</i>, and <i>address</i> fields to appropriate values for the Windows box.
232
 
</p>
233
 
 
234
 
<pre>
235
 
define host{
236
 
        use             windows-server  ; Inherit default values from a Windows server template (make sure you keep this line!)
237
 
        host_name               winserver
238
 
        alias           My Windows Server
239
 
        address         192.168.1.2
240
 
        }
241
 
</pre>
242
 
 
243
 
<p>
244
 
Good. Now you can add some service definitions (to the same configuration file) in order to tell Nagios to monitor different aspects of the Windows machine.  If this is the *first* Windows machine you're monitoring, you can simply modify the sample service definitions in <i>windows.cfg</i>. 
245
 
</p>
246
 
 
247
 
<p>
248
 
<img src="images/note.gif" border="0" align="bottom" alt="Note" title="Note"> Note: Replace "<i>winserver</i>" in the example definitions below with the name you specified in the <i>host_name</i> directive of the host definition you just added.
249
 
</p>
250
 
 
251
 
<p>
252
 
Add the following service definition to monitor the version of the NSClient++ addon that is running on the Windows server.  This is useful when it comes time to upgrade your Windows servers to a newer version of the addon, as you'll be able to tell which Windows machines still need to be upgraded to the latest version of NSClient++.
253
 
</p>
254
 
 
255
 
<pre>
256
 
define service{
257
 
        use                     generic-service
258
 
        host_name                       winserver
259
 
        service_description     NSClient++ Version
260
 
        check_command           check_nt!CLIENTVERSION
261
 
        }
262
 
</pre>
263
 
 
264
 
<p>
265
 
Add the following service definition to monitor the uptime of the Windows server.
266
 
</p>
267
 
 
268
 
<pre>
269
 
define service{
270
 
        use                     generic-service
271
 
        host_name                       winserver
272
 
        service_description     Uptime
273
 
        check_command           check_nt!UPTIME
274
 
        }
275
 
</pre>
276
 
 
277
 
 
278
 
<p>
279
 
Add the following service definition to monitor the CPU utilization on the Windows server and generate a CRITICAL alert if the 5-minute CPU load is 90% or more or a WARNING alert if the 5-minute load is 80% or greater.
280
 
</p>
281
 
 
282
 
<pre>
283
 
define service{
284
 
        use                     generic-service
285
 
        host_name                       winserver
286
 
        service_description     CPU Load
287
 
        check_command           check_nt!CPULOAD!-l 5,80,90
288
 
        }
289
 
</pre>
290
 
 
291
 
 
292
 
<p>
293
 
Add the following service definition to monitor memory usage on the Windows server and generate a CRITICAL alert if memory usage is 90% or more or a WARNING alert if memory usage is 80% or greater.
294
 
</p>
295
 
 
296
 
<pre>
297
 
define service{
298
 
        use                     generic-service
299
 
        host_name                       winserver
300
 
        service_description     Memory Usage
301
 
        check_command           check_nt!MEMUSE!-w 80 -c 90
302
 
        }
303
 
</pre>
304
 
 
305
 
 
306
 
<p>
307
 
Add the following service definition to monitor usage of the C:\ drive on the Windows server and generate a CRITICAL alert if disk usage is 90% or more or a WARNING alert if disk usage is 80% or greater.
308
 
</p>
309
 
 
310
 
<pre>
311
 
define service{
312
 
        use                     generic-service
313
 
        host_name                       winserver
314
 
        service_description     C:\ Drive Space
315
 
        check_command           check_nt!USEDDISKSPACE!-l c -w 80 -c 90
316
 
        }
317
 
</pre>
318
 
 
319
 
 
320
 
<p>
321
 
Add the following service definition to monitor the W3SVC service state on the Windows machine and generate a CRITICAL alert if the service is stopped.
322
 
</p>
323
 
 
324
 
<pre>
325
 
define service{
326
 
        use                     generic-service
327
 
        host_name                       winserver
328
 
        service_description     W3SVC
329
 
        check_command           check_nt!SERVICESTATE!-d SHOWALL -l W3SVC
330
 
        }
331
 
</pre>
332
 
 
333
 
 
334
 
<p>
335
 
Add the following service definition to monitor the Explorer.exe process on the Windows machine and generate a CRITICAL alert if the process is not running.
336
 
</p>
337
 
 
338
 
<pre>
339
 
define service{
340
 
        use                     generic-service
341
 
        host_name                       winserver
342
 
        service_description     Explorer
343
 
        check_command           check_nt!PROCSTATE!-d SHOWALL -l Explorer.exe
344
 
        }
345
 
</pre>
346
 
 
347
 
<p>
348
 
That's it for now.  You've added some basic services that should be monitored on the Windows box.  Save the configuration file.
349
 
</p>
350
 
 
351
 
 
352
 
<p>
353
 
<strong><u>Password Protection</u></strong>
354
 
</p>
355
 
 
356
 
<p>
357
 
If you specified a password in the NSClient++ configuration file on the Windows machine, you'll need to modify the <i>check_nt</i> command definition to include the password.  Open the <i>commands.cfg</i> file for editing.
358
 
</p>
359
 
 
360
 
<pre>
361
 
vi /usr/local/nagios/etc/commands.cfg
362
 
</pre>
363
 
 
364
 
<p>
365
 
Change the definition of the <i>check_nt</i> command to include the "-s &lt;PASSWORD&gt;" argument (where PASSWORD is the password you specified on the Windows machine) like this:
366
 
</p>
367
 
 
368
 
<pre>
369
 
define command{
370
 
        command_name    check_nt
371
 
        command_line    $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -s PASSWORD -v $ARG1$ $ARG2$
372
 
        }
373
 
</pre>
374
 
 
375
 
<p>
376
 
Save the file.
377
 
</p>
378
 
 
379
 
<p>
380
 
<strong><u>Restarting Nagios</u></strong>
381
 
</p>
382
 
 
383
 
<p>
384
 
You're done with modifying the Nagios configuration, so you'll need to <a href="verifyconfig.html">verify your configuration files</a> and <a href="startstop.html">restart Nagios</a>.
385
 
</p>
386
 
 
387
 
<p>
388
 
If the verification process produces any errors messages, fix your configuration file before continuing.  Make sure that you don't (re)start Nagios until the verification process completes without any errors!
389
 
</p>
390
 
 
391
 
 
392
 
<hr>
393
 
 
394
 
</body>
 
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 
2
 
 
3
 
 
4
 
 
5
<html>
 
6
 
 
7
<head>
 
8
 
 
9
<title>Monitoring Windows Machines</title>
 
10
 
 
11
 
 
12
 
 
13
<STYLE type="text/css">
 
14
 
 
15
<!--
 
16
 
 
17
        .Default { font-family: verdana,arial,serif; font-size: 8pt; }
 
18
 
 
19
        .PageTitle { font-family: verdana,arial,serif; font-size: 16pt; font-weight: bold; }
 
20
 
 
21
-->      
 
22
 
 
23
</STYLE>
 
24
 
 
25
 
 
26
 
 
27
</head>
 
28
 
 
29
 
 
30
 
 
31
<body bgcolor="#FFFFFF" text="black" class="Default">
 
32
 
 
33
 
 
34
 
 
35
<div align="center">
 
36
 
 
37
<img src="images/nagios.jpg" border="0" alt="Nagios" title="Nagios">
 
38
 
 
39
<h1 class="PageTitle">Monitoring Windows Machines</h1>
 
40
 
 
41
</div>
 
42
 
 
43
 
 
44
 
 
45
<hr>
 
46
 
 
47
 
 
48
 
 
49
<p>
 
50
 
 
51
<img src="images/upto.gif" border="0" align="middle" alt="Up To" title="Up To">Up To: <a href="toc.html">Contents</a><br>
 
52
 
 
53
<img src="images/seealso.gif" border="0" align="middle" alt="See Also" title="See Also"> See Also: <a href="quickstart.html">Quickstart Installation Guide</a>, <a href="monitoring-publicservices.html">Monitoring Publicly Available Services</a>
 
54
 
 
55
</p>
 
56
 
 
57
 
 
58
 
 
59
<p>
 
60
 
 
61
<strong><u>Introduction</u></strong>
 
62
 
 
63
</p>
 
64
 
 
65
 
 
66
 
 
67
<p>
 
68
 
 
69
This document describes how you can monitor "private" services and attributes of Windows machines, such as: 
 
70
 
 
71
</p>
 
72
 
 
73
 
 
74
 
 
75
<ul>
 
76
 
 
77
<li>Memory usage</li>
 
78
 
 
79
<li>CPU load</li>
 
80
 
 
81
<li>Disk usage</li>
 
82
 
 
83
<li>Service states</li>
 
84
 
 
85
<li>Running processes</li>
 
86
 
 
87
<li>etc.</li>
 
88
 
 
89
</ul>
 
90
 
 
91
 
 
92
 
 
93
<p>
 
94
 
 
95
Publicly available services that are provided by Windows machines (HTTP, FTP, POP3, etc.) can be monitored easily by following the documentation on <a href="monitoring-publicservices.html">monitoring publicly available services</a>.
 
96
 
 
97
</p>
 
98
 
 
99
 
 
100
 
 
101
<p>
 
102
 
 
103
<img src="images/note.gif" border="0" align="bottom" alt="Note" title="Note"> Note: These instructions assume that you've installed Nagios according to the <a href="quickstart.html">quickstart guide</a>.   The sample configuration entries below reference objects that are defined in the sample config files (<i>commands.cfg</i>, <i>templates.cfg</i>, etc.) that are installed if you follow the quickstart.
 
104
 
 
105
</p>
 
106
 
 
107
 
 
108
 
 
109
 
 
110
 
 
111
<p>
 
112
 
 
113
<strong><u>Overview</u></strong>
 
114
 
 
115
</p>
 
116
 
 
117
 
 
118
 
 
119
<img src="images/monitoring-windows.png" border="0" alt="Monitoring a Windows Machine" title="Monitoring a Windows Machine" style="float: right;">
 
120
 
 
121
 
 
122
 
 
123
<p>
 
124
 
 
125
Monitoring private services or attributes of a Windows machine requires that you install an agent on it.  This agent acts as a proxy between the Nagios plugin that does the monitoring and the actual service or attribute of the Windows machine.  Without installing an agent on the Windows box, Nagios would be unable to monitor private services or attributes of the Windows box.
 
126
 
 
127
</p>
 
128
 
 
129
 
 
130
 
 
131
<p>
 
132
 
 
133
For this example, we will be installing the <a href="http://sourceforge.net/projects/nscplus">NSClient++</a> addon on the Windows machine and using the <i>check_nt</i> plugin to communicate with the NSClient++ addon.  The <i>check_nt</i> plugin should already be installed on the Nagios server if you followed the quickstart guide.  
 
134
 
 
135
</p>
 
136
 
 
137
 
 
138
 
 
139
<p>
 
140
 
 
141
Other Windows agents (like <a href="http://sourceforge.net/projects/nc-net">NC_Net</a>) could be used instead of NSClient++ if you wish - provided you change command and service definitions, etc. a bit.  For the sake of simplicity I will only cover using the NSClient++ addon in these instructions.
 
142
 
 
143
</p>
 
144
 
 
145
 
 
146
 
 
147
 
 
148
 
 
149
 
 
150
 
 
151
<p>
 
152
 
 
153
<strong><u>Steps</u></strong>
 
154
 
 
155
</p>
 
156
 
 
157
 
 
158
 
 
159
<p>
 
160
 
 
161
There are several steps you'll need to follow in order to monitor a new Windows machine.  They are:
 
162
 
 
163
</p>
 
164
 
 
165
 
 
166
 
 
167
<ol>
 
168
 
 
169
<li>Perform first-time prerequisites</li>
 
170
 
 
171
<li>Install a monitoring agent on the Windows machine</li>
 
172
 
 
173
<li>Create new host and service definitions for monitoring the Windows machine</li>
 
174
 
 
175
<li>Restart the Nagios daemon</li>
 
176
 
 
177
</ol>
 
178
 
 
179
 
 
180
 
 
181
<p>
 
182
 
 
183
<strong><u>What's Already Done For You</u></strong>
 
184
 
 
185
</p>
 
186
 
 
187
 
 
188
 
 
189
<p>
 
190
 
 
191
To make your life a bit easier, a few configuration tasks have already been done for you:
 
192
 
 
193
</p>
 
194
 
 
195
 
 
196
 
 
197
<ul>
 
198
 
 
199
<li>A <i>check_nt</i> command definition has been added to the <i>commands.cfg</i> file.  This allows you to use the <i>check_nt</i> plugin to monitor Window services.</li>
 
200
 
 
201
<li>A Windows server host template (called <i>windows-server</i>) has already been created in the <i>templates.cfg</i> file.  This allows you to add new Windows host definitions in a simple manner.</li>
 
202
 
 
203
</ul>
 
204
 
 
205
 
 
206
 
 
207
<p>
 
208
 
 
209
The above-mentioned config files can be found in the <i>/usr/local/nagios/etc/objects/</i> directory.  You can modify the definitions in these and other definitions to suit your needs better if you'd like.  However, I'd recommend waiting until you're more familiar with configuring Nagios before doing so.  For the time being, just follow the directions outlined below and you'll be monitoring your Windows boxes in no time.
 
210
 
 
211
</p>
 
212
 
 
213
 
 
214
 
 
215
<p>
 
216
 
 
217
<strong><u>Prerequisites</u></strong>
 
218
 
 
219
</p>
 
220
 
 
221
 
 
222
 
 
223
<p>
 
224
 
 
225
The first time you configure Nagios to monitor a Windows machine, you'll need to do a bit of extra work.  Remember, you only need to do this for the *first* Windows machine you monitor.
 
226
 
 
227
</p>
 
228
 
 
229
 
 
230
 
 
231
<p>
 
232
 
 
233
Edit the main Nagios config file.
 
234
 
 
235
</p>
 
236
 
 
237
 
 
238
 
 
239
<pre>
 
240
 
 
241
vi /usr/local/nagios/etc/nagios.cfg
 
242
 
 
243
</pre>
 
244
 
 
245
 
 
246
 
 
247
<p>
 
248
 
 
249
Remove the leading pound (#) sign from the following line in the main configuration file:
 
250
 
 
251
</p>
 
252
 
 
253
 
 
254
 
 
255
<pre>
 
256
 
 
257
#cfg_file=/usr/local/nagios/etc/objects/windows.cfg
 
258
 
 
259
</pre>
 
260
 
 
261
 
 
262
 
 
263
<p>
 
264
 
 
265
Save the file and exit.
 
266
 
 
267
</p>
 
268
 
 
269
 
 
270
 
 
271
<p>
 
272
 
 
273
What did you just do?  You told Nagios to look to the <i>/usr/local/nagios/etc/objects/windows.cfg</i> to find additional object definitions.  That's where you'll be adding Windows host and service definitions.  That configuration file already contains some sample host, hostgroup, and service definitions.  For the *first* Windows machine you monitor, you can simply modify the sample host and service definitions in that file, rather than creating new ones.
 
274
 
 
275
</p>
 
276
 
 
277
 
 
278
 
 
279
 
 
280
 
 
281
<p>
 
282
 
 
283
<strong><u>Installing the Windows Agent</u></strong>
 
284
 
 
285
</p>
 
286
 
 
287
 
 
288
 
 
289
<p>
 
290
 
 
291
Before you can begin monitoring private services and attributes of Windows machines, you'll need to install an agent on those machines.  I recommend using the NSClient++ addon, which can be found at <a href="http://sourceforge.net/projects/nscplus">http://sourceforge.net/projects/nscplus</a>.  These instructions will take you through a basic installation of the NSClient++ addon, as well as the configuration of Nagios for monitoring the Windows machine.
 
292
 
 
293
</p>
 
294
 
 
295
 
 
296
 
 
297
<p>
 
298
 
 
299
1. Download the latest stable version of the NSClient++ addon from <a href="http://sourceforge.net/projects/nscplus">http://sourceforge.net/projects/nscplus</a>
 
300
 
 
301
</p>
 
302
 
 
303
 
 
304
 
 
305
<p>
 
306
 
 
307
2. Unzip the NSClient++ files into a new C:\NSClient++ directory
 
308
 
 
309
</p>
 
310
 
 
311
 
 
312
 
 
313
<p>
 
314
 
 
315
3. Open a command prompt and change to the C:\NSClient++ directory
 
316
 
 
317
</p>
 
318
 
 
319
 
 
320
 
 
321
<p>
 
322
 
 
323
4. Register the NSClient++ system service with the following command:
 
324
 
 
325
</p>
 
326
 
 
327
 
 
328
 
 
329
<pre>
 
330
 
 
331
        nsclient++ /install
 
332
 
 
333
</pre>
 
334
 
 
335
 
 
336
 
 
337
<p>
 
338
 
 
339
5. Install the NSClient++ systray with the following command ('SysTray' is case-sensitive):
 
340
 
 
341
</p>
 
342
 
 
343
 
 
344
 
 
345
<pre>
 
346
 
 
347
        nsclient++ SysTray
 
348
 
 
349
</pre>
 
350
 
 
351
 
 
352
 
 
353
<p>
 
354
 
 
355
6. Open the services manager and make sure the NSClientpp service is allowed to interact with the desktop (see the 'Log On' tab of the services manager).  If it isn't already allowed to interact with the desktop, check the box to allow it to.
 
356
 
 
357
</p>
 
358
 
 
359
 
 
360
 
 
361
<p>
 
362
 
 
363
<img src="images/nscpp.png" border="0" alt="NSClientpp">
 
364
 
 
365
</p>
 
366
 
 
367
 
 
368
 
 
369
<p>
 
370
 
 
371
7. Edit the NSC.INI file (located in the C:\NSClient++ directory) and make the following changes:
 
372
 
 
373
</p>
 
374
 
 
375
 
 
376
 
 
377
<ul>
 
378
 
 
379
<li>Uncomment all the modules listed in the [modules] section, except for CheckWMI.dll and RemoteConfiguration.dll</li>
 
380
 
 
381
<li>Optionally require a password for clients by changing the 'password' option in the [Settings] section.</li>
 
382
 
 
383
<li>Uncomment the 'allowed_hosts' option in the [Settings] section.  Add the IP address of the Nagios server to this line, or leave it blank to allow all hosts to connect.</li>
 
384
 
 
385
<li>Make sure the 'port' option in the [NSClient] section is uncommented and set to '12489' (the default port).</li>
 
386
 
 
387
</ul>
 
388
 
 
389
 
 
390
 
 
391
 
 
392
 
 
393
<p>
 
394
 
 
395
8. Start the NSClient++ service with the following command:
 
396
 
 
397
</p>
 
398
 
 
399
 
 
400
 
 
401
<pre>
 
402
 
 
403
        nsclient++ /start
 
404
 
 
405
</pre>
 
406
 
 
407
 
 
408
 
 
409
<p>
 
410
 
 
411
9. If installed properly, a new icon should appear in your system tray.  It will be a yellow circle with a black 'M' inside.
 
412
 
 
413
</p>
 
414
 
 
415
 
 
416
 
 
417
<p>
 
418
 
 
419
10. Success! The Windows server can now be added to the Nagios monitoring configuration...
 
420
 
 
421
</p>
 
422
 
 
423
 
 
424
 
 
425
 
 
426
 
 
427
<p>
 
428
 
 
429
<strong><u>Configuring Nagios</u></strong>
 
430
 
 
431
</p>
 
432
 
 
433
 
 
434
 
 
435
<p>
 
436
 
 
437
Now it's time to define some <a href="objectdefinitions.html">object definitions</a> in your Nagios configuration files in order to monitor the new Windows machine. 
 
438
 
 
439
</p>
 
440
 
 
441
 
 
442
 
 
443
<p>
 
444
 
 
445
Open the <i>windows.cfg</i> file for editing.
 
446
 
 
447
</p>
 
448
 
 
449
 
 
450
 
 
451
<pre>
 
452
 
 
453
vi /usr/local/nagios/etc/objects/windows.cfg
 
454
 
 
455
</pre>
 
456
 
 
457
 
 
458
 
 
459
<p>
 
460
 
 
461
Add a new <a href="objectdefinitions.html#host">host</a> definition for the Windows machine that you're going to monitor.   If this is the *first* Windows machine you're monitoring, you can simply modify the sample host definition in <i>windows.cfg</i>. Change the <i>host_name</i>, <i>alias</i>, and <i>address</i> fields to appropriate values for the Windows box.
 
462
 
 
463
</p>
 
464
 
 
465
 
 
466
 
 
467
<pre>
 
468
 
 
469
define host{
 
470
 
 
471
        use             windows-server  ; Inherit default values from a Windows server template (make sure you keep this line!)
 
472
 
 
473
        host_name               winserver
 
474
 
 
475
        alias           My Windows Server
 
476
 
 
477
        address         192.168.1.2
 
478
 
 
479
        }
 
480
 
 
481
</pre>
 
482
 
 
483
 
 
484
 
 
485
<p>
 
486
 
 
487
Good. Now you can add some service definitions (to the same configuration file) in order to tell Nagios to monitor different aspects of the Windows machine.  If this is the *first* Windows machine you're monitoring, you can simply modify the sample service definitions in <i>windows.cfg</i>. 
 
488
 
 
489
</p>
 
490
 
 
491
 
 
492
 
 
493
<p>
 
494
 
 
495
<img src="images/note.gif" border="0" align="bottom" alt="Note" title="Note"> Note: Replace "<i>winserver</i>" in the example definitions below with the name you specified in the <i>host_name</i> directive of the host definition you just added.
 
496
 
 
497
</p>
 
498
 
 
499
 
 
500
 
 
501
<p>
 
502
 
 
503
Add the following service definition to monitor the version of the NSClient++ addon that is running on the Windows server.  This is useful when it comes time to upgrade your Windows servers to a newer version of the addon, as you'll be able to tell which Windows machines still need to be upgraded to the latest version of NSClient++.
 
504
 
 
505
</p>
 
506
 
 
507
 
 
508
 
 
509
<pre>
 
510
 
 
511
define service{
 
512
 
 
513
        use                     generic-service
 
514
 
 
515
        host_name                       winserver
 
516
 
 
517
        service_description     NSClient++ Version
 
518
 
 
519
        check_command           check_nt!CLIENTVERSION
 
520
 
 
521
        }
 
522
 
 
523
</pre>
 
524
 
 
525
 
 
526
 
 
527
<p>
 
528
 
 
529
Add the following service definition to monitor the uptime of the Windows server.
 
530
 
 
531
</p>
 
532
 
 
533
 
 
534
 
 
535
<pre>
 
536
 
 
537
define service{
 
538
 
 
539
        use                     generic-service
 
540
 
 
541
        host_name                       winserver
 
542
 
 
543
        service_description     Uptime
 
544
 
 
545
        check_command           check_nt!UPTIME
 
546
 
 
547
        }
 
548
 
 
549
</pre>
 
550
 
 
551
 
 
552
 
 
553
 
 
554
 
 
555
<p>
 
556
 
 
557
Add the following service definition to monitor the CPU utilization on the Windows server and generate a CRITICAL alert if the 5-minute CPU load is 90% or more or a WARNING alert if the 5-minute load is 80% or greater.
 
558
 
 
559
</p>
 
560
 
 
561
 
 
562
 
 
563
<pre>
 
564
 
 
565
define service{
 
566
 
 
567
        use                     generic-service
 
568
 
 
569
        host_name                       winserver
 
570
 
 
571
        service_description     CPU Load
 
572
 
 
573
        check_command           check_nt!CPULOAD!-l 5,80,90
 
574
 
 
575
        }
 
576
 
 
577
</pre>
 
578
 
 
579
 
 
580
 
 
581
 
 
582
 
 
583
<p>
 
584
 
 
585
Add the following service definition to monitor memory usage on the Windows server and generate a CRITICAL alert if memory usage is 90% or more or a WARNING alert if memory usage is 80% or greater.
 
586
 
 
587
</p>
 
588
 
 
589
 
 
590
 
 
591
<pre>
 
592
 
 
593
define service{
 
594
 
 
595
        use                     generic-service
 
596
 
 
597
        host_name                       winserver
 
598
 
 
599
        service_description     Memory Usage
 
600
 
 
601
        check_command           check_nt!MEMUSE!-w 80 -c 90
 
602
 
 
603
        }
 
604
 
 
605
</pre>
 
606
 
 
607
 
 
608
 
 
609
 
 
610
 
 
611
<p>
 
612
 
 
613
Add the following service definition to monitor usage of the C:\ drive on the Windows server and generate a CRITICAL alert if disk usage is 90% or more or a WARNING alert if disk usage is 80% or greater.
 
614
 
 
615
</p>
 
616
 
 
617
 
 
618
 
 
619
<pre>
 
620
 
 
621
define service{
 
622
 
 
623
        use                     generic-service
 
624
 
 
625
        host_name                       winserver
 
626
 
 
627
        service_description     C:\ Drive Space
 
628
 
 
629
        check_command           check_nt!USEDDISKSPACE!-l c -w 80 -c 90
 
630
 
 
631
        }
 
632
 
 
633
</pre>
 
634
 
 
635
 
 
636
 
 
637
 
 
638
 
 
639
<p>
 
640
 
 
641
Add the following service definition to monitor the W3SVC service state on the Windows machine and generate a CRITICAL alert if the service is stopped.
 
642
 
 
643
</p>
 
644
 
 
645
 
 
646
 
 
647
<pre>
 
648
 
 
649
define service{
 
650
 
 
651
        use                     generic-service
 
652
 
 
653
        host_name                       winserver
 
654
 
 
655
        service_description     W3SVC
 
656
 
 
657
        check_command           check_nt!SERVICESTATE!-d SHOWALL -l W3SVC
 
658
 
 
659
        }
 
660
 
 
661
</pre>
 
662
 
 
663
 
 
664
 
 
665
 
 
666
 
 
667
<p>
 
668
 
 
669
Add the following service definition to monitor the Explorer.exe process on the Windows machine and generate a CRITICAL alert if the process is not running.
 
670
 
 
671
</p>
 
672
 
 
673
 
 
674
 
 
675
<pre>
 
676
 
 
677
define service{
 
678
 
 
679
        use                     generic-service
 
680
 
 
681
        host_name                       winserver
 
682
 
 
683
        service_description     Explorer
 
684
 
 
685
        check_command           check_nt!PROCSTATE!-d SHOWALL -l Explorer.exe
 
686
 
 
687
        }
 
688
 
 
689
</pre>
 
690
 
 
691
 
 
692
 
 
693
<p>
 
694
 
 
695
That's it for now.  You've added some basic services that should be monitored on the Windows box.  Save the configuration file.
 
696
 
 
697
</p>
 
698
 
 
699
 
 
700
 
 
701
 
 
702
 
 
703
<p>
 
704
 
 
705
<strong><u>Password Protection</u></strong>
 
706
 
 
707
</p>
 
708
 
 
709
 
 
710
 
 
711
<p>
 
712
 
 
713
If you specified a password in the NSClient++ configuration file on the Windows machine, you'll need to modify the <i>check_nt</i> command definition to include the password.  Open the <i>commands.cfg</i> file for editing.
 
714
 
 
715
</p>
 
716
 
 
717
 
 
718
 
 
719
<pre>
 
720
 
 
721
vi /usr/local/nagios/etc/objects/commands.cfg
 
722
 
 
723
</pre>
 
724
 
 
725
 
 
726
 
 
727
<p>
 
728
 
 
729
Change the definition of the <i>check_nt</i> command to include the "-s &lt;PASSWORD&gt;" argument (where PASSWORD is the password you specified on the Windows machine) like this:
 
730
 
 
731
</p>
 
732
 
 
733
 
 
734
 
 
735
<pre>
 
736
 
 
737
define command{
 
738
 
 
739
        command_name    check_nt
 
740
 
 
741
        command_line    $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -s PASSWORD -v $ARG1$ $ARG2$
 
742
 
 
743
        }
 
744
 
 
745
</pre>
 
746
 
 
747
 
 
748
 
 
749
<p>
 
750
 
 
751
Save the file.
 
752
 
 
753
</p>
 
754
 
 
755
 
 
756
 
 
757
<p>
 
758
 
 
759
<strong><u>Restarting Nagios</u></strong>
 
760
 
 
761
</p>
 
762
 
 
763
 
 
764
 
 
765
<p>
 
766
 
 
767
You're done with modifying the Nagios configuration, so you'll need to <a href="verifyconfig.html">verify your configuration files</a> and <a href="startstop.html">restart Nagios</a>.
 
768
 
 
769
</p>
 
770
 
 
771
 
 
772
 
 
773
<p>
 
774
 
 
775
If the verification process produces any errors messages, fix your configuration file before continuing.  Make sure that you don't (re)start Nagios until the verification process completes without any errors!
 
776
 
 
777
</p>
 
778
 
 
779
 
 
780
 
 
781
 
 
782
 
 
783
<hr>
 
784
 
 
785
 
 
786
 
 
787
</body>
 
788
 
395
789
</html>
 
 
b'\\ No newline at end of file'