Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
23 changes: 23 additions & 0 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,29 @@ def load_minigraph():
click.echo("Please note setting loaded from minigraph will be lost after system reboot. To preserve setting, run `config save`.")




#
# config monitortx THRESHOLD 40
# config monitortx POOLING_PERIOD 20
#

@config.command("monitortx")
@click.argument('param', required=True)
@click.argument('value', required=True)
def monitortx_set(param, value):
if param.lower() != 'threshold' and param.lower() != 'pooling_period':
click.echo("Please enter valid configurations")
else:
table_name = "TX_ERROR_CFG"
config_db = ConfigDBConnector()
config_db.connect()
click.echo(param)
config_db.set_entry(table_name, param, {"value":value})




#
# 'hostname' command
#
Expand Down
28 changes: 28 additions & 0 deletions show/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,34 @@ def status(interfacename, verbose):
run_command(cmd, display_cmd=verbose)




@cli.group(cls=AliasedGroup, default_if_no_args=False)
def monitortx():
"""show configurations of monitor tx"""
pass


# show monitortx tx_config
@monitortx.command()
def tx_config():
config_db = ConfigDBConnector()
config_db.connect()
data = config_db.get_table('TX_ERROR_CFG')

for param in data.keys():
value = data[param]['value']
if param.lower().endswith('period'):
conf = 'period_pool'
else:
conf = 'threshold'

click.echo('%s value is %s' % (conf, value))





# 'counters' subcommand ("show interfaces counters")
@interfaces.group(invoke_without_command=True)
@click.option('-a', '--printall', is_flag=True)
Expand Down