-
Notifications
You must be signed in to change notification settings - Fork 66
Description
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')