better compat between map-values and convert-custom-values options #4902
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
use case is the following
SNMPv2-SMI::enterprises.1248.4.1.1.1.9.0 = STRING: "03 0000 0000 T1"
i want to extract 03 because this is the status code of my projector
therefore, I use the following option in the string-value of the snmp protocol plugin
--convert-custom-values='my @tanguy = split(/ /, $value); $value=$tanguy[0];'
03 is a nice value,
OK: value(s): 03
but, I want to have a mapping and that's where the problem is
--map-values='03=>normal'
this will not work
that's because the mapping is done before the custom values mecanism
therefore, to have it work, I need to put
--map-values='03 0000 0000 T1=>normal'
But may be the 0000 0000 T1 is a dynamic value and therefore my mapping won’t work if they change. That’s why I need to be able to do the mapping on the custom value that is generated from the --convert-custom-values option
Type of change
Target serie
How this pull request can be tested ?
Please describe the procedure to verify that the goal of the PR is matched. Provide clear instructions so that it can be correctly tested.
Any relevant details of the configuration to perform the test should be added.
Checklist
Community contributors & Centreon team