Techtix Monitor Agent
=====================

A lightweight PHP monitoring agent for ordinary shared hosting. No
Node.js, Docker, Composer, shell daemons or root access required - just
PHP 8.1+ with the cURL extension, and a cron job.

INSTALL
-------

1. Upload this whole folder to your hosting account (anywhere outside
   the public web root is best; if it must be inside, the included
   .htaccess blocks direct access to config.php).

2. In Techtix Support, go to Monitoring > Agents > Add Agent (or use a
   registration token if one was given to you) to get:
     - an Agent Key
     - an Agent Secret (shown once - copy it now)
     - the API Base URL

3. Copy config.sample.php to config.php and fill in those three values.

4. Add a cron job. Prefer CLI if your host offers it:

     php /home/youruser/monitor-agent/run.php

   If your host only offers URL-based cron, set TTX_RUN_TOKEN in
   config.php to a long random value, then use:

     https://youraccount.example.com/monitor-agent/run.php?token=YOUR_RUN_TOKEN

   Every 5 minutes is a sensible starting interval.

5. After the cron job has run at least once, the agent should show as
   "Online" on its page in Techtix Support > Monitoring > Agents.

SECURITY NOTES
--------------

- config.php contains your agent secret. Never commit it, email it, or
  put it somewhere web-readable without the .htaccess protection above.
- The agent secret can be rotated or revoked at any time from
  Techtix Support > Monitoring > Agents, without needing to redeploy
  this folder (just update config.php with the new secret afterwards).
- All requests to Techtix are made over HTTPS with a signed,
  timestamped request - a copy of a past request cannot be replayed.

TROUBLESHOOTING
----------------

- "config.php not found" - you forgot step 3 above.
- "[FAIL] Authentication failed." - check the Agent Key/Secret were
  copied exactly (no extra whitespace), and that the agent hasn't been
  disabled or had its secret rotated since.
- Agent shows "Delayed" or "Offline" - check your cron job is actually
  running (most hosting control panels show a cron execution log).
