Changeset View
Changeset View
Standalone View
Standalone View
swh/icinga_plugins/cli.py
Show All 13 Lines | |||||
@click.group(name='icinga_plugins', context_settings=CONTEXT_SETTINGS) | @click.group(name='icinga_plugins', context_settings=CONTEXT_SETTINGS) | ||||
@click.option('-w', '--warning', type=int, | @click.option('-w', '--warning', type=int, | ||||
help='Warning threshold.') | help='Warning threshold.') | ||||
@click.option('-c', '--critical', type=int, | @click.option('-c', '--critical', type=int, | ||||
help='Critical threshold.') | help='Critical threshold.') | ||||
@click.pass_context | @click.pass_context | ||||
def cli(ctx, **kwargs): | def cli(ctx, warning, critical): | ||||
"""Main command for Icinga plugins | """Main command for Icinga plugins | ||||
""" | """ | ||||
ctx.ensure_object(dict) | ctx.ensure_object(dict) | ||||
ctx.obj.update(kwargs) | if warning: | ||||
ctx.obj['warning_threshold'] = int(warning) | |||||
if critical: | |||||
ctx.obj['critical_threshold'] = int(critical) | |||||
@cli.group(name='check-vault') | @cli.group(name='check-vault') | ||||
@click.option('--swh-storage-url', type=str, required=True, | @click.option('--swh-storage-url', type=str, required=True, | ||||
help='URL to an swh-storage HTTP API') | help='URL to an swh-storage HTTP API') | ||||
@click.option('--swh-web-url', type=str, required=True, | @click.option('--swh-web-url', type=str, required=True, | ||||
help='URL to an swh-web instance') | help='URL to an swh-web instance') | ||||
@click.option('--poll-interval', type=int, default=10, | @click.option('--poll-interval', type=int, default=10, | ||||
▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines |