Skip to content

Commit

Permalink
CP-44440: Collect config and logs in bugreport
Browse files Browse the repository at this point in the history
  • Loading branch information
BengangY committed Nov 7, 2023
1 parent ee16423 commit 4763b49
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions xen-bugtool
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,10 @@ exclude those logs from the archive.
'vgscan-log']])
tree_output(CAP_XENSERVER_INSTALL, INSTALLED_REPOS_DIR)
tree_output(CAP_XENSERVER_INSTALL, UPDATE_APPLIED_DIR)
func_output(CAP_XENSERVER_CONFIG, 'snmp_xs_conf', snmp_xs_conf)
func_output(CAP_XENSERVER_CONFIG, 'snmpd_xs_conf', snmpd_xs_conf)
func_output(CAP_XENSERVER_CONFIG, 'snmpd_conf', snmpd_conf)
func_output(CAP_XENSERVER_CONFIG, 'snmpd', snmpd)

try:
load_plugins()
Expand Down Expand Up @@ -1516,6 +1520,38 @@ def multipathd_topology(cap):

return stdout

def snmp_xs_conf(cap):
sed_snmp_xs_conf = ['sed',
'-e', 's#\(community *= *\).*#\\1********#',
'-e', 's#\(authentication_key *= *\).*#\\1********#',
'-e', 's#\(privacy_key *= *\).*#\\1********#',
'/etc/snmp/snmp.xs.conf']
pipe = Popen(sed_snmp_xs_conf, bufsize=1, stdin=PIPE, stdout=PIPE, stderr=dev_null)
stdout, _ = pipe.communicate()
return stdout

def snmpd_xs_conf(cap):
sed_snmpd_xs_conf = ['sed',
'-e', 's#\(com2sec\( \+\S\+\)\{2\} \+\).*#\\1********#',
'/etc/snmp/snmpd.xs.conf']
pipe = Popen(sed_snmpd_xs_conf, bufsize=1, stdin=PIPE, stdout=PIPE, stderr=dev_null)
stdout, _ = pipe.communicate()
return stdout

def snmpd_conf(cap):
sed_snmpd_conf = ['sed',
'-e', 's#\(usmUser\( \+\S\+\)\{7\} \+\)\S\+\( \+\S\+ \+\)\S\+\( \+\S\+\)#\\1********\\3********\\4#',
'/var/lib/net-snmp/snmpd.conf']
pipe = Popen(sed_snmpd_conf, bufsize=1, stdin=PIPE, stdout=PIPE, stderr=dev_null)
stdout, _ = pipe.communicate()
return stdout

def snmpd(cap):
cat_snmpd = ['cat', '/etc/sysconfig/snmpd']
pipe = Popen(cat_snmpd, bufsize=1, stdin=PIPE, stdout=PIPE, stderr=dev_null)
stdout, _ = pipe.communicate()
return stdout

def dp_list():
output = StringIO.StringIO()
procs = [ProcOutput([OVS_DPCTL, 'dump-dps'], caps[CAP_NETWORK_STATUS][MAX_TIME], output)]
Expand Down

0 comments on commit 4763b49

Please sign in to comment.