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