Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Données sur un hôte ou un check 


L'une des caractéristiques principales qui rend Shinken Enterprise si flexible, c'est sa capacité à utiliser des données dans la définition des commandes. Ces données permettent de référencer des informations provenant des hôtes, des services, ou d'autres sources dans les commandes.


Remplacement de données 

Host and check datas

...

Before Shinken Enterprise executes a command, it will replace any datas it finds in the command definition with their corresponding values. This data substitution occurs for all types of commands that Shinken Enterprise executes - host and service checks, notifications, event handlers, etc.

...

Tip: If, you need to have the '$' character in one of your command (and not referring to a data), please put "$$" instead. Shinken Enterprise will replace it well


Example 1: Host Address data


When you use host and service datas in command definitions, they refer to values for the host or service for which the command is being run. Let's try an example. Assuming we are using a host definition and a check_ping command defined like this:

...


You can use a single command definition to check an unlimited number of hosts. Each host can be checked with the same command definition because each host's address is automatically substituted in the command line before execution.


Example 2: Command Argument datas

You can pass arguments to commands as well, which is quite handy if you'd like to keep your command definitions rather generic. Arguments are specified in the object (i.e. host or service) definition, by separating them from the command name with exclamation points (!) like so:

...



If you need to pass bang (!) characters in your command arguments, you can do so by escaping them with a backslash (\). If you need to include backslashes in your command arguments, they should also be escaped with a backslash.

 

On-Demand datas


Normally when you use host and service datas in command definitions, they refer to values for the host or service for which the command is being run. For instance, if a host check command is being executed for a host named "linuxbox", all the :ref:standard host datas <thebasics/datalist> will refer to values for that host ("linuxbox").

...

  • $SERVICEGROUPALIAS:DNS-Cluster$ // On-demand servicegroup data

 

Custom Variable datas


Any custom object variables that you define in host, service, or contact definitions are also available as datas. Custom variable datas are named as follows:

...

The "_MACADDRESS" custom variable would be available in a data called "$_HOSTMACADDRESS$".

Data Cleansing

Some datas are stripped of potentially dangerous shell metacharacters before being substituted into commands to be executed. Which characters are stripped from the datas depends on the setting of the illegal_data_output_chars directive. The following datas are stripped of potentially dangerous characters:

...