~yolanda.robla/ubuntu/saucy/nagios3/dep-8-tests

« back to all changes in this revision

Viewing changes to html/docs/perfdata.html

  • Committer: Package Import Robot
  • Author(s): Alexander Wirt
  • Date: 2012-06-16 09:05:19 UTC
  • mfrom: (1.1.7)
  • Revision ID: package-import@ubuntu.com-20120616090519-ne14zejkhhyboolc
Tags: 3.4.1-1
* [28e077b] Imported Upstream version 3.3.1
* [d5314e0] don't call updatepo in clean target
* [45b3eb9] Don't remove config foo
* [54e3dff] Don't fix permissions in cgi postinst
* [d7be9db] Build-depend on libpng-dev (Closes: #662441)
* [4c47006] Add dutch po translation (Closes: #654855)
* [2b6573b] Refresh 10_p1_pl_shebang.dpatch
* [316fd7a] Update 40_fix_spurious_dollar_signs_added_to_command_lines
* [5ff2780] Refresh 55_strip_logarchivepath.dpatch
* [811d269] Refresh 60_fix_p1.pl_patch_mini_epn.dpatch
* [39a1e9c] Remove now unneeded patch 98_fix_XSS_CVE-2011-2179
* [785a4e8] Remove unneded patch 99_fix_XSS_CVE-2011-1523
* [6ce98ef] Remove unneeded patchs from 00list
* [1d18266] Imported Upstream version 3.4.0
* [05584c8] Refresh patches
* [58098cd] Imported Upstream version 3.4.1
* [3e9e07a] Bump standards version
* [fe991e2] wrap-and-sort
* [1ba78f7] Also create /var/run/nagios in cgi package (Closes: #626854)

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
 
 
4
 
 
5
 
<html>
6
 
 
7
 
<head>
8
 
 
9
 
<title>Performance Data</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">Performance Data</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="plugins.html">Plugins</a>, <a href="pluginapi.html">Plugin API</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
 
Nagios is designed to allow <a href="plugins.html">plugins</a> to return optional performance data in addition to normal status data, as well as allow you to pass that performance data to external applications for processing.  A description of the different types of performance data, as well as information on how to go about processing that data is described below...
70
 
 
71
 
</p>
72
 
 
73
 
 
74
 
 
75
 
<p>
76
 
 
77
 
<strong><u>Types of Performance Data</u></strong>
78
 
 
79
 
</p>
80
 
 
81
 
 
82
 
 
83
 
<p>
84
 
 
85
 
There are two basic categories of performance data that can be obtained from Nagios:
86
 
 
87
 
</p>
88
 
 
89
 
 
90
 
 
91
 
<ol>
92
 
 
93
 
<li>Check performance data
94
 
 
95
 
<li>Plugin performance data
96
 
 
97
 
</ol>
98
 
 
99
 
 
100
 
 
101
 
<p>
102
 
 
103
 
Check performance data is internal data that relates to the actual execution of a host or service check.  This might include things like service check latency (i.e. how "late" was the service check from its scheduled execution time) and the number of seconds a host or service check took to execute.  This type of performance data is available for all checks that are performed.  The <a href="macrolist.html#hostexecutiontime">$HOSTEXECUTIONTIME$</a> and <a href="macrolist.html#serviceexecutiontime">$SERVICEEXECUTIONTIME$</a> <a href="macros.html">macros</a> can be used to determine the number of seconds a host or service check was running and the <a href="macrolist.html#hostlatency">$HOSTLATENCY$</a> and <a href="macrolist.html#servicelatency">$SERVICELATENCY$</a> macros can be used to determine how "late" a regularly-scheduled host or service check was.
104
 
 
105
 
</p>
106
 
 
107
 
 
108
 
 
109
 
<p>
110
 
 
111
 
Plugin performance data is external data specific to the plugin used to perform the host or service check.  Plugin-specific data can include things like percent packet loss, free disk space, processor load, number of current users, etc. - basically any type of metric that the plugin is measuring when it executes.   Plugin-specific performance data is optional and may not be supported by all plugins.  Plugin-specific performance data (if available) can be obtained by using the <a href="macrolist.html#hostperfdata">$HOSTPERFDATA$</a> and <a href="macrolist.html#serviceperfdata">$SERVICEPERFDATA$</a> <a href="macros.html">macros</a>.  Read on for more information on how plugins can return performance data to Nagios for inclusion in the $HOSTPERFDATA$ and $SERVICEPERFDATA$ macros.
112
 
 
113
 
</p>
114
 
 
115
 
 
116
 
 
117
 
<p>
118
 
 
119
 
<strong><u>Plugin Performance Data</u></strong>
120
 
 
121
 
</p>
122
 
 
123
 
 
124
 
 
125
 
<p>
126
 
 
127
 
At a minimum, Nagios plugins must return a single line of human-readable text that indicates the status of some type of measurable data.  For example, the check_ping plugin might return a line of text like the following:
128
 
 
129
 
</p>
130
 
 
131
 
 
132
 
 
133
 
<pre>
134
 
 
135
 
PING ok - Packet loss = 0%, RTA = 0.80 ms 
136
 
 
137
 
</pre>
138
 
 
139
 
 
140
 
 
141
 
<p>
142
 
 
143
 
With this simple type of output, the entire line of text is available in the $HOSTOUTPUT$ or $SERVICEOUTPUT$ <a href="macros.html">macros</a> (depending on whether this plugin was used as a host check or service check).
144
 
 
145
 
</p>
146
 
 
147
 
 
148
 
 
149
 
<p>
150
 
 
151
 
Plugins can return optional performance data in their output by sending the normal, human-readable text string that they usually would, followed by a pipe character (|), and then a string containing one or more performance data metrics.  Let's take the check_ping plugin as an example and assume that it has been enhanced to return percent packet loss and average round trip time as performance data metrics.  Sample output from the plugin might look like this:
152
 
 
153
 
</p>
154
 
 
155
 
 
156
 
 
157
 
<pre>
158
 
 
159
 
PING ok - Packet loss = 0%, RTA = 0.80 ms | percent_packet_loss=0, rta=0.80
160
 
 
161
 
</pre>
162
 
 
163
 
 
164
 
 
165
 
<p>
166
 
 
167
 
When Nagios sees this plugin output format it will split the output into two parts:
168
 
 
169
 
</p>
170
 
 
171
 
 
172
 
 
173
 
<ol>
174
 
 
175
 
<li>Everything before the pipe character is considered to be the "normal" plugin output and will be stored in either the $HOSTOUTPUT$ or $SERVICEOUTPUT$ macro</li>
176
 
 
177
 
<li>Everything after the pipe character is considered to be the plugin-specific performance data and will be stored in the $HOSTPERFDATA$ or $SERVICEPERFDATA$ macro</li>
178
 
 
179
 
</ol>
180
 
 
181
 
 
182
 
 
183
 
<p>
184
 
 
185
 
In the example above, the $HOSTOUTPUT$ or $SERVICEOUTPUT$ macro would contain "<i>PING ok - Packet loss = 0%, RTA = 0.80 ms</i>" (without quotes) and the $HOSTPERFDATA$ or $SERVICEPERFDATA$ macro would contain "<i>percent_packet_loss=0, rta=0.80</i>" (without quotes).
186
 
 
187
 
</p>
188
 
 
189
 
 
190
 
 
191
 
<p>
192
 
 
193
 
Multiple lines of performace data (as well as normal text output) can be obtained from plugins, as described in the <a href="pluginapi.html">plugin API documentation</a>.
194
 
 
195
 
</p>
196
 
 
197
 
 
198
 
 
199
 
<p>
200
 
 
201
 
<img src="images/note.gif" border="0" align="bottom" alt="Note" title="Note"> Note: The Nagios daemon doesn't directly process plugin performance data, so it doesn't really care what the performance data looks like.  There aren't really any inherent limitations on the format or content of the performance data.  However, if you are using an external addon to process the performance data (i.e. PerfParse), the addon may be expecting that the plugin returns performance data in a specific format.  Check the documentation that comes with the addon for more information.
202
 
 
203
 
</p>
204
 
 
205
 
 
206
 
 
207
 
<p>
208
 
 
209
 
<strong><u>Processing Performance Data</u></strong>
210
 
 
211
 
</p>
212
 
 
213
 
 
214
 
 
215
 
<p>
216
 
 
217
 
If you want to process the performance data that is available from Nagios and the plugins, you'll need to do the following:
218
 
 
219
 
</p>
220
 
 
221
 
 
222
 
 
223
 
<ol>
224
 
 
225
 
<li>Enable the <a href="configmain.html#process_performance_data">process_performance_data</a> option.<br><br>
226
 
 
227
 
<li>Configure Nagios so that performance data is either written to files and/or processed by executing commands.
228
 
 
229
 
</ol>
230
 
 
231
 
 
232
 
 
233
 
<p>
234
 
 
235
 
Read on for information on how to process performance data by writing to files or executing commands.
236
 
 
237
 
</p>
238
 
 
239
 
 
240
 
 
241
 
<p>
242
 
 
243
 
<strong><u>Processing Performance Data Using Commands</u></strong>
244
 
 
245
 
</p>
246
 
 
247
 
 
248
 
 
249
 
<p>
250
 
 
251
 
The most flexible way to process performance data is by having Nagios execute commands (that you specify) to process or redirect the data for later processing by external applications.  The commands that Nagios executes to process host and service performance data are determined by the <a href="configmain.html#host_perfdata_command">host_perfdata_command</a> and <a href="configmain.html#service_perfdata_command">service_perfdata_command</a> options, respectively.
252
 
 
253
 
</p>
254
 
 
255
 
 
256
 
 
257
 
<p>
258
 
 
259
 
An example command definition that redirects service check performance data to a text file for later processing by another application is shown below:
260
 
 
261
 
</p>
262
 
 
263
 
 
264
 
 
265
 
<pre>
266
 
 
267
 
define command{
268
 
 
269
 
        command_name    store-service-perfdata
270
 
 
271
 
        command_line    /bin/echo -e "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$" &gt;&gt; /usr/local/nagios/var/service-perfdata.dat
272
 
 
273
 
        }
274
 
 
275
 
</pre>
276
 
 
277
 
 
278
 
 
279
 
 
280
 
 
281
 
<p>
282
 
 
283
 
<img src="images/tip.gif" border="0" align="bottom" alt="Tip" title="Tip"> Tip: This method, while flexible, comes with a relatively high CPU overhead.  If you're processing performance data for a large number of hosts and services, you'll probably want Nagios to write performance data to files instead.  This method is described in the next section.
284
 
 
285
 
</p>
286
 
 
287
 
 
288
 
 
289
 
<p>
290
 
 
291
 
<strong><u>Writing Performance Data To Files</u></strong>
292
 
 
293
 
</p>
294
 
 
295
 
 
296
 
 
297
 
<p>
298
 
 
299
 
You can have Nagios write all host and service performance data directly to text files using the <a href="configmain.html#host_perfdata_file">host_perfdata_file</a> and <a href="configmain.html#service_perfdata_file">service_perfdata_file</a> options.  The format in which host and service performance data is written to those files is determined by the <a href="configmain.html#host_perfdata_file_template">host_perfdata_file_template</a> and <a href="configmain.html#service_perfdata_file_template">service_perfdata_file_template</a> options.
300
 
 
301
 
</p>
302
 
 
303
 
 
304
 
 
305
 
<p>
306
 
 
307
 
An example file format template for service performance data might look like this:
308
 
 
309
 
</p>
310
 
 
311
 
 
312
 
 
313
 
<pre>
314
 
 
315
 
service_perfdata_file_template=[SERVICEPERFDATA]\t$TIMET$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$
316
 
 
317
 
</pre>
318
 
 
319
 
 
320
 
 
321
 
<p>
322
 
 
323
 
By default, the text files will be opened in "append" mode. If you need to change the modes to "write" or "non-blocking read/write" (useful when writing to pipes), you can use the <a href="configmain.html#host_perfdata_file_mode">host_perfdata_file_mode</a> and <a href="configmain.html#service_perfdata_file_mode">service_perfdata_file_mode</a> options.
324
 
 
325
 
</p>
326
 
 
327
 
 
328
 
 
329
 
<p>
330
 
 
331
 
Additionally, you can have Nagios periodically execute commands to periocially process the performance data files (e.g. rotate them) using the <a href="configmain.html#host_perfdata_file_processing_command">host_perfdata_file_processing_command</a> and <a href="configmain.html#service_perfdata_file_processing_command">service_perfdata_file_processing_command</a> options.  The interval at which these commands are executed are governed by the <a href="configmain.html#host_perfdata_file_processing_interval">host_perfdata_file_processing_interval</a> and <a href="configmain.html#service_perfdata_file_processing_interval">service_perfdata_file_processing_interval</a> options, respectively.
332
 
 
333
 
</p>
334
 
 
335
 
 
336
 
 
337
 
 
338
 
 
339
 
<hr>
340
 
 
341
 
 
342
 
 
343
 
</body>
344
 
 
345
 
</html>
346