Skip to content

Commit

Permalink
Update example
Browse files Browse the repository at this point in the history
  • Loading branch information
markuslf committed Mar 30, 2024
1 parent af2a5e6 commit cbb84e6
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions check-plugins/example/example
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,17 @@ def parse_args():
default=DEFAULT_CRIT,
)

parser.add_argument(
'--ignore-regex',
help='Any english title matching this python regex will be ignored '
'(repeating). '
'Example: \'(?i)linuxfabrik\' for a case-insensitive search for '
'"linuxfabrik".',
action='append',
default=[],
dest='IGNORE_REGEX',
)

parser.add_argument(
'--test',
help='For unit tests. Needs "path-to-stdout-file,path-to-stderr-file,expected-retc".',
Expand Down Expand Up @@ -117,8 +128,17 @@ def main():
msg = ''
state = STATE_OK
perfdata = ''
try:
compiled_ignore_regex = [re.compile(item) for item in args.IGNORE_REGEX]
except:
lib.base.cu('Unable to compile regex.')

table_data = []

# analyze data
title = 'Lorem ipsum'
if any(item.search(title) for item in compiled_ignore_regex):
pass # in loops: continue
value = str(lib.time.now())[-2:]

# build the message
Expand Down

0 comments on commit cbb84e6

Please sign in to comment.