mirror of https://github.com/nicolargo/glances
AMP: regex with special chars #2152
parent
6ac163536d
commit
1aa5596cc2
|
@ -712,3 +712,9 @@ regex=\/sbin\/init
|
|||
refresh=30
|
||||
one_line=true
|
||||
service_cmd=/usr/bin/service --status-all
|
||||
|
||||
[amp_issue2139]
|
||||
enable=true
|
||||
#regex=.*sshd:[ a-zA-Z0-9]+@.*
|
||||
regex=.*dbus-daemon[ ][-session]+[ ].*
|
||||
refresh=30
|
||||
|
|
|
@ -139,18 +139,11 @@ class AmpsList(object):
|
|||
try:
|
||||
# Search in both cmdline and name (for kernel thread, see #1261)
|
||||
for p in processlist:
|
||||
add_it = False
|
||||
if re.search(amp_value.regex(), p['name']) is not None:
|
||||
add_it = True
|
||||
else:
|
||||
if p['cmdline'] is None:
|
||||
# See issue #1689 (thanks to @darylkell)
|
||||
continue
|
||||
for c in p['cmdline']:
|
||||
if re.search(amp_value.regex(), c) is not None:
|
||||
add_it = True
|
||||
break
|
||||
if add_it:
|
||||
if (re.search(amp_value.regex(), p['name']) is not None) or (
|
||||
p['cmdline'] is not None
|
||||
and p['cmdline'] != []
|
||||
and re.search(amp_value.regex(), ' '.join(p['cmdline'])) is not None
|
||||
):
|
||||
ret.append(
|
||||
{'pid': p['pid'], 'cpu_percent': p['cpu_percent'], 'memory_percent': p['memory_percent']}
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue