cron
The above commands will install tor, curl, and the mail command and create a simple cron job that will attempt to access http://qrmfuxwgyzk5jdjz.onion/ every 1 minute and email [email protected] if it fails.
mon
To reduce false-positive email alerts, you could use mon to only trigger an alert after multiple consecutive queries fail.
sudo apt-get install tor torsocks mon cat > /usr/lib/mon/mon.d/torsocks_http.monitor <<'EOF' #!/bin/bash ################################################################################ # File: torsocks_http.monitor # Version: 0.1 # Purpose: Wraps the http.monitor script with torsocks to monitor .onion sites # https://tech.michaelaltfield.net/monitoring-tor-onion-websites-uptime-alerts # Authors: Michael Altfield <[email protected]> # Created: 2021-03-12 # Updated: 2021-03-12 ################################################################################ export DIR_PATH=`dirname ${0}` exec /usr/bin/torsocks --isolate ${DIR_PATH}/http.monitor -t 60 "$@" EOF hostgroup torproject_onion qrmfuxwgyzk5jdjz.onion watch torproject_onion service http interval 5m monitor torsocks_http.monitor period alertafter 10 alertevery 1h strict alert mail.alert [email protected] upalert mail.alert [email protected] systemctl restart mon.service Tor2Web
Finally, you can also use Tor2Web to create a clearnet proxy to your .onion site, then point your existing uptime monitoring IaaS tool at it.
Source
The above solutions were originally published in the following article titled Monitoring Tor .onion Websites (uptime alerts)