diff --git a/.env b/.env new file mode 100644 index 0000000..45d50ff --- /dev/null +++ b/.env @@ -0,0 +1,17 @@ +# TinyStatus Configuration + +# Check interval in seconds +CHECK_INTERVAL=30 + +# Maximum number of history entries per service +MAX_HISTORY_ENTRIES=100 + +# Logging level (INFO, WARNING, ERROR, DEBUG) +LOG_LEVEL=INFO + +# File paths +CHECKS_FILE=checks.yaml +INCIDENTS_FILE=incidents.md +TEMPLATE_FILE=index.html.theme +HISTORY_TEMPLATE_FILE=history.html.theme +STATUS_HISTORY_FILE=history.json diff --git a/README.md b/README.md new file mode 100644 index 0000000..187336b --- /dev/null +++ b/README.md @@ -0,0 +1,98 @@ +# TinyStatus + +TinyStatus is a simple, customizable status page generator that allows you to monitor the status of various services and display them on a clean, responsive web page. + +## Features + +- Monitor HTTP endpoints, ping hosts, and check open ports +- Responsive design for both status page and history page +- Customizable service checks via YAML configuration +- Incident history tracking +- Automatic status updates at configurable intervals + +## Prerequisites + +- Python 3.7 or higher +- pip (Python package manager) + +## Installation + +1. Clone the repository or download the source code: + ``` + git clone https://github.com/yourusername/tinystatus.git + cd tinystatus + ``` + +2. Install the required dependencies: + ``` + pip install pyyaml aiohttp markdown jinja2 + ``` + +## Configuration + +1. Create a `.env` file in the project root and customize the variables: + ``` + CHECK_INTERVAL=30 + MAX_HISTORY_ENTRIES=100 + LOG_LEVEL=INFO + CHECKS_FILE=checks.yaml + INCIDENTS_FILE=incidents.md + TEMPLATE_FILE=index.html.theme + HISTORY_TEMPLATE_FILE=history.html.theme + STATUS_HISTORY_FILE=history.json + ``` + +2. Edit the `checks.yaml` file to add or modify the services you want to monitor. Example: + ```yaml + - name: GitHub Home + type: http + host: https://github.com + expected_code: 200 + + - name: Google DNS + type: ping + host: 8.8.8.8 + + - name: Database + type: port + host: db.example.com + port: 5432 + ``` + +3. (Optional) Customize the `incidents.md` file to add any known incidents or maintenance schedules. + +4. (Optional) Modify the `index.html.theme` and `history.html.theme` files to customize the look and feel of your status pages. + +## Usage + +1. Run the TinyStatus script: + ``` + python tinystatus.py + ``` + +2. The script will generate two HTML files: + - `index.html`: The main status page + - `history.html`: The status history page + +3. To keep the status page continuously updated, you can run the script in the background: + - On Unix-like systems (Linux, macOS): + ``` + nohup python tinystatus.py & + ``` + - On Windows, you can use the Task Scheduler to run the script at startup. + +4. Serve the generated HTML files using your preferred web server (e.g., Apache, Nginx, or a simple Python HTTP server for testing). + +## Customization + +- Adjust the configuration variables in the `.env` file to customize the behavior of TinyStatus. +- Customize the appearance of the status page by editing the CSS in `index.html.theme` and `history.html.theme`. +- Add or remove services by modifying the `checks.yaml` file. + +## Contributing + +Contributions are welcome! Please feel free to submit a Pull Request. + +## License + +This project is open source and available under the [MIT License](LICENSE). \ No newline at end of file diff --git a/checks.yaml b/checks.yaml new file mode 100644 index 0000000..d5492c1 --- /dev/null +++ b/checks.yaml @@ -0,0 +1,76 @@ +- name: GitHub Home + type: http + host: https://github.com + expected_code: 200 + +- name: GitHub API + type: http + host: https://api.github.com + expected_code: 200 + +- name: Wikipedia Home + type: http + host: https://www.wikipedia.org + expected_code: 200 + +- name: Wikipedia API + type: http + host: https://en.wikipedia.org/w/api.php + expected_code: 200 + +- name: DigitalOcean + type: http + host: https://www.digitalocean.com + expected_code: 200 + +- name: DigitalOcean API + type: http + host: https://api.digitalocean.com + expected_code: 200 + +- name: Google Home + type: http + host: https://www.google.com + expected_code: 200 + +- name: Cloudflare DNS Checker + type: ping + host: 1.1.1.1 + +- name: Google Public DNS + type: ping + host: 8.8.8.8 + +- name: Dummy Postgres Database + type: port + host: ec2-54-173-89-248.compute-1.amazonaws.com + port: 5432 + +- name: Dummy MySQL Database + type: port + host: db.example.com + port: 3306 + +- name: Amazon Web Services + type: http + host: https://aws.amazon.com + expected_code: 200 + +- name: AWS S3 API + type: http + host: https://s3.amazonaws.com + expected_code: 200 + +- name: Twitter + type: http + host: https://twitter.com + expected_code: 200 + +- name: Facebook Home + type: http + host: https://www.facebook.com + expected_code: 200 + +- name: Localhost + type: ping + host: localhost diff --git a/history.html.theme b/history.html.theme new file mode 100644 index 0000000..650da58 --- /dev/null +++ b/history.html.theme @@ -0,0 +1,83 @@ + + +
+ + ++ {{ 'Operational' if check.status else 'Down' }} +
+