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