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 - Display `UID`, `RssAnon`, `RssFile`, `RssShmem` and `cmdline` of the victim in corrective action reports
- Print in terminal with colors - Print in terminal with colors
- Optimize limiting `oom_score_adj`: now it can works without UID=0 - 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-sort`
- Add `oom-trigger` (partially implemented) - Add `oom-trigger` (partially implemented)

21
nohang
View File

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

View File

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