-
Notifications
You must be signed in to change notification settings - Fork 466
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
Fixed raritan_pdu_plugs.py #753
Conversation
Fixed state of powered off plugs compared to discovered state or requested state rule.
All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA or my organization already has a signed CLA. |
@@ -33,12 +33,14 @@ def check_raritan_pdu_plugs(item, params, parsed): | |||
if data.get("outlet_name"): | |||
yield 0, data["outlet_name"] | |||
|
|||
required_state = params.get("required_state", params["discovered_state"]) | |||
state, state_info = data["state"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
state
is now completely unused; even if the user did not configure anything. Is that intended? It does not seem right to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
state
is now completely unused; even if the user did not configure anything. Is that intended? It does not seem right to me.
required_state (if there is a "PDU Plug state" rule for this plug) and discovered_state are both stored as text ("on"/"off").
This is already implemented and it is what I have do deal with. Therefore I have to compare to that string using state_info and not state.
But since state and state_info have a one-to-one mapping (0,"on" | 2,"off" | 3, "unknown") it really makes no difference.
In version 1.6 a plug got a critical state when its state was different from the one from service discovery.
This could be overruled by a "State of PDU Plugs" rule.
My aim was to restore this behavior.
removed repeated yield lines
if state_info != required_state: | ||
yield 2, "Expected: %s" % required_state |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mo-ki should we include the "CRIT -" and "OK -" in the summary? This should be picked up by the respective state code, right? and therefore redundant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Same goes for the (!!)
.
Currently, the check disregards the custom parameters set by the user, always returning the state defined by the SNMP mapping. With this change, the service now compares the current state with the required state defined by the user in the check parameters. If there is a mismatch, a "CRIT" result will be yielded, comparing the actual and expected plug state. Otherwise, an "OK" result will be yielded with the plug state. If these parameters are not explicitly set for a service, the service will compare the current state with the state set during service discovery. CMK-18917 Closes: #753 Co-authored-by: Logan Connolly <[email protected]> Change-Id: I778f8d4aaf73ee9dad5e684ade88bf7141142b5f
Currently, the check disregards the custom parameters set by the user, always returning the state defined by the SNMP mapping. With this change, the service now compares the current state with the required state defined by the user in the check parameters. If there is a mismatch, a "CRIT" result will be yielded, comparing the actual and expected plug state. Otherwise, an "OK" result will be yielded with the plug state. If these parameters are not explicitly set for a service, the service will compare the current state with the state set during service discovery. CMK-18917 Closes: #753 Co-authored-by: Logan Connolly <[email protected]> Change-Id: I778f8d4aaf73ee9dad5e684ade88bf7141142b5f
Hi @Woodstock68, |
Fixed state of powered off plugs.
Powered off plugs always had a critical state ignoring the discovered state and existing PDU plug state rules.