File: perfdata.html

package info (click to toggle)
icinga 1.0.2-2%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 33,952 kB
  • ctags: 13,294
  • sloc: xml: 154,821; ansic: 99,198; sh: 14,585; sql: 5,852; php: 5,126; perl: 2,838; makefile: 1,268
file content (206 lines) | stat: -rw-r--r-- 13,275 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Performance Data</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.1">
<meta name="keywords" content="Supervision, Icinga, Nagios, Linux">
<link rel="home" href="index.html" title="Icinga Version 1.0.2 Documentation">
<link rel="up" href="ch06.html" title="Chapter 6. Advanced Topics">
<link rel="prev" href="stalking.html" title="State Stalking">
<link rel="next" href="downtime.html" title="Scheduled Downtime">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<CENTER><IMG src="../images/logofullsize.png" border="0" alt="Icinga" title="Icinga"></CENTER>
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr><th colspan="3" align="center">Performance Data</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="stalking.html">Prev</a> </td>
<th width="60%" align="center">Chapter 6. Advanced Topics</th>
<td width="20%" align="right"> <a accesskey="n" href="downtime.html">Next</a>
</td>
</tr>
</table>
<hr>
</div>
<div class="section" title="Performance Data">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="perfdata"></a><a name="perf_data"></a>Performance Data</h2></div></div></div>
  

  <p><span class="bold"><strong>Introduction</strong></span></p>

  <p>Icinga is designed to allow <a class="link" href="plugins.html" title="Icinga Plugins">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...</p>

  <p><span class="bold"><strong>Types of Performance Data</strong></span></p>

  <p>There are two basic categories of performance data that can be obtained from Icinga:</p>

  <div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
      <p>Check performance data</p>
    </li>
<li class="listitem">
      <p>Plugin performance data</p>
    </li>
</ol></div>

  <p>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 class="link" href="macrolist.html#macrolist-hostexecutiontime">$HOSTEXECUTIONTIME$</a> and <a class="link" href="macrolist.html#macrolist-serviceexecutiontime">$SERVICEEXECUTIONTIME$</a> <a class="link" href="macros.html" title="Understanding Macros and How They Work">macros</a> can be used to
  determine the number of seconds a host or service check was running and the <a class="link" href="macrolist.html#macrolist-hostlatency">$HOSTLATENCY$</a> and <a class="link" href="macrolist.html#macrolist-servicelatency">$SERVICELATENCY$</a> macros
  can be used to determine how "late" a regularly-scheduled host or service check was.</p>

  <p>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 class="link" href="macrolist.html#macrolist-hostperfdata">$HOSTPERFDATA$</a> and <a class="link" href="macrolist.html#macrolist-serviceperfdata">$SERVICEPERFDATA$</a>
  <a class="link" href="macros.html" title="Understanding Macros and How They Work">macros</a>. Read on for more information on how plugins can return performance data to Icinga
  for inclusion in the $HOSTPERFDATA$ and $SERVICEPERFDATA$ macros.</p>

  <p><span class="bold"><strong>Plugin Performance Data</strong></span></p>

  <p>At a minimum, Icinga 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:</p>

  <pre class="screen"> PING ok - Packet loss = 0%, RTA = 0.80 ms </pre>

  <p>With this simple type of output, the entire line of text is available in the $HOSTOUTPUT$ or $SERVICEOUTPUT$ <a class="link" href="macros.html" title="Understanding Macros and How They Work">macros</a> (depending on whether this plugin was used as a host check or service check).</p>

  <p>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:</p>

  <pre class="screen"> PING ok - Packet loss = 0%, RTA = 0.80 ms | percent_packet_loss=0, rta=0.80</pre>

  <p>When Icinga sees this plugin output format it will split the output into two parts:</p>

  <div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
      <p>Everything before the pipe character is considered to be the "normal" plugin output and will be stored in either the
      $HOSTOUTPUT$ or $SERVICEOUTPUT$ macro</p>
    </li>
<li class="listitem">
      <p>Everything after the pipe character is considered to be the plugin-specific performance data and will be stored in the
      $HOSTPERFDATA$ or $SERVICEPERFDATA$ macro</p>
    </li>
</ol></div>

  <p>In the example above, the $HOSTOUTPUT$ or $SERVICEOUTPUT$ macro would contain "<span class="emphasis"><em>PING ok - Packet loss = 0%, RTA =
  0.80 ms</em></span>" (without quotes) and the $HOSTPERFDATA$ or $SERVICEPERFDATA$ macro would contain
  "<span class="emphasis"><em>percent_packet_loss=0, rta=0.80</em></span>" (without quotes).</p>

  <p>Multiple lines of performace data (as well as normal text output) can be obtained from plugins, as described in the <a class="link" href="pluginapi.html" title="Icinga Plugin API">plugin API documentation</a>.</p>

  <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top">
    <p>The Icinga 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.</p>
  </td></tr>
</table></div>

  <p><span class="bold"><strong>Processing Performance Data</strong></span></p>

  <p>If you want to process the performance data that is available from Icinga and the plugins, you'll need to do the
  following:</p>

  <div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
      <p>Enable the <a class="link" href="configmain.html#configmain-process_performance_data">process_performance_data</a> option.</p>
    </li>
<li class="listitem">
      <p>Configure Icinga so that performance data is either written to files and/or processed by executing
      commands.</p>
    </li>
</ol></div>

  <p>Read on for information on how to process performance data by writing to files or executing commands.</p>

  <p><span class="bold"><strong>Processing Performance Data Using Commands</strong></span></p>

  <p>The most flexible way to process performance data is by having Icinga execute commands (that you specify) to
  process or redirect the data for later processing by external applications. The commands that Icinga executes to process
  host and service performance data are determined by the <a class="link" href="configmain.html#configmain-host_perfdata_command">host_perfdata_command</a> and <a class="link" href="configmain.html#configmain-service_perfdata_command">service_perfdata_command</a> options, respectively.</p>

  <p>An example command definition that redirects service check performance data to a text file for later processing by another
  application is shown below:</p>

  <pre class="screen"> define command{
        command_name    store-service-perfdata
        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/icinga/var/service-perfdata.dat
        }</pre>

  <div class="tip" title="Tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="../images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top">
    <p>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 Icinga to write performance data to files instead. This method
    is described in the next section.</p>
  </td></tr>
</table></div>

  <p><span class="bold"><strong>Writing Performance Data To Files</strong></span></p>

  <p>You can have Icinga write all host and service performance data directly to text files using the <a class="link" href="configmain.html#configmain-host_perfdata_file">host_perfdata_file</a> and <a class="link" href="configmain.html#configmain-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 class="link" href="configmain.html#configmain-host_perfdata_file_template">host_perfdata_file_template</a> and <a class="link" href="configmain.html#configmain-service_perfdata_file_template">service_perfdata_file_template</a> options.</p>

  <p>An example file format template for service performance data might look like this:</p>

  <pre class="screen"> service_perfdata_file_template=[SERVICEPERFDATA]\t$TIMET$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$
</pre>

  <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top">
    <p>The above is just one example of how to define a template. This definition will NOT work for PNP!</p>
  </td></tr>
</table></div>

  <p>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 class="link" href="configmain.html#configmain-host_perfdata_file_mode">host_perfdata_file_mode</a> and <a class="link" href="configmain.html#configmain-service_perfdata_file_mode">service_perfdata_file_mode</a> options.</p>

  <p>Additionally, you can have Icinga periodically execute commands to periocially process the performance data files
  (e.g. rotate them) using the <a class="link" href="configmain.html#configmain-host_perfdata_file_processing_command">host_perfdata_file_processing_command</a> and <a class="link" href="configmain.html#configmain-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 class="link" href="configmain.html#configmain-host_perfdata_file_processing_interval">host_perfdata_file_processing_interval</a> and <a class="link" href="configmain.html#configmain-service_perfdata_file_processing_interval">service_perfdata_file_processing_interval</a> options,
  respectively.</p>
  <a class="indexterm" name="id1997843"></a>
</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="stalking.html">Prev</a> </td>
<td width="20%" align="center"><a accesskey="u" href="ch06.html">Up</a></td>
<td width="40%" align="right"> <a accesskey="n" href="downtime.html">Next</a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">State Stalking </td>
<td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
<td width="40%" align="right" valign="top"> Scheduled Downtime</td>
</tr>
</table>
</div>
<P class="copyright">© 2009-2010 Icinga Development Team, http://www.icinga.org</P>
</body>
</html>