Skip to content

Commit

Permalink
Merge pull request #7339 from Icinga/feature/docs-rename-cv
Browse files Browse the repository at this point in the history
Docs: Rename 'custom attribute' to 'custom variable'
  • Loading branch information
Michael Friedrich committed Jul 19, 2019
2 parents fbe732a + 5aa07b5 commit e9f61ef
Show file tree
Hide file tree
Showing 19 changed files with 395 additions and 375 deletions.
188 changes: 105 additions & 83 deletions doc/03-monitoring-basics.md

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions doc/04-configuration.md
Expand Up @@ -48,7 +48,7 @@ Consider these ideas:

In either way of choosing the right strategy you should additionally check the following:

* Are there any specific attributes describing the host/service you could set as `vars` custom attributes?
* Are there any specific attributes describing the host/service you could set as `vars` custom variables?
You can later use them for applying assign/ignore rules, or export them into external interfaces.
* Put hosts into hostgroups, services into servicegroups and use these attributes for your apply rules.
* Use templates to store generic attributes for your objects and apply rules making your configuration more readable.
Expand Down Expand Up @@ -276,11 +276,11 @@ The `import` keyword is used to import the `generic-host` template which
takes care of setting up the host check command to `hostalive`. If you
require a different check command, you can override it in the object definition.

The `vars` attribute can be used to define custom attributes which are available
The `vars` attribute can be used to define custom variables which are available
for check and notification commands. Most of the [Plugin Check Commands](10-icinga-template-library.md#icinga-template-library)
in the Icinga Template Library require an `address` attribute.

The custom attribute `os` is evaluated by the `linux-servers` group in
The custom variable `os` is evaluated by the `linux-servers` group in
[groups.conf](04-configuration.md#groups-conf) making the local host a member.

The example host will show you how to:
Expand Down Expand Up @@ -324,7 +324,7 @@ object Host NodeName {
address = "127.0.0.1"
address6 = "::1"
/* Set custom attribute `os` for hostgroup assignment in `groups.conf`. */
/* Set custom variable `os` for hostgroup assignment in `groups.conf`. */
vars.os = "Linux"
/* Define http vhost attributes for service apply rules in `services.conf`. */
Expand Down Expand Up @@ -377,8 +377,8 @@ Service(s) | Applied on host(s)
`load`, `procs`, `swap`, `users`, `icinga` | The `NodeName` host only.
`ping4`, `ping6` | All hosts with `address` resp. `address6` attribute.
`ssh` | All hosts with `address` and `vars.os` set to `Linux`
`http`, optional: `Icinga Web 2` | All hosts with custom attribute `http_vhosts` defined as dictionary.
`disk`, `disk /` | All hosts with custom attribute `disks` defined as dictionary.
`http`, optional: `Icinga Web 2` | All hosts with custom variable `http_vhosts` defined as dictionary.
`disk`, `disk /` | All hosts with custom variable `disks` defined as dictionary.

The Debian packages also include an additional `apt` service check applied to the local host.

Expand Down Expand Up @@ -407,7 +407,7 @@ The `apply` keyword can be used to create new objects which are associated with
another group of objects. You can `import` existing templates, define (custom)
attributes.

The custom attribute `backup_downtime` is defined to a specific timerange string.
The custom variable `backup_downtime` is defined to a specific timerange string.
This variable value will be used for applying a `ScheduledDowntime` object to
these services in [downtimes.conf](04-configuration.md#downtimes-conf).

Expand All @@ -430,7 +430,7 @@ apply Service "ssh" {
```

In this example, the service `ssh` is applied to all hosts having the `address`
attribute defined `AND` having the custom attribute `os` set to the string
attribute defined `AND` having the custom variable `os` set to the string
`Linux`.
You can modify this condition to match multiple expressions by combining `AND`
and `OR` using `&&` and `||` [operators](17-language-reference.md#expression-operators), for example
Expand All @@ -443,7 +443,7 @@ hosts, you can go one step further: Generate apply rules based on array items
or dictionary key-value pairs.

The idea is simple: Your host in [hosts.conf](04-configuration.md#hosts-conf) defines the
`disks` dictionary as custom attribute in `vars`.
`disks` dictionary as custom variable in `vars`.

Remember the example from [hosts.conf](04-configuration.md#hosts-conf):

Expand Down Expand Up @@ -583,7 +583,7 @@ Read more on that topic [here](03-monitoring-basics.md#notification-commands).
#### groups.conf <a id="groups-conf"></a>

The example host defined in [hosts.conf](hosts-conf) already has the
custom attribute `os` set to `Linux` and is therefore automatically
custom variable `os` set to `Linux` and is therefore automatically
a member of the host group `linux-servers`.

This is done by using the [group assign](17-language-reference.md#group-assign) expressions similar
Expand Down Expand Up @@ -681,7 +681,7 @@ More details on `Notification` object attributes can be found [here](09-object-t
#### downtimes.conf <a id="downtimes-conf"></a>

The `load` service apply rule defined in [services.conf](04-configuration.md#services-conf) defines
the `backup_downtime` custom attribute.
the `backup_downtime` custom variable.

The ScheduledDowntime apply rule uses this attribute to define the default value
for the time ranges required for recurring downtime slots.
Expand Down
2 changes: 1 addition & 1 deletion doc/06-distributed-monitoring.md
Expand Up @@ -2435,7 +2435,7 @@ Based on the [master with clients](06-distributed-monitoring.md#distributed-moni
scenario we'll now add a local nscp check which queries the NSClient++ API to check the free disk space.

Define a host object called `icinga2-client2.localdomain` on the master. Add the `nscp_api_password`
custom attribute and specify the drives to check.
custom variable and specify the drives to check.

```
[root@icinga2-master1.localdomain /]# cd /etc/icinga2/zones.d/master
Expand Down
4 changes: 2 additions & 2 deletions doc/07-agent-based-monitoring.md
Expand Up @@ -12,8 +12,8 @@ the `check_snmp` plugin binary, but there are plenty of [existing plugins](05-se
for specific use cases already around, for example monitoring Cisco routers.

The following example uses the [SNMP ITL](10-icinga-template-library.md#plugin-check-command-snmp) `CheckCommand` and just
overrides the `snmp_oid` custom attribute. A service is created for all hosts which
have the `snmp-community` custom attribute.
overrides the `snmp_oid` custom variable. A service is created for all hosts which
have the `snmp-community` custom variable.

```
apply Service "uptime" {
Expand Down
22 changes: 11 additions & 11 deletions doc/08-advanced-topics.md
Expand Up @@ -587,7 +587,7 @@ You might also want to add additional checks for SSL certificate expiration.

[Apply rules](03-monitoring-basics.md#using-apply) can be used to create a rule set which is
entirely based on host objects and their attributes.
In addition to that [apply for and custom attribute override](03-monitoring-basics.md#using-apply-for)
In addition to that [apply for and custom variable override](03-monitoring-basics.md#using-apply-for)
extend the possibilities.

The following example defines a dictionary on the host object which contains
Expand Down Expand Up @@ -664,7 +664,7 @@ apply Service "webserver_url" for (instance => config in host.vars.webserver.ins
}
```

The variables defined in the host dictionary are not using the typical custom attribute
The variables defined in the host dictionary are not using the typical custom variable
prefix recommended for CheckCommand parameters. Instead they are re-used for multiple
service checks in this example.
In addition to defining check parameters this way, you can also enrich the `display_name`
Expand All @@ -674,7 +674,7 @@ attribute with more details. This will be shown in in Icinga Web 2 for example.

There is a limited scope where functions can be used as object attributes such as:

* As value for [Custom Attributes](03-monitoring-basics.md#custom-attributes-functions)
* As value for [Custom Variables](03-monitoring-basics.md#custom-variables-functions)
* Returning boolean expressions for [set_if](08-advanced-topics.md#use-functions-command-arguments-setif) inside command arguments
* Returning a [command](08-advanced-topics.md#use-functions-command-attribute) array inside command objects

Expand All @@ -683,7 +683,7 @@ The other way around you can create objects dynamically using your own global fu
> **Note**
>
> Functions called inside command objects share the same global scope as runtime macros.
> Therefore you can access host custom attributes like `host.vars.os`, or any other
> Therefore you can access host custom variables like `host.vars.os`, or any other
> object attribute from inside the function definition used for [set_if](08-advanced-topics.md#use-functions-command-arguments-setif) or [command](08-advanced-topics.md#use-functions-command-attribute).
Tips when implementing functions:
Expand Down Expand Up @@ -850,7 +850,7 @@ object HostGroup "printers-lexmark" {
```

Take a different more complex example: All hosts with the
custom attribute `vars_app` as nested dictionary should be
custom variable `vars_app` as nested dictionary should be
added to the host group `ABAP-app-server`. But only if the
`app_type` for all entries is set to `ABAP`.

Expand All @@ -875,7 +875,7 @@ object Host "appserver02" {
}
globals.check_app_type = function(host, type) {
/* ensure that other hosts without the custom attribute do not match */
/* ensure that other hosts without the custom variable do not match */
if (typeof(host.vars.vars_app) != Dictionary) {
return false
}
Expand Down Expand Up @@ -924,7 +924,7 @@ The more significant problem was to only add the command parameter `--disk` to t
when the dictionary `compellent` contains the key `disks`, and omit it if not found.

By defining `set_if` as [abbreviated lambda function](17-language-reference.md#nullary-lambdas)
and evaluating the host custom attribute `compellent` containing the `disks` this problem was
and evaluating the host custom variable `compellent` containing the `disks` this problem was
solved like this:

```
Expand Down Expand Up @@ -972,11 +972,11 @@ The more programmatic approach for `set_if` could look like this:
if (typeof(srv_vars.compellent) == Dictionary) {
return srv_vars.compellent.contains("disks")
} else {
log(LogInformationen, "checkcommand set_if", "custom attribute compellent_checks is not a dictionary, ignoring it.")
log(LogInformationen, "checkcommand set_if", "custom variable compellent_checks is not a dictionary, ignoring it.")
return false
}
} else {
log(LogWarning, "checkcommand set_if", "empty custom attributes")
log(LogWarning, "checkcommand set_if", "empty custom variables")
return false
}
}}
Expand All @@ -990,7 +990,7 @@ or [EventCommands](09-object-types.md#objecttype-eventcommand) which does not re
a returned checkresult including state/output.

The following example was taken from the community support channels. The requirement was to
specify a custom attribute inside the notification apply rule and decide which notification
specify a custom variable inside the notification apply rule and decide which notification
script to call based on that.

```
Expand All @@ -1013,7 +1013,7 @@ apply Notification "mail-admins-short" to Host {
The solution is fairly simple: The `command` attribute is implemented as function returning
an array required by the caller Icinga 2.
The local variable `mailscript` sets the default value for the notification scrip location.
If the notification custom attribute `short` is set, it will override the local variable `mailscript`
If the notification custom variable `short` is set, it will override the local variable `mailscript`
with a new value.
The `mailscript` variable is then used to compute the final notification command array being
returned.
Expand Down

0 comments on commit e9f61ef

Please sign in to comment.