Show More
@@ -32,8 +32,8 b" STATE_OK_DEFAULT = {'message': '', 'type" | |||||
32 | def percentage(part, whole): |
|
32 | def percentage(part, whole): | |
33 | whole = float(whole) |
|
33 | whole = float(whole) | |
34 | if whole > 0: |
|
34 | if whole > 0: | |
35 | return 100 * float(part) / whole |
|
35 | return round(100 * float(part) / whole, 1) | |
36 | return 0 |
|
36 | return 0.0 | |
37 |
|
37 | |||
38 |
|
38 | |||
39 | def get_storage_size(storage_path): |
|
39 | def get_storage_size(storage_path): | |
@@ -260,8 +260,7 b' def storage_inodes():' | |||||
260 | value['used'] = i_stat.f_ffree |
|
260 | value['used'] = i_stat.f_ffree | |
261 | value['free'] = i_stat.f_favail |
|
261 | value['free'] = i_stat.f_favail | |
262 | value['total'] = i_stat.f_files |
|
262 | value['total'] = i_stat.f_files | |
263 | value['percent'] = percentage( |
|
263 | value['percent'] = percentage(value['used'], value['total']) | |
264 | value['used'], value['total']) |
|
|||
265 | except Exception as e: |
|
264 | except Exception as e: | |
266 | log.exception('Failed to fetch disk inodes info') |
|
265 | log.exception('Failed to fetch disk inodes info') | |
267 | state = {'message': str(e), 'type': STATE_ERR} |
|
266 | state = {'message': str(e), 'type': STATE_ERR} | |
@@ -278,7 +277,7 b' def storage_inodes():' | |||||
278 | msg = 'Warning: your disk free inodes are running low.' |
|
277 | msg = 'Warning: your disk free inodes are running low.' | |
279 | state = {'message': msg, 'type': STATE_WARN} |
|
278 | state = {'message': msg, 'type': STATE_WARN} | |
280 |
|
279 | |||
281 | return SysInfoRes(value=value, state=state) |
|
280 | return SysInfoRes(value=value, state=state, human_value=human_value) | |
282 |
|
281 | |||
283 |
|
282 | |||
284 | def storage_archives(): |
|
283 | def storage_archives(): |
General Comments 0
You need to be logged in to leave comments.
Login now