Changeset View
Changeset View
Standalone View
Standalone View
swh/icinga_plugins/cli.py
Show All 11 Lines | |||||
from .vault import VaultCheck | from .vault import VaultCheck | ||||
@click.group(name='icinga_plugins', context_settings=CONTEXT_SETTINGS) | @click.group(name='icinga_plugins', context_settings=CONTEXT_SETTINGS) | ||||
@click.option('--swh-storage-url', type=str, | @click.option('--swh-storage-url', type=str, | ||||
help='URL to an swh-storage HTTP API') | help='URL to an swh-storage HTTP API') | ||||
@click.option('--swh-web-url', type=str, | @click.option('--swh-web-url', type=str, | ||||
help='URL to an swh-web instance') | help='URL to an swh-web instance') | ||||
@click.option('-w', '--warning', type=int, | |||||
help='Warning threshold.') | |||||
@click.option('-c', '--critical', type=int, | |||||
help='Critical threshold.') | |||||
@click.pass_context | @click.pass_context | ||||
def cli(ctx, swh_storage_url, swh_web_url): | def cli(ctx, swh_storage_url, swh_web_url, warning, critical): | ||||
"""Main command for Icinga plugins | """Main command for Icinga plugins | ||||
""" | """ | ||||
ctx.ensure_object(dict) | ctx.ensure_object(dict) | ||||
ctx.obj['swh_storage_url'] = swh_storage_url | ctx.obj['swh_storage_url'] = swh_storage_url | ||||
ctx.obj['swh_web_url'] = swh_web_url | ctx.obj['swh_web_url'] = swh_web_url | ||||
ctx.obj['warning_threshold'] = warning | |||||
ctx.obj['critical_threshold'] = critical | |||||
@cli.group(name='check-vault') | @cli.group(name='check-vault') | ||||
@click.option('--poll-interval', type=int, default=10, | @click.option('--poll-interval', type=int, default=10, | ||||
help='Interval (in seconds) between two polls to the API, ' | help='Interval (in seconds) between two polls to the API, ' | ||||
'to check for cooking status.') | 'to check for cooking status.') | ||||
@click.pass_context | @click.pass_context | ||||
def check_vault(ctx, poll_interval): | def check_vault(ctx, poll_interval): | ||||
Show All 9 Lines |