-
Notifications
You must be signed in to change notification settings - Fork 474
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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"]) | ||
discovered_state = params["discovered_state"] | ||
state, state_info = data["state"] | ||
yield state, "Status: %s" % state_info | ||
|
||
required_state = params.get("required_state", params["discovered_state"]) | ||
if state_info != required_state: | ||
yield 2, "Expected: %s" % required_state | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Yes. Same goes for the |
||
yield 2, "CRIT - Status: %s (discovered: %s, required: %s) (!!)" % (state_info, discovered_state, required_state) | ||
else: | ||
yield 0, "OK - Status: %s" % state_info | ||
|
||
|
||
check_info["raritan_pdu_plugs"] = LegacyCheckDefinition( | ||
|
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.
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.