icingaweb2-module-businessprocess icon indicating copy to clipboard operation
icingaweb2-module-businessprocess copied to clipboard

New operand XOR or MAX 1

Open slalomsk8er opened this issue 5 years ago • 4 comments

Expected Behavior

I would like to define a node in which only one of 2 children is allowed to be OK at the same time.

CRITICAL + CRITICAL = CRITICAL OK + CRITICAL = OK CRITICAL + OK = OK OK + OK = CRITICAL

Current Behavior

OR works for the first 3 cases. MIN 1 works for the first 3 cases. NOT works for the last 3 cases.

Possible Solution

Addition of a new operand - XOR or MAX 1.

Context

I have identical checks for a service on 2 servers but only one is allowed to run. If both run race conditions and duplication of data could occur.

slalomsk8er avatar Feb 26 '19 11:02 slalomsk8er

Hi,

thanks for the suggestion. That's definitely something I think is a good addition. Though, for now there's no chance it goes into the upcoming release. Maybe the next.

In case you can't wait, try this:

A = localhost;Hoststatus
display 0;A;A

NOT A = ! A
display 0;NOT A;NOT A

B = test-down-1;Hoststatus
display 0;B;B

NOT B = ! B
display 0;NOT B;NOT B

NOT A AND NOT B = NOT A & NOT B
display 0;NOT A AND NOT B;NOT A AND NOT B

NOT (NOT A AND NOT B) = ! NOT A AND NOT B
display 0;NOT (NOT A AND NOT B);NOT (NOT A AND NOT B)



A and B = A & B
display 0;A and B;A and B

NOT A AND B = ! A and B
display 0;NOT A AND B;NOT A AND B

XOR = NOT A AND B & NOT (NOT A AND NOT B)
display 1;XOR;XOR

:rofl:

nilmerg avatar Feb 28 '19 09:02 nilmerg

On my machine, the config workaround shown does not work for the scenario described above. The root node becomes CRITICAL if any of its nodes are CRITICAL, but should be OK.

markuslf avatar Mar 11 '22 11:03 markuslf

Hm, works still fine for me:

All OK All CRITICAL One OK One CRITICAL
Screenshot from 2022-03-11 14-01-00 Screenshot from 2022-03-11 14-00-38 Screenshot from 2022-03-11 13-59-37

nilmerg avatar Mar 11 '22 13:03 nilmerg

Strange... the workaround currently works for me too. Don't know what I have tested. I'm pretty sure it didn't work yesterday.

Nevertheless, I have submitted a pull request to implement "MAX 1" for the current development version.

markuslf avatar Mar 11 '22 14:03 markuslf