-
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
505 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>TinyStatus History</title> | ||
<style> | ||
body { | ||
font-family: sans-serif; | ||
line-height: 1.6; | ||
color: #333; | ||
max-width: 1200px; | ||
margin: auto; | ||
padding: 20px; | ||
background: #f4f4f4; | ||
} | ||
h1, h2 { | ||
color: #2c3e50; | ||
text-align: center; | ||
} | ||
.history-grid { | ||
display: grid; | ||
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); | ||
gap: 20px; | ||
margin-bottom: 40px; | ||
} | ||
.history-item { | ||
background: #fff; | ||
border-radius: 8px; | ||
padding: 15px; | ||
box-shadow: 0 2px 4px rgba(0,0,0,0.1); | ||
max-height: 300px; | ||
overflow: auto; | ||
} | ||
.history-item h2 { | ||
font-size: 1.2rem; | ||
margin: 0; | ||
} | ||
.history-entry { | ||
margin-bottom: 5px; | ||
font-size: 0.9rem; | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
.status-up { color: #27ae60; } | ||
.status-down { color: #e74c3c; } | ||
.footer { | ||
text-align: center; | ||
font-size: .9em; | ||
color: #7f8c8d; | ||
margin-top: 40px; | ||
} | ||
.footer a { | ||
color: #3498db; | ||
text-decoration: none; | ||
} | ||
.footer a:hover { text-decoration: underline; } | ||
</style> | ||
</head> | ||
<body> | ||
<h1>TinyStatus History</h1> | ||
<div class="history-grid"> | ||
{% for service, entries in history.items() %} | ||
<div class="history-item"> | ||
<h2>{{ service }}</h2> | ||
{% for entry in entries|reverse %} | ||
<div class="history-entry"> | ||
<span>{{ entry.timestamp.split('T')[0] }} {{ entry.timestamp.split('T')[1][:8] }}</span> | ||
<span class="{% if entry.status %}status-up{% else %}status-down{% endif %}"> | ||
{{ 'Up' if entry.status else 'Down' }} | ||
</span> | ||
</div> | ||
{% endfor %} | ||
</div> | ||
{% endfor %} | ||
</div> | ||
<div class="footer"> | ||
<p>Last updated: {{ last_updated }}</p> | ||
<p>Powered by TinyStatus</p> | ||
<p><a href="index.html">Back to Current Status</a></p> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
## 2024-03-15: Scheduled Maintenance | ||
Our database will undergo scheduled maintenance from 02:00 AM to 04:00 AM UTC. | ||
|
||
## 2024-03-10: API Outage | ||
We experienced an API outage from 15:30 to 16:45 UTC. The issue has been resolved. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>TinyStatus</title> | ||
<style> | ||
body { | ||
font-family: sans-serif; | ||
line-height: 1.6; | ||
color: #333; | ||
max-width: 1200px; | ||
margin: 0 auto; | ||
padding: 20px; | ||
background: #f4f4f4; | ||
} | ||
h1, h2 { | ||
color: #2c3e50; | ||
text-align: center; | ||
} | ||
.status-grid { | ||
display: grid; | ||
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); | ||
gap: 15px; | ||
margin-bottom: 40px; | ||
} | ||
.status-item { | ||
background: #fff; | ||
border-radius: 8px; | ||
padding: 15px; | ||
box-shadow: 0 2px 4px rgba(0,0,0,0.1); | ||
text-align: center; | ||
transition: transform .2s; | ||
} | ||
.status-item:hover { | ||
transform: translateY(-5px); | ||
} | ||
.status-item h3 { | ||
margin: 0 0 10px; | ||
} | ||
.status-up { color: #27ae60; } | ||
.status-down { color: #e74c3c; } | ||
.incidents { | ||
background: #fff; | ||
border-radius: 8px; | ||
padding: 20px; | ||
box-shadow: 0 2px 4px rgba(0,0,0,0.1); | ||
margin-bottom: 40px; | ||
} | ||
.footer { | ||
text-align: center; | ||
font-size: .9em; | ||
color: #7f8c8d; | ||
margin-top: 40px; | ||
} | ||
.footer a { | ||
color: #3498db; | ||
text-decoration: none; | ||
} | ||
.footer a:hover { text-decoration: underline; } | ||
</style> | ||
</head> | ||
<body> | ||
<h1>TinyStatus</h1> | ||
<h2>Current Status</h2> | ||
<div class="status-grid"> | ||
{% for check in checks %} | ||
<div class="status-item"> | ||
<h3>{{ check.name }}</h3> | ||
<p class="{% if check.status %}status-up{% else %}status-down{% endif %}"> | ||
{{ 'Operational' if check.status else 'Down' }} | ||
</p> | ||
</div> | ||
{% endfor %} | ||
</div> | ||
<h2>Incident History</h2> | ||
<div class="incidents"> | ||
{{ incidents | safe }} | ||
</div> | ||
<div class="footer"> | ||
<p>Last updated: {{ last_updated }}</p> | ||
<p>Powered by TinyStatus</p> | ||
<p><a href="history.html">View Status History</a></p> | ||
</div> | ||
</body> | ||
</html> |
Oops, something went wrong.