diff --git a/checks.d/mongo.py b/checks.d/mongo.py index 459a962777..0f89581668 100644 --- a/checks.d/mongo.py +++ b/checks.d/mongo.py @@ -639,12 +639,20 @@ def total_seconds(td): message=message) raise Exception(message) - self.service_check( - self.SERVICE_CHECK_NAME, - AgentCheck.OK, - tags=service_check_tags) + try: + status = db.command('serverStatus', tcmalloc=collect_tcmalloc_metrics) + except Exception: + self.service_check( + self.SERVICE_CHECK_NAME, + AgentCheck.CRITICAL, + tags=service_check_tags) + raise + else: + self.service_check( + self.SERVICE_CHECK_NAME, + AgentCheck.OK, + tags=service_check_tags) - status = db.command('serverStatus', tcmalloc=collect_tcmalloc_metrics) if status['ok'] == 0: raise Exception(status['errmsg'].__str__())