iac/ansible/roles/crawler_alert/tasks/main.yaml
Sergei Poljanski bc0dac9188
Some checks failed
deploy / ansible (push) Failing after 1m17s
crawler_alert, monitoring: AI crawler metrics and dashboards
crawler-alert.py --metrics (5-minute timer) reads what the Traefik
access log gained since the last run, judges every request that names
an AI bot exactly like the weekly report (vendor IP ranges, forward-
confirmed rDNS, Meta's ASN) and writes cumulative counters to the
node_exporter textfile directory. Verdicts are cached per bot and IP
for a week, so DNS only sees new addresses; range files are refetched
once a day. It covers every router, while the mails keep watching
Forgejo only.

New dashboard "AI crawlers", and a row of it on the overview.

The overview's load gauge divided node_load1 by a count with fewer
labels, which matches nothing; aggregate both sides by host.

Assisted-by: Claude:opus-5-5
2026-11-13 07:21:57 +04:00

40 lines
925 B
YAML

---
- name: Install crawler-alert script
ansible.builtin.copy:
src: crawler-alert.py
dest: /usr/local/bin/crawler-alert.py
mode: "0755"
- name: Configure crawler-alert
ansible.builtin.template:
src: crawler-alert.env.j2
dest: /etc/crawler-alert.env
mode: "0600"
diff: false
- name: Install crawler-alert units
ansible.builtin.copy:
src: "{{ item }}"
dest: "/etc/systemd/system/{{ item }}"
mode: "0644"
loop:
- crawler-alert.service
- crawler-alert.timer
- crawler-weekly.service
- crawler-weekly.timer
- crawler-metrics.service
- crawler-metrics.timer
notify: Reload systemd
- name: Flush handlers
ansible.builtin.meta: flush_handlers
- name: Enable crawler-alert timers
ansible.builtin.systemd:
name: "{{ item }}"
enabled: true
state: started
loop:
- crawler-alert.timer
- crawler-weekly.timer
- crawler-metrics.timer