Skip to content

FEATURE-835: Add arg to ignore given backends #907

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion check-plugins/haproxy-status/haproxy-status
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ def parse_args():
default=DEFAULT_CRIT,
)

parser.add_argument(
'--ignore',
help='Ignores specified backends.',
dest='IGNORE',
action='append',
)

parser.add_argument(
'--insecure',
help='This option explicitly allows to perform "insecure" SSL connections. '
Expand Down Expand Up @@ -198,6 +205,11 @@ def main():
state = STATE_OK
perfdata_parts = []
table_values = []
ignore_backends = []

# check ignore arg and fill
if args.IGNORE:
ignore_backends = args.IGNORE

# analyze data
for line in result[1:]:
Expand Down Expand Up @@ -272,7 +284,7 @@ def main():

# Status check
status_state = STATE_OK
if ha_status not in GOOD_STATUSES:
if ha_status not in GOOD_STATUSES and ha_pxname not in ignore_backends:
status_state = STATE_WARN
msg_parts.append(f'{ha_pxname} {ha_svname}: {ha_status}, ')
state = lib.base.get_worst(status_state, state)
Expand Down