snapshot of https://github.com/zulip/zulip.git @ 48c69911c7dd4e03b20552eb3bd77ad8151c1357 (2026-09-15)
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
This commit is contained in:
78
scripts/nagios/check-rabbitmq-consumers
Executable file
78
scripts/nagios/check-rabbitmq-consumers
Executable file
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
from collections import defaultdict
|
||||
|
||||
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
sys.path.append(ZULIP_PATH)
|
||||
from scripts.lib.check_rabbitmq_queue import normal_queues
|
||||
from scripts.lib.zulip_tools import (
|
||||
atomic_nagios_write,
|
||||
get_config,
|
||||
get_config_file,
|
||||
get_tornado_ports,
|
||||
)
|
||||
|
||||
if "USER" in os.environ and os.environ["USER"] not in ["root", "rabbitmq"]:
|
||||
print("This script must be run as the root or rabbitmq user")
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.parse_args()
|
||||
|
||||
config_file = get_config_file()
|
||||
TORNADO_PROCESSES = len(get_tornado_ports(config_file))
|
||||
|
||||
output = subprocess.check_output(["/usr/sbin/rabbitmqctl", "list_consumers"], text=True)
|
||||
|
||||
consumers: dict[str, int] = defaultdict(int)
|
||||
|
||||
queues = {
|
||||
*normal_queues,
|
||||
# All tornado queues get grouped into this, even if sharded
|
||||
"notify_tornado",
|
||||
}
|
||||
|
||||
for queue_name in queues:
|
||||
queue_name = queue_name.strip()
|
||||
consumers[queue_name] = 0
|
||||
|
||||
for line in output.split("\n"):
|
||||
parts = line.split("\t")
|
||||
if len(parts) >= 2:
|
||||
queue_name = parts[0]
|
||||
if queue_name.startswith("notify_tornado_"):
|
||||
queue_name = "notify_tornado"
|
||||
|
||||
# Collapse sharded queues into a single queue for this check.
|
||||
queue_name = re.sub(r"_shard(\d+)", "", queue_name)
|
||||
consumers[queue_name] += 1
|
||||
|
||||
now = int(time.time())
|
||||
|
||||
for queue_name, count in consumers.items():
|
||||
target_count = 1
|
||||
if queue_name == "notify_tornado":
|
||||
target_count = TORNADO_PROCESSES
|
||||
elif queue_name == "missedmessage_mobile_notifications":
|
||||
target_count = int(
|
||||
get_config(config_file, "application_server", "mobile_notification_shards", "1")
|
||||
)
|
||||
elif queue_name == "user_activity":
|
||||
target_count = int(
|
||||
get_config(config_file, "application_server", "user_activity_shards", "1")
|
||||
)
|
||||
else:
|
||||
target_count = int(
|
||||
get_config(config_file, "application_server", f"{queue_name}_workers", "1")
|
||||
)
|
||||
|
||||
atomic_nagios_write(
|
||||
"check-rabbitmq-consumers-" + queue_name,
|
||||
"critical" if count < target_count else "ok",
|
||||
f"queue {queue_name} has {count} consumers, needs {target_count}",
|
||||
)
|
||||
12
scripts/nagios/check-rabbitmq-queue
Executable file
12
scripts/nagios/check-rabbitmq-queue
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
sys.path.append(ZULIP_PATH)
|
||||
|
||||
from scripts.lib.check_rabbitmq_queue import check_rabbitmq_queues
|
||||
|
||||
if __name__ == "__main__":
|
||||
check_rabbitmq_queues()
|
||||
Reference in New Issue
Block a user