Skip to content

Commit

Permalink
[show] Add command 'show runningconfiguration syslog' (sonic-net#617)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsvanduyn authored and jleveque committed Aug 26, 2019
1 parent b6ec539 commit e962f95
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
19 changes: 19 additions & 0 deletions doc/Command-Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2959,6 +2959,7 @@ This sub-section explains the show commands for displaying the running configura
5) all
6) acl
7) ports
8) syslog

**show runningconfiguration all**

Expand Down Expand Up @@ -3012,6 +3013,24 @@ This command displays the running configuration of the ntp module.
admin@sonic:~$ show runningconfiguration ntp
```

**show runningconfiguration syslog**

This command displays the running configuration of the syslog module.

- Usage:
show runningconfiguration syslog


- Example:
```
admin@str-s6000-acs-11:~$ show run syslog
Syslog Servers
----------------
4.4.4.4
5.5.5.5
```


**show runningconfiguration snmp**

This command displays the running configuration of the snmp module.
Expand Down
18 changes: 18 additions & 0 deletions show/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1480,6 +1480,24 @@ def ntp(verbose):
run_command(cmd, display_cmd=verbose)


# 'syslog' subcommand ("show runningconfiguration syslog")
@runningconfiguration.command()
@click.option('--verbose', is_flag=True, help="Enable verbose output")
def syslog(verbose):
"""Show Syslog running configuration"""
syslog_servers = []
syslog_dict = {}
with open("/etc/rsyslog.conf") as syslog_file:
data = syslog_file.readlines()
for line in data:
if line.startswith("*.* @"):
line = line.split(":")
server = line[0][5:]
syslog_servers.append(server)
syslog_dict['Syslog Servers'] = syslog_servers
print tabulate(syslog_dict, headers=syslog_dict.keys(), tablefmt="simple", stralign='left', missingval="")


#
# 'startupconfiguration' group ("show startupconfiguration ...")
#
Expand Down

0 comments on commit e962f95

Please sign in to comment.