diff --git a/gunicorn/datadog_checks/gunicorn/gunicorn.py b/gunicorn/datadog_checks/gunicorn/gunicorn.py index 29ebb2002bc30..60df3fb07fcf6 100644 --- a/gunicorn/datadog_checks/gunicorn/gunicorn.py +++ b/gunicorn/datadog_checks/gunicorn/gunicorn.py @@ -149,7 +149,7 @@ def _get_master_proc_by_name(self, name): master_procs = [] for p in psutil.process_iter(): try: - if p.cmdline()[0] == master_name: + if len(p.cmdline()) > 0 and p.cmdline()[0] == master_name: master_procs.append(p) except (IndexError, psutil.Error) as e: self.log.debug("Cannot read information from process %s: %s", p.name(), e, exc_info=True)