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 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Time-Saving Tricks For Object Definitions</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="objectinheritance.html" title="Object Inheritance">
<link rel="next" href="ch07.html" title="Chapter 7. Security and Performance Tuning">
</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">Time-Saving Tricks For Object Definitions</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="objectinheritance.html">Prev</a> </td>
<th width="60%" align="center">Chapter 6. Advanced Topics</th>
<td width="20%" align="right"> <a accesskey="n" href="ch07.html">Next</a>
</td>
</tr>
</table>
<hr>
</div>
<div class="section" title="Time-Saving Tricks For Object Definitions">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="objecttricks"></a><a name="object_tricks"></a>Time-Saving Tricks For Object Definitions</h2></div></div></div>
<p><span class="bold"><strong>Introduction</strong></span></p>
<p>This documentation attempts to explain how you can exploit the (somewhat) hidden features of <a class="link" href="objectdefinitions.html" title="Object Definitions">template-based object definitions</a> to save your sanity. How so, you ask? Several types of
objects allow you to specify multiple host names and/or hostgroup names in definitions, allowing you to "copy" the object
defintion to multiple hosts or services. We'll cover each type of object that supports these features separately. For starters,
the object types which support this time-saving feature are as follows:</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<p><a class="link" href="objecttricks.html#objecttricks-service">Services</a></p>
</li>
<li class="listitem">
<p><a class="link" href="objecttricks.html#objecttricks-serviceescalation">Service escalations</a></p>
</li>
<li class="listitem">
<p><a class="link" href="objecttricks.html#objecttricks-servicedependency">Service dependencies</a></p>
</li>
<li class="listitem">
<p><a class="link" href="objecttricks.html#objecttricks-hostescalation">Host escalations</a></p>
</li>
<li class="listitem">
<p><a class="link" href="objecttricks.html#objecttricks-hostdependency">Host dependencies</a></p>
</li>
<li class="listitem">
<p><a class="link" href="objecttricks.html#objecttricks-hostgroup">Hostgroups</a></p>
</li>
</ul></div>
<p>Object types that are not listed above (i.e. timeperiods, commands, etc.) do not support the features we're about to
describe.</p>
<p><span class="bold"><strong>Regular Expression Matching</strong></span></p>
<p>The examples we give below use "standard" matching of object names. If you wish, you can enable regular expression
matching for object names by using the <a class="link" href="configmain.html#configmain-use_regexp_matching">use_regexp_matching</a> config option.
By default, regular expression matching will only be used in object names that contain <span class="bold"><strong>*</strong></span>,
<span class="bold"><strong>?</strong></span>, <span class="bold"><strong>+</strong></span>, or <span class="bold"><strong>\.</strong></span>. If you want
regular expression matching to be used on all object names, enable the <a class="link" href="configmain.html#configmain-use_true_regexp_matching">use_true_regexp_matching</a> config option. Regular expressions can be used in
any of the fields used in the examples below (host names, hostgroup names, service names, and servicegroup names).</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>Be careful when enabling regular expression matching - you may have to change your config file, since some directives
that you might not want to be interpreted as a regular expression just might be! Any problems should become evident once you
verify your configuration.</p>
</td></tr>
</table></div>
<p><a name="objecttricks-service"></a><span class="bold"><strong>Service Definitions</strong></span></p>
<p><span class="bold"><strong>Multiple Hosts:</strong></span></p>
<p>If you want to create identical <a class="link" href="objectdefinitions.html#objectdefinitions-service">services</a> that are assigned to multiple
hosts, you can specify multiple hosts in the <span class="emphasis"><em>host_name</em></span> directive. The definition below would create a
service called <span class="emphasis"><em>SOMESERVICE</em></span> on hosts <span class="emphasis"><em>HOST1</em></span> through <span class="emphasis"><em>HOSTN</em></span>. All the
instances of the <span class="emphasis"><em>SOMESERVICE</em></span> service would be identical (i.e. have the same check command, max check
attempts, notification period, etc.).</p>
<pre class="screen"> define <span class="emphasis"><em> service</em></span>{
host_name <span class="emphasis"><em> HOST1,HOST2,HOST3,...,HOSTN</em></span>
service_description <span class="emphasis"><em> SOMESERVICE</em></span>
<span class="emphasis"><em>other service directives</em></span> ...
} </pre>
<p><span class="bold"><strong>All Hosts In Multiple Hostgroups:</strong></span></p>
<p>If you want to create identical services that are assigned to all hosts in one or more hostgroups, you can do so by
creating a single service definition. How? The <span class="emphasis"><em>hostgroup_name</em></span> directive allows you to specify the name of
one or more hostgroups that the service should be created for. The definition below would create a service called
<span class="emphasis"><em>SOMESERVICE</em></span> on all hosts that are members of hostgroups <span class="emphasis"><em>HOSTGROUP1</em></span> through
<span class="emphasis"><em>HOSTGROUPN</em></span>. All the instances of the <span class="emphasis"><em>SOMESERVICE</em></span> service would be identical (i.e. have
the same check command, max check attempts, notification period, etc.).</p>
<pre class="screen"> define <span class="emphasis"><em> service</em></span>{
hostgroup_name <span class="emphasis"><em> HOSTGROUP1,HOSTGROUP2,...,HOSTGROUPN</em></span>
service_description <span class="emphasis"><em> SOMESERVICE</em></span>
<span class="emphasis"><em>other service directives</em></span> ...
}</pre>
<p><span class="bold"><strong>All Hosts:</strong></span></p>
<p>If you want to create identical services that are assigned to all hosts that are defined in your configuration files, you
can use a wildcard in the <span class="emphasis"><em>host_name</em></span> directive. The definition below would create a service called
<span class="emphasis"><em>SOMESERVICE</em></span> on <span class="bold"><strong>all hosts</strong></span> that are defined in your configuration files. All
the instances of the <span class="emphasis"><em>SOMESERVICE</em></span> service would be identical (i.e. have the same check command, max check
attempts, notification period, etc.).</p>
<pre class="screen"> define <span class="emphasis"><em> service</em></span>{
host_name <span class="emphasis"><em> *</em></span>
service_description <span class="emphasis"><em> SOMESERVICE</em></span>
<span class="emphasis"><em>other service directives</em></span> ...
}</pre>
<p><span class="bold"><strong>Excluding Hosts:</strong></span></p>
<p>If you want to create identical services on numerous hosts or hostgroups, but would like to exclude some hosts from the
definition, this can be accomplished by preceding the host or hostgroup with a ! symbol.</p>
<pre class="screen"> define <span class="emphasis"><em> service</em></span>{
host_name <span class="emphasis"><em> HOST1,HOST2,!HOST3,!HOST4,...,HOSTN</em></span>
hostgroup_name <span class="emphasis"><em> HOSTGROUP1,HOSTGROUP2,!HOSTGROUP3,!HOSTGROUP4,...,HOSTGROUPN</em></span>
service_description <span class="emphasis"><em> SOMESERVICE</em></span>
<span class="emphasis"><em>other service directives</em></span> ...
}</pre>
<p><a name="objecttricks-serviceescalation"></a><span class="bold"><strong>Service Escalation Definitions</strong></span></p>
<p><span class="bold"><strong>Multiple Hosts:</strong></span></p>
<p>If you want to create <a class="link" href="objectdefinitions.html#objectdefinitions-serviceescalation">service escalations</a> for services of the
same name/description that are assigned to multiple hosts, you can specify multiple hosts in the <span class="emphasis"><em>host_name</em></span>
directive. The definition below would create a service escalation for services called <span class="emphasis"><em>SOMESERVICE</em></span> on hosts
<span class="emphasis"><em>HOST1</em></span> through <span class="emphasis"><em>HOSTN</em></span>. All the instances of the service escalation would be identical
(i.e. have the same contact groups, notification interval, etc.).</p>
<pre class="screen"> define <span class="emphasis"><em> serviceescalation</em></span>{
host_name <span class="emphasis"><em> HOST1,HOST2,HOST3,...,HOSTN</em></span>
service_description <span class="emphasis"><em> SOMESERVICE</em></span>
<span class="emphasis"><em>other escalation directives</em></span> ...
}</pre>
<p><span class="bold"><strong>All Hosts In Multiple Hostgroups:</strong></span></p>
<p>If you want to create service escalations for services of the same name/description that are assigned to all hosts in in
one or more hostgroups, you can do use the <span class="emphasis"><em>hostgroup_name</em></span> directive. The definition below would create a
service escalation for services called <span class="emphasis"><em>SOMESERVICE</em></span> on all hosts that are members of hostgroups
<span class="emphasis"><em>HOSTGROUP1</em></span> through <span class="emphasis"><em>HOSTGROUPN</em></span>. All the instances of the service escalation would be
identical (i.e. have the same contact groups, notification interval, etc.).</p>
<pre class="screen"> define <span class="emphasis"><em> serviceescalation</em></span>{
hostgroup_name <span class="emphasis"><em> HOSTGROUP1,HOSTGROUP2,...,HOSTGROUPN</em></span>
service_description <span class="emphasis"><em> SOMESERVICE</em></span>
<span class="emphasis"><em>other escalation directives</em></span> ...
}</pre>
<p><span class="bold"><strong>All Hosts:</strong></span></p>
<p>If you want to create identical service escalations for services of the same name/description that are assigned to all
hosts that are defined in your configuration files, you can use a wildcard in the <span class="emphasis"><em>host_name</em></span> directive. The
definition below would create a service escalation for all services called <span class="emphasis"><em>SOMESERVICE</em></span> on <span class="bold"><strong>all hosts</strong></span> that are defined in your configuration files. All the instances of the service escalation would
be identical (i.e. have the same contact groups, notification interval, etc.).</p>
<pre class="screen"> define <span class="emphasis"><em> serviceescalation</em></span>{
host_name <span class="emphasis"><em> *</em></span>
service_description <span class="emphasis"><em> SOMESERVICE</em></span>
<span class="emphasis"><em>other escalation directives</em></span> ...
}</pre>
<p><span class="bold"><strong>Excluding Hosts:</strong></span></p>
<p>If you want to create identical services escalations for services on numerous hosts or hostgroups, but would like to
exclude some hosts from the definition, this can be accomplished by preceding the host or hostgroup with a ! symbol.</p>
<pre class="screen"> define <span class="emphasis"><em> serviceescalation</em></span>{
host_name <span class="emphasis"><em> HOST1,HOST2,!HOST3,!HOST4,...,HOSTN</em></span>
hostgroup_name <span class="emphasis"><em> HOSTGROUP1,HOSTGROUP2,!HOSTGROUP3,!HOSTGROUP4,...,HOSTGROUPN</em></span>
service_description <span class="emphasis"><em> SOMESERVICE</em></span>
<span class="emphasis"><em>other escalation directives</em></span> ...
}</pre>
<p><span class="bold"><strong>All Services On Same Host:</strong></span></p>
<p>If you want to create <a class="link" href="objectdefinitions.html#objectdefinitions-serviceescalation">service escalations</a> for all services
assigned to a particular host, you can use a wildcard in the <span class="emphasis"><em>service_description</em></span> directive. The definition
below would create a service escalation for <span class="bold"><strong>all</strong></span> services on host <span class="emphasis"><em>HOST1</em></span>.
All the instances of the service escalation would be identical (i.e. have the same contact groups, notification interval,
etc.).</p>
<p>If you feel like being particularly adventurous, you can specify a wildcard in both the <span class="emphasis"><em>host_name</em></span> and
<span class="emphasis"><em>service_description</em></span> directives. Doing so would create a service escalation for <span class="bold"><strong>all
services</strong></span> that you've defined in your configuration files.</p>
<pre class="screen"> define <span class="emphasis"><em> serviceescalation</em></span>{
host_name <span class="emphasis"><em> HOST1</em></span>
service_description <span class="emphasis"><em> *</em></span>
<span class="emphasis"><em>other escalation directives</em></span> ...
}</pre>
<p><span class="bold"><strong>Multiple Services On Same Host:</strong></span></p>
<p>If you want to create <a class="link" href="objectdefinitions.html#objectdefinitions-serviceescalation">service escalations</a> for all multiple
services assigned to a particular host, you can use a specify more than one service description in the
<span class="emphasis"><em>service_description</em></span> directive. The definition below would create a service escalation for services
<span class="emphasis"><em>SERVICE1</em></span> through <span class="emphasis"><em>SERVICEN</em></span> on host <span class="emphasis"><em>HOST1</em></span>. All the instances of the
service escalation would be identical (i.e. have the same contact groups, notification interval, etc.).</p>
<pre class="screen"> define <span class="emphasis"><em> serviceescalation</em></span>{
host_name <span class="emphasis"><em> HOST1</em></span>
service_description <span class="emphasis"><em> SERVICE1,SERVICE2,...,SERVICEN</em></span>
<span class="emphasis"><em>other escalation directives</em></span> ...
}</pre>
<p><span class="bold"><strong>All Services In Multiple Servicegroups:</strong></span></p>
<p>If you want to create service escalations for all services that belong in one or more servicegroups, you can do use the
<span class="emphasis"><em>servicegroup_name</em></span> directive. The definition below would create service escalations for all services that
are members of servicegroups <span class="emphasis"><em>SERVICEGROUP1</em></span> through <span class="emphasis"><em>SERVICEGROUPN</em></span>. All the instances of
the service escalation would be identical (i.e. have the same contact groups, notification interval, etc.).</p>
<pre class="screen"> define <span class="emphasis"><em> serviceescalation</em></span>{
servicegroup_name <span class="emphasis"><em> SERVICEGROUP1,SERVICEGROUP2,...,SERVICEGROUPN</em></span>
<span class="emphasis"><em>other escalation directives</em></span> ...
}</pre>
<p><a name="objecttricks-servicedependency"></a><span class="bold"><strong>Service Dependency Definitions</strong></span></p>
<p><span class="bold"><strong>Multiple Hosts:</strong></span></p>
<p>If you want to create <a class="link" href="objectdefinitions.html#objectdefinitions-servicedependency">service dependencies</a> for services of the
same name/description that are assigned to multiple hosts, you can specify multiple hosts in the <span class="emphasis"><em>host_name</em></span>
and or <span class="emphasis"><em>dependent_host_name</em></span> directives. In the example below, service <span class="emphasis"><em>SERVICE2</em></span> on hosts
<span class="emphasis"><em>HOST3</em></span> and <span class="emphasis"><em>HOST4</em></span> would be dependent on service <span class="emphasis"><em>SERVICE1</em></span> on hosts
<span class="emphasis"><em>HOST1</em></span> and <span class="emphasis"><em>HOST2</em></span>. All the instances of the service dependencies would be identical
except for the host names (i.e. have the same notification failure criteria, etc.).</p>
<pre class="screen"> define <span class="emphasis"><em> servicedependency</em></span>{
host_name <span class="emphasis"><em> HOST1,HOST2</em></span>
service_description <span class="emphasis"><em> SERVICE1</em></span>
dependent_host_name <span class="emphasis"><em> HOST3,HOST4</em></span>
dependent_service_description <span class="emphasis"><em> SERVICE2</em></span>
<span class="emphasis"><em>other dependency directives</em></span> ...
}</pre>
<p><span class="bold"><strong>All Hosts In Multiple Hostgroups:</strong></span></p>
<p>If you want to create service dependencies for services of the same name/description that are assigned to all hosts in in
one or more hostgroups, you can do use the <span class="emphasis"><em>hostgroup_name</em></span> and/or
<span class="emphasis"><em>dependent_hostgroup_name</em></span> directives. In the example below, service <span class="emphasis"><em>SERVICE2</em></span> on all
hosts in hostgroups <span class="emphasis"><em>HOSTGROUP3</em></span> and <span class="emphasis"><em>HOSTGROUP4</em></span> would be dependent on service
<span class="emphasis"><em>SERVICE1</em></span> on all hosts in hostgroups <span class="emphasis"><em>HOSTGROUP1</em></span> and <span class="emphasis"><em>HOSTGROUP2</em></span>.
Assuming there were five hosts in each of the hostgroups, this definition would be equivalent to creating 100 single service
dependency definitions! All the instances of the service dependency would be identical except for the host names (i.e. have the
same notification failure criteria, etc.).</p>
<pre class="screen"> define <span class="emphasis"><em> servicedependency</em></span>{
hostgroup_name <span class="emphasis"><em>HOSTGROUP1,HOSTGROUP2</em></span>
service_description <span class="emphasis"><em> SERVICE1</em></span>
dependent_hostgroup_name <span class="emphasis"><em> HOSTGROUP3,HOSTGROUP4</em></span>
dependent_service_description <span class="emphasis"><em> SERVICE2</em></span>
<span class="emphasis"><em>other dependency directives</em></span> ...
}</pre>
<p><span class="bold"><strong>All Services On A Host:</strong></span></p>
<p>If you want to create service dependencies for all services assigned to a particular host, you can use a wildcard in the
<span class="emphasis"><em>service_description</em></span> and/or <span class="emphasis"><em>dependent_service_description</em></span> directives. In the example
below, <span class="bold"><strong>all services</strong></span> on host <span class="emphasis"><em>HOST2</em></span> would be dependent on <span class="bold"><strong>all services</strong></span> on host <span class="emphasis"><em>HOST1</em></span>. All the instances of the service dependencies would be
identical (i.e. have the same notification failure criteria, etc.).</p>
<pre class="screen"> define <span class="emphasis"><em> servicedependency</em></span>{
host_name <span class="emphasis"><em> HOST1</em></span>
service_description <span class="emphasis"><em> *</em></span>
dependent_host_name <span class="emphasis"><em> HOST2</em></span>
dependent_service_description <span class="emphasis"><em> *</em></span>
<span class="emphasis"><em>other dependency directives</em></span> ...
}</pre>
<p><span class="bold"><strong>Multiple Services On A Host:</strong></span></p>
<p>If you want to create service dependencies for multiple services assigned to a particular host, you can specify more than
one service description in the <span class="emphasis"><em>service_description</em></span> and/or
<span class="emphasis"><em>dependent_service_description</em></span> directives as follows:</p>
<pre class="screen"> define <span class="emphasis"><em> servicedependency</em></span>{
host_name <span class="emphasis"><em> HOST1</em></span>
service_description <span class="emphasis"><em> SERVICE1,SERVICE2,...,SERVICEN</em></span>
dependent_host_name <span class="emphasis"><em> HOST2</em></span>
dependent_service_description <span class="emphasis"><em> SERVICE1,SERVICE2,...,SERVICEN</em></span>
<span class="emphasis"><em>other dependency directives</em></span> ...
}</pre>
<p><span class="bold"><strong>All Services In Multiple Servicegroups:</strong></span></p>
<p>If you want to create service dependencies for all services that belong in one or more servicegroups, you can do use the
<span class="emphasis"><em>servicegroup_name</em></span> and/or <span class="emphasis"><em>dependent_servicegroup_name</em></span> directive as follows:</p>
<pre class="screen"> define <span class="emphasis"><em> servicedependency</em></span>{
servicegroup_name <span class="emphasis"><em> SERVICEGROUP1,SERVICEGROUP2,...,SERVICEGROUPN</em></span>
dependent_servicegroup_name <span class="emphasis"><em> SERVICEGROUP3,SERVICEGROUP4,...SERVICEGROUPN</em></span>
<span class="emphasis"><em>other dependency directives</em></span> ...
}</pre>
<p><a name="objecttricks-same_host_dependency"></a><span class="bold"><strong>Same Host Dependencies:</strong></span></p>
<p>If you want to create service dependencies for multiple services that are dependent on services on the same host, leave
the <span class="emphasis"><em>dependent_host_name</em></span> and <span class="emphasis"><em>dependent_hostgroup_name</em></span> directives empty. The example
below assumes that hosts <span class="emphasis"><em>HOST1</em></span> and <span class="emphasis"><em>HOST2</em></span> have at least the following four services
associated with them: <span class="emphasis"><em>SERVICE1</em></span>, <span class="emphasis"><em>SERVICE2</em></span>, <span class="emphasis"><em>SERVICE3</em></span>, and
<span class="emphasis"><em>SERVICE4</em></span>. In this example, <span class="emphasis"><em>SERVICE3</em></span> and <span class="emphasis"><em>SERVICE4</em></span> on
<span class="emphasis"><em>HOST1</em></span> will be dependent on both <span class="emphasis"><em>SERVICE1</em></span> and <span class="emphasis"><em>SERVICE2</em></span> on
<span class="emphasis"><em>HOST1</em></span>. Similiarly, <span class="emphasis"><em>SERVICE3</em></span> and <span class="emphasis"><em>SERVICE4</em></span> on
<span class="emphasis"><em>HOST2</em></span> will be dependent on both <span class="emphasis"><em>SERVICE1</em></span> and <span class="emphasis"><em>SERVICE2</em></span> on
<span class="emphasis"><em>HOST2</em></span>.</p>
<pre class="screen"> define <span class="emphasis"><em> servicedependency</em></span>{
host_name <span class="emphasis"><em> HOST1,HOST2</em></span>
service_description <span class="emphasis"><em> SERVICE1,SERVICE2</em></span>
dependent_service_description <span class="emphasis"><em> SERVICE3,SERVICE4</em></span>
<span class="emphasis"><em>other dependency directives</em></span> ...
}</pre>
<p><a name="objecttricks-hostescalation"></a><span class="bold"><strong>Host Escalation Definitions</strong></span></p>
<p><span class="bold"><strong>Multiple Hosts:</strong></span></p>
<p>If you want to create <a class="link" href="objectdefinitions.html#objectdefinitions-hostescalation">host escalations</a> for multiple hosts, you can
specify multiple hosts in the <span class="emphasis"><em>host_name</em></span> directive. The definition below would create a host escalation for
hosts <span class="emphasis"><em>HOST1</em></span> through <span class="emphasis"><em>HOSTN</em></span>. All the instances of the host escalation would be identical
(i.e. have the same contact groups, notification interval, etc.).</p>
<pre class="screen"> define <span class="emphasis"><em> hostescalation</em></span>{
host_name <span class="emphasis"><em> HOST1,HOST2,HOST3,...,HOSTN</em></span>
<span class="emphasis"><em>other escalation directives</em></span> ...
}</pre>
<p><span class="bold"><strong>All Hosts In Multiple Hostgroups:</strong></span></p>
<p>If you want to create host escalations for all hosts in in one or more hostgroups, you can do use the
<span class="emphasis"><em>hostgroup_name</em></span> directive. The definition below would create a host escalation on all hosts that are members
of hostgroups <span class="emphasis"><em>HOSTGROUP1</em></span> through <span class="emphasis"><em>HOSTGROUPN</em></span>. All the instances of the host escalation
would be identical (i.e. have the same contact groups, notification interval, etc.).</p>
<pre class="screen"> define <span class="emphasis"><em> hostescalation</em></span>{
hostgroup_name <span class="emphasis"><em> HOSTGROUP1,HOSTGROUP2,...,HOSTGROUPN</em></span>
<span class="emphasis"><em>other escalation directives</em></span> ...
}</pre>
<p><span class="bold"><strong>All Hosts:</strong></span></p>
<p>If you want to create identical host escalations for all hosts that are defined in your configuration files, you can use a
wildcard in the <span class="emphasis"><em>host_name</em></span> directive. The definition below would create a hosts escalation for <span class="bold"><strong>all hosts</strong></span> that are defined in your configuration files. All the instances of the host escalation would be
identical (i.e. have the same contact groups, notification interval, etc.).</p>
<pre class="screen"> define <span class="emphasis"><em> hostescalation</em></span>{
host_name <span class="emphasis"><em> *</em></span>
<span class="emphasis"><em>other escalation directives</em></span> ...
}</pre>
<p><span class="bold"><strong>Excluding Hosts:</strong></span></p>
<p>If you want to create identical host escalations on numerous hosts or hostgroups, but would like to exclude some hosts
from the definition, this can be accomplished by preceding the host or hostgroup with a ! symbol.</p>
<pre class="screen"> define <span class="emphasis"><em> hostescalation</em></span>{
host_name <span class="emphasis"><em> HOST1,HOST2,!HOST3,!HOST4,...,HOSTN</em></span>
hostgroup_name <span class="emphasis"><em>HOSTGROUP1,HOSTGROUP2,!HOSTGROUP3,!HOSTGROUP4,...,HOSTGROUPN</em></span>
<span class="emphasis"><em>other escalation directives</em></span> ...
}</pre>
<p><a name="objecttricks-hostdependency"></a><span class="bold"><strong>Host Dependency Definitions</strong></span></p>
<p><span class="bold"><strong>Multiple Hosts:</strong></span></p>
<p>If you want to create <a class="link" href="objectdefinitions.html#objectdefinitions-hostdependency">host dependencies</a> for multiple hosts, you
can specify multiple hosts in the <span class="emphasis"><em>host_name</em></span> and/or <span class="emphasis"><em>dependent_host_name</em></span> directives. The
definition below would be equivalent to creating six separate host dependencies. In the example above, hosts
<span class="emphasis"><em>HOST3</em></span>, <span class="emphasis"><em>HOST4</em></span> and <span class="emphasis"><em>HOST5</em></span> would be dependent upon both
<span class="emphasis"><em>HOST1</em></span> and <span class="emphasis"><em>HOST2</em></span>. All the instances of the host dependencies would be identical except
for the host names (i.e. have the same notification failure criteria, etc.).</p>
<pre class="screen"> define <span class="emphasis"><em> hostdependency</em></span>{
host_name <span class="emphasis"><em> HOST1,HOST2</em></span>
dependent_host_name <span class="emphasis"><em> HOST3,HOST4,HOST5</em></span>
<span class="emphasis"><em>other dependency directives</em></span> ...
}</pre>
<p><span class="bold"><strong>All Hosts In Multiple Hostgroups:</strong></span></p>
<p>If you want to create host escalations for all hosts in in one or more hostgroups, you can do use the
<span class="emphasis"><em>hostgroup_name</em></span> and /or <span class="emphasis"><em>dependent_hostgroup_name</em></span> directives. In the example below, all
hosts in hostgroups <span class="emphasis"><em>HOSTGROUP3</em></span> and <span class="emphasis"><em>HOSTGROUP4</em></span> would be dependent on all hosts in
hostgroups <span class="emphasis"><em>HOSTGROUP1</em></span> and <span class="emphasis"><em>HOSTGROUP2</em></span>. All the instances of the host dependencies would
be identical except for host names (i.e. have the same notification failure criteria, etc.).</p>
<pre class="screen"> define <span class="emphasis"><em> hostdependency</em></span>{
hostgroup_name <span class="emphasis"><em> HOSTGROUP1,HOSTGROUP2</em></span>
dependent_hostgroup_name <span class="emphasis"><em> HOSTGROUP3,HOSTGROUP4</em></span>
<span class="emphasis"><em>other dependency directives</em></span> ...
}</pre>
<p><a name="objecttricks-hostgroup"></a><span class="bold"><strong>Hostgroups</strong></span></p>
<p><span class="bold"><strong>All Hosts:</strong></span></p>
<p>If you want to create a hostgroup that has all hosts that are defined in your configuration files as members, you can use
a wildcard in the <span class="emphasis"><em>members</em></span> directive. The definition below would create a hostgroup called
<span class="emphasis"><em>HOSTGROUP1</em></span> that has all <span class="bold"><strong>all hosts</strong></span> that are defined in your configuration
files as members.</p>
<pre class="screen"> define <span class="emphasis"><em> hostgroup</em></span>{
<span class="emphasis"><em>hostgroup_name</em></span> <span class="emphasis"><em> HOSTGROUP1</em></span>
members <span class="emphasis"><em> *</em></span>
<span class="emphasis"><em>other hostgroup directives</em></span> ...
}</pre>
<a class="indexterm" name="id2003897"></a>
<a class="indexterm" name="id2003908"></a>
<a class="indexterm" name="id2003917"></a>
<a class="indexterm" name="id2003919"></a>
<a class="indexterm" name="id2003924"></a>
<a class="indexterm" name="id2003934"></a>
<a class="indexterm" name="id2003950"></a>
<a class="indexterm" name="id2003951"></a>
<a class="indexterm" name="id2003957"></a>
</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="objectinheritance.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="ch07.html">Next</a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">Object Inheritance </td>
<td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
<td width="40%" align="right" valign="top"> Chapter 7. Security and Performance Tuning</td>
</tr>
</table>
</div>
<P class="copyright">© 2009-2010 Icinga Development Team, http://www.icinga.org</P>
</body>
</html>
|