Skip to content

Commit 9b9db0e

Browse files
committed
Combine nginx log monitors to avoid overwhelming parallel file reads
1 parent 652b10b commit 9b9db0e

File tree

1 file changed

+2
-30
lines changed

1 file changed

+2
-30
lines changed

scripts/monitoring/monitor.py

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ def log_workers_cur_fn():
3535

3636
@limit_server(["ol-www0", "ol-covers0"], scheduler)
3737
@scheduler.scheduled_job('interval', seconds=60)
38-
def log_recent_bot_traffic():
39-
"""Logs the state of the gunicorn workers."""
38+
def monitor_nginx_logs():
39+
"""Logs recent bot traffic, HTTP statuses, and top IP counts."""
4040
match SERVER:
4141
case "ol-www0":
4242
bucket = "ol"
@@ -49,38 +49,10 @@ def log_recent_bot_traffic():
4949
f"log_recent_bot_traffic stats.{bucket}.bot_traffic",
5050
sources=["../obfi.sh", "utils.sh"],
5151
)
52-
53-
54-
@limit_server(["ol-www0", "ol-covers0"], scheduler)
55-
@scheduler.scheduled_job('interval', seconds=60)
56-
def log_recent_http_statuses():
57-
"""Logs the recent HTTP statuses."""
58-
match SERVER:
59-
case "ol-www0":
60-
bucket = "ol"
61-
case "ol-covers0":
62-
bucket = "ol-covers"
63-
case _:
64-
raise ValueError(f"Unknown server: {SERVER}")
65-
6652
bash_run(
6753
f"log_recent_http_statuses stats.{bucket}.http_status",
6854
sources=["../obfi.sh", "utils.sh"],
6955
)
70-
71-
72-
@limit_server(["ol-www0", "ol-covers0"], scheduler)
73-
@scheduler.scheduled_job('interval', seconds=60)
74-
def log_top_ip_counts():
75-
"""Logs the recent HTTP statuses."""
76-
match SERVER:
77-
case "ol-www0":
78-
bucket = "ol"
79-
case "ol-covers0":
80-
bucket = "ol-covers"
81-
case _:
82-
raise ValueError(f"Unknown server: {SERVER}")
83-
8456
bash_run(
8557
f"log_top_ip_counts stats.{bucket}.top_ips",
8658
sources=["../obfi.sh", "utils.sh"],

0 commit comments

Comments
 (0)