Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better compat between map-values and convert-custom-values options #4902

Merged
merged 2 commits into from
Mar 29, 2024

Conversation

tanguyvda
Copy link
Contributor

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

  • Patch fixing an issue (non-breaking change)
  • New functionality (non-breaking change)
  • Breaking change (patch or feature) that might cause side effects breaking part of the Software

Target serie

  • 22.04.x
  • 22.10.x
  • 23.04.x
  • 23.10.x
  • 24.04.x (master)

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

  • I have followed the coding style guidelines provided by Centreon
  • I have commented my code, especially new classes, functions or any legacy code modified. (docblock)
  • I have commented my code, especially hard-to-understand areas of the PR.
  • I have rebased my development branch on the base branch (master, maintenance).

@tanguyvda tanguyvda requested a review from a team as a code owner February 13, 2024 08:44
sdepassio
sdepassio previously approved these changes Mar 26, 2024
@omercier omercier added the do-not-spellcheck avoid running the spellchecks in github action label Mar 26, 2024
omercier
omercier previously approved these changes Mar 26, 2024
@omercier omercier dismissed stale reviews from sdepassio and themself via a736cce March 29, 2024 12:00
@tanguyvda tanguyvda requested a review from a team as a code owner March 29, 2024 12:00
@tanguyvda tanguyvda requested review from sc979 and tuntoja March 29, 2024 12:00
@omercier omercier force-pushed the CTOR-370_mapping_and_custom_value_compat branch from a736cce to 1738a06 Compare March 29, 2024 12:05
@sc979 sc979 removed request for sc979 and tuntoja March 29, 2024 12:59
@omercier omercier merged commit d1b9530 into develop Mar 29, 2024
12 checks passed
@omercier omercier deleted the CTOR-370_mapping_and_custom_value_compat branch March 29, 2024 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-spellcheck avoid running the spellchecks in github action
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants