Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[procdockerstatsd] Fix CMD field in dB #4335

Merged
merged 1 commit into from
Mar 28, 2020
Merged
Changes from all commits
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
12 changes: 6 additions & 6 deletions files/image_config/procdockerstatsd/procdockerstatsd
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class ProcDockerStats:

def __init__(self):
self.state_db = swsssdk.SonicV2Connector(host=REDIS_HOSTIP)
self.state_db.connect("STATE_DB")
self.state_db.connect("STATE_DB")

def run_command(self, cmd):
proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
(stdout, stderr) = proc.communicate()
Expand Down Expand Up @@ -75,7 +75,7 @@ class ProcDockerStats:
# To remove extra space before UID
val = list(filter(None, values1))
# Merging extra columns created due to space in cmd ouput
val[8:] = [''.join(val[8:])]
val[8:] = [' '.join(val[8:])]
process_data = dict(zip(keylist, val))
process_data_list.append(process_data)
return process_data_list
Expand Down Expand Up @@ -109,10 +109,10 @@ class ProcDockerStats:
for row in dict_list[0:]:
cid = row.get('CONTAINER ID')
if cid:
key = 'DOCKER_STATS|' + str(cid)
key = 'DOCKER_STATS|' + str(cid)
dockerdict[key] = {}
dockerdict[key]['NAME'] = row.get('NAME')

splitcol = row.get('CPU %')
cpu = re.split("%", str(splitcol))
dockerdict[key]['CPU%'] = str(cpu[0])
Expand All @@ -131,7 +131,7 @@ class ProcDockerStats:
netio = re.split(" / ", str(splitcol))
dockerdict[key]['NET_IN_BYTES'] = str(self.convert_to_bytes(netio[0]))
dockerdict[key]['NET_OUT_BYTES'] = str(self.convert_to_bytes(netio[1]))

splitcol = row.get('BLOCK I/O')
blockio = re.split(" / ", str(splitcol))
dockerdict[key]['BLOCK_IN_BYTES'] = str(self.convert_to_bytes(blockio[0]))
Expand Down