Versions Compared

Key

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

Pour quoi est-il fait ?

Vous pouvez définir un tagger qui va utiliser automatiquement le nom pour ajouter des templates aux objets détectés. Le nom commun du tagger est regexp-tags et peut charger de nouvelles règles de nommage

  

Comment définir une règle Regexp

Pour chaque règle Regexp , vous devrez définir un nouveau module et l'ajouter dans la configuration du tagger regexp-tags .

Vous pouvez copier l'exemple  

What Host name based tagger is done for

You can define a tagger that will use the Host name to automatically add host templates to detected objects. The common tagger named regexp-tags can load new ip range rules with modules.

  

How to define a new Regexp rule

For each Regexp rule, you will need to define a new module and add it in the regexp-tags tagger configuration.

You can copy the sample module /etc/shinken/modules/sync-regexp-tag.cfg into a new file name and edit it: dans un nouveau fichier pour le modifier

Code Block
define module{
  module_name       sync-regexp-tag-windows
  module_type       sync-regexp-tag
  matched_prop      host_name
  matched_regexp    .*srvwin.*
  method            append
  property          use
  value             windows
}

For each Regexp rule, you will need to define a new module and add it in the regexp-tags tagger configuration.

You can copy the sample module /etc/shinken/modules/sync-regexp-tag.cfg into a new file name and edit it:

 

The properties are:

Les propriétés sont :

  • module_name: must be unique in the modulesdoit être unique
  • module_type: must be equal to syncdoit être égal à sync-regexp-tag
  • matched_prop: the property that we will match. By default the property is la propriété qui doit correspondre.Par défaut, la propriété est le host_name (Name of the host objectNom de l'objet hôte)

  • matched_regexp: Regexp that the object must match to activate this rule

  • method: how you want to modify your detected object:
    • replace: put the value if not another one is in place
    • append: add the value at the END of the host templates
    • prepend: add the value at on the BEGINING of the host templates
    • set: just the value, erase what was before.
  • property: which host property to change. By default the property is "use" (host templates)
  • value: which value to set/append/prepend/replace

 

  • auquel l'objet doit correspondre

  • method: comment vous voulez modifier l'objet détectét:
    • replace: mettre la valeur si aucune en place
    • append: ajouter la valeur à la FIN du template
    • prepend: ajouter la valeur au DEBUT du template
    • set: juste la valeur, en écrasant la valeur précédente .
  • property: quelle propriété modifier
  • value: quelle valeur prendre en compte

 

Vous devez alors éditer le fichier rexexp-tags pour lier le nouveau module dans le fichier  Then you must edit the ip-tags tagger definition to link your new module in the file /etc/shinken/taggers/regexp-tags.cfg:

Code Block
define tagger {
  tagger_name    regexp-tags
  order          1
  modules        sync-regexp-tag,sync-regexp-tag-windows
  description     This tagger will tag host based on the host_name
}

Then you must restart your shinken-synchronizer daemon.Vous devez ensuite redémarrer le synchronizer