Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checks fail with Podman #85

Open
Virsacer opened this issue Feb 11, 2022 · 0 comments
Open

Checks fail with Podman #85

Virsacer opened this issue Feb 11, 2022 · 0 comments

Comments

@Virsacer
Copy link

When using Podman the ckecks fail:

root@host:~# /usr/lib64/nagios/plugins/check_docker.py --cpu 80:90
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/nagios/plugins/check_docker.py", line 986, in <listcomp>
    [x.result() for x in futures.as_completed(threads)]
  File "/usr/lib64/python3.6/concurrent/futures/_base.py", line 425, in result
    return self.__get_result()
  File "/usr/lib64/python3.6/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/usr/lib64/python3.6/concurrent/futures/thread.py", line 56, 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 689, in check_cpu
    usage = calculate_cpu_capacity_precentage(info=info, stats=stats)
  File "/usr/lib64/nagios/plugins/check_docker.py", line 676, in calculate_cpu_capacity_precentage
    system_delta = stats['cpu_stats']['system_cpu_usage'] - stats['precpu_stats']['system_cpu_usage']
KeyError: 'system_cpu_usage'
UNKNOWN: Exception raised during check': KeyError('system_cpu_usage',)


root@host:~# /usr/lib64/nagios/plugins/check_docker.py --memory 80:90:%
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/nagios/plugins/check_docker.py", line 986, in <listcomp>
    [x.result() for x in futures.as_completed(threads)]
  File "/usr/lib64/python3.6/concurrent/futures/_base.py", line 425, in result
    return self.__get_result()
  File "/usr/lib64/python3.6/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/usr/lib64/python3.6/concurrent/futures/thread.py", line 56, 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: 'stats'
UNKNOWN: Exception raised during check': KeyError('stats',)

I was able to workaround with this:

root@host:~# diff /usr/lib64/nagios/plugins/check_docker_old /usr/lib64/nagios/plugins/check_docker.py
522a523
>     if "stats" not in inspection['memory_stats'].keys(): inspection['memory_stats']['stats'] = {'total_cache': 0};
675a677
>     if "system_cpu_usage" not in stats['precpu_stats'].keys(): stats['precpu_stats']['system_cpu_usage'] = 0;
root@host:~#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant