You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
There's a bug in the script! The total_cache key doesn't exist in your Docker version's memory stats. I'll give you the fixed script. #97
There's a bug in the script! The total_cache key doesn't exist in your Docker version's memory stats. I'll give you the fixed script.
/usr/lib64/nagios/plugins/check_docker.py --containers mariadb101 --memory 70:80:GB Traceback (most recent call last): File "/usr/lib64/nagios/plugins/check_docker.py", line 986, in main [x.result() for x in futures.as_completed(threads)] ^^^^^^^^^^ File "/usr/lib64/python3.12/concurrent/futures/_base.py", line 449, in result return self.__get_result() ^^^^^^^^^^^^^^^^^^^ File "/usr/lib64/python3.12/concurrent/futures/_base.py", line 401, in __get_result raise self._exception File "/usr/lib64/python3.12/concurrent/futures/thread.py", line 59, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib64/nagios/plugins/check_docker.py", line 413, in wrapper func(container, *args, **kwargs) File "/usr/lib64/nagios/plugins/check_docker.py", line 523, in check_memory adjusted_usage = inspection['memory_stats']['usage'] - inspection['memory_stats']['stats']['total_cache'] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^ KeyError: 'total_cache' UNKNOWN: Exception raised during check': KeyError('total_cache') [root@trz-db-slave-g11 plugins]# /usr/lib64/nagios/plugins/check_docker.py --containers mariadb101 --memory 70:80:% Traceback (most recent call last): File "/usr/lib64/nagios/plugins/check_docker.py", line 986, in main [x.result() for x in futures.as_completed(threads)] ^^^^^^^^^^ File "/usr/lib64/python3.12/concurrent/futures/_base.py", line 449, in result return self.__get_result() ^^^^^^^^^^^^^^^^^^^ File "/usr/lib64/python3.12/concurrent/futures/_base.py", line 401, in __get_result raise self._exception File "/usr/lib64/python3.12/concurrent/futures/thread.py", line 59, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib64/nagios/plugins/check_docker.py", line 413, in wrapper func(container, *args, **kwargs) File "/usr/lib64/nagios/plugins/check_docker.py", line 523, in check_memory adjusted_usage = inspection['memory_stats']['usage'] - inspection['memory_stats']['stats']['total_cache'] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^ KeyError: 'total_cache' UNKNOWN: Exception raised during check': KeyError('total_cache')
Activity
kamtec1 commentedon Nov 23, 2025
Fixed Code (Lines 523-525):
Subtracting cache to match what
docker statsdoes.Handle missing total_cache gracefully (some Docker versions don't provide it)
cache = inspection['memory_stats']['stats'].get('total_cache', 0)
adjusted_usage = inspection['memory_stats']['usage'] - cache
martialblog commentedon Jan 26, 2026
Hi thanks, this is a duplicate of #81
It will be fixed with #99