This is the documentation page for an unsupported version of Zabbix.
Is this not what you were looking for? Switch to the current version or choose one from the drop-down menu.

1 Exemples d'utilisation

Aperçu

Cette section présente des exemples d'utilisation des étapes de prétraitement pour accomplir certaines tâches pratiques.

Filtrage des enregistrements du journal des événements VMware

Utilisation d'un prétraitement d'expression régulière pour filtrer les événements inutiles du journal des événements VMWare.

1. Sur un hôte VMWare Hypervisor en état de marche, vérifiez que l'élément du journal des événements vmware.eventlog[<url>,<mode>] est présent et fonctionne correctement. Notez que l'élément du journal des événements peut déjà être présent sur l'hyperviseur si le modèle Template VM VMWare a été lié lors de la création de l'hôte.

2. Sur l'hôte VMWare Hypervisor, créez un élément dépendant de type 'Log' et définissez l'élément du journal des événements comme maître.

Dans l'onglet "Prétraitement" de la rubrique dépendante sélectionnez l'option de validation "Correspond à l'expression régulière" et le motif de remplissage, par exemple :

".* logged in .*" - filters all logging events in the event log
       "\bUser\s+\K\S+" -  filter only lines with usernames from the event log

Si l'expression régulière ne correspond pas, l'élément dépendant devient non pris en charge avec un message d'erreur correspondant. Pour éviter cela, cochez la case "Personnalisé en cas d'échec" et sélectionnez pour ignorer la valeur sans correspondance, par exemple.

Une autre approche qui permet d'utiliser les groupes de correspondance et le contrôle de sortie consiste à sélectionner l'option "Expression régulière" dans l'onglet "Prétraitement" et à remplir les paramètres, par exemple :

pattern: ".*logged in.*", output: "\0" - filters all logging events in the event log
       pattern "User (.*?)(?=\ )", output: "\1" - filter only usernames from the event log

Checking retrieved value type

This example uses the Custom multiplier preprocessing step to check if the retrieved item value type is numeric.

In the Preprocessing tab of an item, select the "Custom multiplier" preprocessing step and set the following parameter:

# Multiplies the retrieved value by 1:
       number: 1

If preprocessing fails (e.g., input is not numeric), then the item becomes unsupported with a corresponding error message. To avoid this, mark the "Custom on fail" checkbox and select an option such as discarding the value or setting a custom one.

Checking for not supported value

This example uses the Check for not supported value preprocessing step to check if the item value could not be retrieved.

When a Zabbix server/proxy poller process attempts to collect an item value, it may:

  • Return a valid result.
  • Return a result that initially seems valid but may become unsupported later (e.g., due to a value type mismatch after preprocessing).
  • Return an error of collecting the value, causing the item to become unsupported. Common causes include:
    • Unknown item key (for Zabbix agent, Simple check, or Zabbix internal items)
    • Unknown OID (SNMP agent), unknown sensor (IPMI agent), or no JMX metric (JMX agent)
    • Cannot read trap file (SNMP trap)
    • Script not found (External check)
    • No such URL (HTTP agent)
    • Login failed (SSH agent, TELNET agent)
    • Invalid formula syntax (Calculated), JavaScript syntax error (Script), or invalid SQL (Database monitor)

To detect and handle errors of collecting item values, you can use the "Check for not supported value" preprocessing step. Note that this step is always executed first and only detects errors that occur before preprocessing begins.

In the Preprocessing tab of an item, select the "Check for not supported value" preprocessing step.

Then, use the Custom on fail option to discard the value (in this case, the error), set a custom value, or return a custom error message. Please note that discarded values are not stored in the database; as a result, triggers are not evaluated and trend data is not generated.