Инструменты пользователя

Инструменты сайта


tasks:webmon

Различия

Показаны различия между двумя версиями страницы.

Ссылка на это сравнение

Предыдущая версия справа и слеваПредыдущая версия
Следующая версия
Предыдущая версия
tasks:webmon [18.10.2022 08:19] – [changedetection.io] viacheslavtasks:webmon [13.02.2025 06:03] (текущий) – [Расписание, API] viacheslav
Строка 1: Строка 1:
 +====== Мониторинг изменений веб-страниц ======
 +
 +===== changedetection.io =====
 +<code bash>
 +git clone https://github.com/dgtlmoon/changedetection.io.git
 +cd changedetection.io
 +</code>
 +
 +Примерный файл docker-compose.yml (Chrome [[https://github.com/dgtlmoon/changedetection.io/wiki/Fetching-pages-with-WebDriver|нужен для динамических страниц]]).\\
 +Playwright-chrome отличается от browser-chrome тем, что умеет выделять части страниц для отслеживания, поэтому лучше (наверное) использовать его.
 +<file yaml docker-compose.yml>
 +version: '3.7'
 +services:
 +  changedetection:
 +    image: ghcr.io/dgtlmoon/changedetection.io
 +    container_name: changedetection
 +    hostname: changedetection
 +    restart: unless-stopped
 +    environment:
 +      PORT: 5000
 +      PUID: 1000
 +      PGID: 1000
 +      PLAYWRIGHT_DRIVER_URL: "ws://changedetection-chrome:3000/?stealth=1&--disable-web-security=true"
 +      BASE_URL: "https://bva.dyndns.info/cdt"
 +      USE_X_SETTINGS: 1
 +    volumes:
 +      - changedetection:/datastore
 +    labels:
 +      - "traefik.enable=true"
 +      - "traefik.http.routers.changedetection.rule=Host(`bva.dyndns.info`) && PathPrefix(`/cdt`)"
 +      - "traefik.http.routers.changedetection.middlewares=cdt-strip,cdt-path"
 +      - "traefik.http.middlewares.cdt-strip.stripprefix.prefixes=/cdt"
 +      - "traefik.http.middlewares.cdt-path.headers.customrequestheaders.X-Forwarded-Prefix=/cdt"
 +      - "traefik.http.routers.changedetection.tls.certresolver=le"
 +
 +  changedetection-chrome:
 +    image: browserless/chrome
 +    container_name: changedetection-chrome
 +    hostname: changedetection-chrome
 +    restart: unless-stopped
 +    environment:
 +      SCREEN_WIDTH: 1920
 +      SCREEN_HEIGHT: 1080
 +      SCREEN_DEPTH: 16
 +      ENABLE_DEBUGGER: "false"
 +      PREBOOT_CHROME: "true"
 +      CONNECTION_TIMEOUT: 300000
 +      MAX_CONCURRENT_SESSIONS: 10
 +      CHROME_REFRESH_TIME: 600000
 +      DEFAULT_BLOCK_ADS: "true"
 +      DEFAULT_STEALTH: "true"
 +
 +volumes:
 +  changedetection:
 +</file>
 +Стандартный docker-compose.yml: https://github.com/dgtlmoon/changedetection.io/blob/master/docker-compose.yml
 +
 +Запуск:
 +<code bash>
 +docker-compose up -d
 +</code>
 +==== Уведомления ====
 +<code bash>
 +# Yandex
 +mailtos://user:password@yandex.ru/?smtp=smtp.yandex.ru&port=465&mode=ssl&to=user@example.com
 +# Внутренний открытый релей
 +mailto://mail.example.com/?from=changedetection@example.com&to=user1@example.com,user2@example.com
 +</code>
 +https://github.com/caronc/apprise/wiki/Notify_email
 +
 +Notification body нужно оформлять в зависимости от выбранного формата, например, для HTML использовать тэги ''<p></p>'' и т. д.
 +==== Расписание, API ====
 +[[https://github.com/dgtlmoon/changedetection.io/issues/1695|[feature] cron or exact time scheduler / or trigger check via webhook #1695]]
 +<code bash>
 +# Выключить/включить оповещение (на почту и т. п.)
 +curl "http://monitoring:5000/api/v1/watch/7a0f144f-76b9-448b-94f1-9011027e661e?muted=muted" -H "x-api-key:813031b16330fe25e3780cf0325daa45"
 +curl "http://monitoring:5000/api/v1/watch/7a0f144f-76b9-448b-94f1-9011027e661e?muted=unmuted" -H "x-api-key:813031b16330fe25e3780cf0325daa45"
 +</code>
 +https://changedetection.io/docs/api_v1/index.html#api-Watch-Watch
 +
 +Выключить оповещения для всех (нужен установленный jq)
 +<file bash mute.sh>
 +url='http://monitoring:5000/api/v1/watch'
 +apikey='813031b16330fe25e3780cf0325daa45'
 +
 +for i in `curl "${url}" -H "x-api-key:${apikey}" |jq keys |sed -E 's#(\"|\[|\]|,|\s)##g'`
 +do
 +  curl "${url}/${i}?muted=muted" -H "x-api-key:${apikey}"
 +done
 +</file>
 +
 +
 +==== Реверс-прокси ====
 +
 +https://github.com/dgtlmoon/changedetection.io/wiki/Running-changedetection.io-behind-a-reverse-proxy
 +
 +===== Другие варианты =====
 +Скрипт: https://bhfsteve.blogspot.com/2013/03/monitoring-web-page-for-changes-using.html\\
 +Мощный комбайн: https://github.com/huginn/huginn\\
 +https://github.com/SR-G/watchthatpage\\
 +https://github.com/thp/urlwatch\\
 +https://followthatpage.com/
  

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki