This commit is contained in:
Alexey Avramov 2018-12-11 20:39:14 +09:00
parent 515fbb9490
commit b3f944776f
3 changed files with 25 additions and 27 deletions

View File

@ -191,7 +191,7 @@ Please create [issues](https://github.com/hakavlad/nohang/issues). Use cases, fe
- Display `UID`, `RssAnon`, `RssFile`, `RssShmem` and `cmdline` of the victim in corrective action reports
- Print in terminal with colors
- Optimize limiting `oom_score_adj`: now it can works without UID=0
- Fix GUI warnings: find env without run `ps` and `env` (partially implemented)
- Optimize GUI warnings: find env without run `ps` and `env` (partially implemented)
- Add `oom-sort`
- Add `oom-trigger` (partially implemented)

21
nohang
View File

@ -701,10 +701,10 @@ try:
file_index = status_names.index('RssFile')
shmem_index = status_names.index('RssShmem')
detailed_rss = True
print(detailed_rss, 'detailed_rss')
#print(detailed_rss, 'detailed_rss')
except ValueError:
detailed_rss = False
print('It is not Linux 4.5+')
#print('It is not Linux 4.5+')
##########################################################################
@ -715,7 +715,7 @@ except ValueError:
# directory where the script is running
cd = os.getcwd()
print('CD:', cd)
#print('CD:', cd)
# where to look for a config if not specified via the -c/--config option
default_configs = (cd + '/nohang.conf', '/etc/nohang/nohang.conf')
@ -749,7 +749,8 @@ if arg_config is None:
config = i
break
if config is None:
print('Default configuration was not found\n', conf_err_mess)
print('Default configuration was not found\n',
conf_err_mess)
exit()
else:
@ -757,7 +758,8 @@ else:
if os.path.exists(arg_config):
config = arg_config
else:
print("File {} doesn't exists{}".format(arg_config, conf_err_mess))
print("File {} doesn't exists{}".format(
arg_config, conf_err_mess))
exit()
@ -799,8 +801,8 @@ try:
etc_name = a[0].strip()
etc_command = a[1].strip()
if len(etc_name) > 15:
print(
'Invalid config, the length of the process name must not exceed 15 characters\nExit')
print('Invalid config, the length of the process ' \
'name must not exceed 15 characters\nExit')
exit()
etc_dict[etc_name] = etc_command
@ -1407,9 +1409,8 @@ warn_time_delta = 1000
warn_timer = 0
x = time() - start_time
print(
'The duration of startup:', round(
x * 1000, 1), 'ms')
print('The duration of startup:',
round(x * 1000, 1), 'ms')
print('Monitoring started!')

View File

@ -112,7 +112,7 @@ min_delay_after_sigkill = 3
Valid values are True and False.
Values are case sensitive.
decrease_oom_score_adj = True
decrease_oom_score_adj = False
Valid values are integers from the range [0; 1000].
@ -144,7 +144,9 @@ regex_matching = False
Matching process names with RE patterns
Прблема в том, что если включил регекс, то нельзя выключить ненужный мэтчинг. Можно только установить фактор в единицу.
Прблема в том, что если включил регекс, то нельзя выключить
ненужный мэтчинг. Можно только установить фактор в единицу.
Нужен редизайн раздела.
prefer_regex = foo
@ -158,7 +160,7 @@ prefer_factor = 2
# Need more examples
avoid_regex = foo
avoid_regex = ^(Xorg|sshd)$
Valid values are floating-point numbers from the range [1; 1000].
@ -169,31 +171,26 @@ avoid_factor = 2
# re_match_cmdline = True
prefer_re_cmdline = voo
prefer_re_cmdline = ^/usr/lib/firefox
avoid_re_cmdline = foo
avoid_re_cmdline = ^/usr/lib/virtualbox
prefer_cmd_factor = 20
prefer_cmd_factor = 3
avoid_cmd_factor = 2
avoid_cmd_factor = 3
Matching UIDs with RE patterns
Note that UID=0 итак избегается для убийства.
# re_match_uid = True
prefer_re_uid = ^(0)$
avoid_re_uid=foo
prefer_uid_factor = 200
avoid_uid_factor = 2
prefer_re_uid = ^(1000)$
avoid_re_uid= ^(0|33)$
prefer_uid_factor = 3
avoid_uid_factor = 3
#####################################################################