Show More
@@ -74,10 +74,17 b' def get_storage_size(storage_path):' | |||
|
74 | 74 | return sum(sizes) |
|
75 | 75 | |
|
76 | 76 | |
|
77 | def get_resource(resource_type): | |
|
78 | try: | |
|
79 | return resource.getrlimit(resource_type) | |
|
80 | except Exception: | |
|
81 | return 'NOT_SUPPORTED' | |
|
82 | ||
|
83 | ||
|
77 | 84 | class SysInfoRes(object): |
|
78 |
def __init__(self, value, state= |
|
|
85 | def __init__(self, value, state=None, human_value=None): | |
|
79 | 86 | self.value = value |
|
80 | self.state = state | |
|
87 | self.state = state or STATE_OK_DEFAULT | |
|
81 | 88 | self.human_value = human_value or value |
|
82 | 89 | |
|
83 | 90 | def __json__(self): |
@@ -159,16 +166,16 b' def locale_info():' | |||
|
159 | 166 | |
|
160 | 167 | def ulimit_info(): |
|
161 | 168 | data = collections.OrderedDict([ |
|
162 |
('cpu time (seconds)', resource |
|
|
163 |
('file size', resource |
|
|
164 |
('stack size', resource |
|
|
165 |
('core file size', resource |
|
|
166 |
('address space size', resource |
|
|
167 |
('locked in mem size', resource |
|
|
168 |
('heap size', resource |
|
|
169 |
('rss size', resource |
|
|
170 |
('number of processes', resource |
|
|
171 |
('open files', resource |
|
|
169 | ('cpu time (seconds)', get_resource(resource.RLIMIT_CPU)), | |
|
170 | ('file size', get_resource(resource.RLIMIT_FSIZE)), | |
|
171 | ('stack size', get_resource(resource.RLIMIT_STACK)), | |
|
172 | ('core file size', get_resource(resource.RLIMIT_CORE)), | |
|
173 | ('address space size', get_resource(resource.RLIMIT_AS)), | |
|
174 | ('locked in mem size', get_resource(resource.RLIMIT_MEMLOCK)), | |
|
175 | ('heap size', get_resource(resource.RLIMIT_DATA)), | |
|
176 | ('rss size', get_resource(resource.RLIMIT_RSS)), | |
|
177 | ('number of processes', get_resource(resource.RLIMIT_NPROC)), | |
|
178 | ('open files', get_resource(resource.RLIMIT_NOFILE)), | |
|
172 | 179 | ]) |
|
173 | 180 | |
|
174 | 181 | text = ', '.join('{}:{}'.format(k,v) for k,v in data.items()) |
General Comments 0
You need to be logged in to leave comments.
Login now