From eda537882988da997422248f6d7e29f1fd0c9ad5 Mon Sep 17 00:00:00 2001 From: Joshua Powers Date: Wed, 24 Jan 2024 13:10:04 -0700 Subject: [PATCH] docs(inputs.mysql): Add section on how to convert string to numeric (#14620) --- plugins/inputs/mysql/README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/plugins/inputs/mysql/README.md b/plugins/inputs/mysql/README.md index ec4e72958..676cf482c 100644 --- a/plugins/inputs/mysql/README.md +++ b/plugins/inputs/mysql/README.md @@ -136,6 +136,28 @@ See the [CONFIGURATION.md][CONFIGURATION.md] for more details. # insecure_skip_verify = false ``` +### String Data + +Some fields may return string data. This is unhelpful for some outputs where +numeric data is required (e.g. Prometheus). In these cases, users can make use +of the enum processor to convert string values to numeric values. Below is an +example using the `slave_slave_io_running` field, which can have a variety of +string values: + +```toml +[[processors.enum]] + namepass = "mysql" + [[processors.enum.mapping]] + field = "slave_slave_io_running" + dest = "slave_slave_io_running_int" + default = 4 + [processors.enum.mapping.value_mappings] + Yes = 0 + No = 1 + Preparing = 2 + Connecting = 3 +``` + ### Metric Version When `metric_version = 2`, a variety of field type issues are corrected as well