checkmk icon indicating copy to clipboard operation
checkmk copied to clipboard

fix check_mk_agent.openbsd multi network interfaces support

Open coreidcc opened this issue 1 year ago • 2 comments

current behaviour: the script work well if there is only one network interface configured but as soon as more then one network interface exists the reports just garbage.

the cause: seeting IFS to '' will skip any substitution resulting in for loop only executing once (the list to iterate over just consists of a single value)

solution: set IFS to only contain a newline

Thank you for your interest in contributing to Checkmk! Consider looking into Readme regarding process details.

General information

Please give a brief summary of the affected device, software or appliance. Keep in mind that we are experts in monitoring, but we cannot be experts on all supported devices. A little context will help us assess your proposed change.

Bug reports

Please include:

  • Your operating system name and version
  • Any details about your local setup that might be helpful in troubleshooting
  • Detailed steps to reproduce the bug
  • An agent output or SNMP walk
  • The ID of a submitted crash report for reference (if applicable)

Proposed changes

Sometimes it is hard for us to assess the quality of a fix. While it may work for you, it is our job to ensure that it works for everybody. These are some ways to help us:

  • What is the expected behavior?
  • What is the observed behavior?
  • If it's not obvious from the above: In what way does your patch change the current behavior?
  • Consider writing a unit test that would have failed without your fix.
  • Is this a new problem? What made you submit this PR (new firmware, new device, changed device behavior)?

coreidcc avatar Sep 23 '24 17:09 coreidcc

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

github-actions[bot] avatar Sep 23 '24 17:09 github-actions[bot]

I have read the CLA Document and I hereby sign the CLA or my organization already has a signed CLA.

coreidcc avatar Sep 24 '24 16:09 coreidcc

Hello @coreidcc, Thank you for the suggestion and contribution.

I do have one question - Why use $(echo -n "\n\b")? Wouldn't using $'\n' be enough or do is there a specific reason why it is not?

Thanks!

Best, Luka

racicLuka avatar Mar 05 '25 17:03 racicLuka

Hi Luka

Using just '\n' won't work. the result is still garbage. you need to use '\n\b'

regard

On 2025-03-05 18:38, Luka Racic wrote:

Hello @coreidcc [1], Thank you for the suggestion and contribution.

I do have one question - Why use $(echo -n "\n\b")? Wouldn't using $'\n' be enough or do is there a specific reason why it is not?

Thanks!

Best, Luka

-- Reply to this email directly, view it on GitHub [2], or unsubscribe [3]. You are receiving this because you were mentioned.Message ID: @.***> racicLuka left a comment (Checkmk/checkmk#757) [2]

Hello @coreidcc [1], Thank you for the suggestion and contribution.

I do have one question - Why use $(echo -n "\n\b")? Wouldn't using $'\n' be enough or do is there a specific reason why it is not?

Thanks!

Best, Luka

-- Reply to this email directly, view it on GitHub [2], or unsubscribe [3]. You are receiving this because you were mentioned.Message ID: @.***>

Links:

[1] https://github.com/coreidcc [2] https://github.com/Checkmk/checkmk/pull/757#issuecomment-2701633761 [3] https://github.com/notifications/unsubscribe-auth/AAV2RESH5IMS364QJCKTPLL2S4ZA5AVCNFSM6AAAAABOWSGZJWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMBRGYZTGNZWGE

coreidcc avatar Mar 06 '25 21:03 coreidcc

Understood. I will do some testing and let you know. Thanks for the help!

racicLuka avatar Mar 07 '25 08:03 racicLuka

I've been testing the network interface parsing with different IFS settings, and I have a question:

I'm able to get correct parsing of multiple network interfaces using IFS=$'\n'

Could you provide an example case where using IFS=$(echo -n "\n\b") is needed instead of IFS=$'\n'? This would help me better understand the specific issue you're trying to solve.

Also, could you share any error messages or incorrect behaviors you've observed with IFS=$'\n'?

Thank you!

racicLuka avatar Mar 30 '25 22:03 racicLuka

Hello @coreidcc,

Did you get a chance to take a look at my previous comment? Without some more information, we will need to close the PR without merging it.

Best, Luka

racicLuka avatar Apr 15 '25 08:04 racicLuka

Hi @coreidcc, Since there has been no comment from you for a while, I will close the PR. Of course, feel free to reopen it if you feel the need.

Best, Luka

racicLuka avatar Apr 23 '25 12:04 racicLuka