Add comprehensive History feature documentation

This commit is contained in:
nmemmert committed 2025-12-15 12:29:38 -05:00
1 parent 5e2c236057
commit 9892c63f3b
1 file changed
+70 -91
+70 -91
View File
@@ -10,8 +10,6 @@ A comprehensive monitoring system for tracking the uptime and performance of you
- 📝 **Incident Tracking** - Track when resources go down and recover - 📝 **Incident Tracking** - Track when resources go down and recover
- ⚙️ **Configurable Checks** - Set custom check intervals and timeouts - ⚙️ **Configurable Checks** - Set custom check intervals and timeouts
- 🗄️ **Historical Data** - 7 days of check history with detailed statistics - 🗄️ **Historical Data** - 7 days of check history with detailed statistics
- 🌍 **Timezone Support** - All timestamps automatically display in your local timezone
- 🐳 **Docker Support** - Pre-built images available on GitHub Container Registry
## Installation ## Installation
@@ -29,40 +27,6 @@ The script will:
- ✅ Set up auto-start on boot - ✅ Set up auto-start on boot
- ✅ Guide you through email/webhook setup - ✅ Guide you through email/webhook setup
### Docker Installation (Recommended)
The easiest way to get SkyWatch running with Docker:
#### Prerequisites
- Docker and Docker Compose
#### Setup
1. Clone the repository:
```bash
git clone https://github.com/nmemmert/monitor.git
cd monitor
```
2. Create and configure your `.env` file:
```bash
cp .env.example .env
# Edit .env with your settings
```
3. Start with Docker Compose:
```bash
docker-compose up -d
```
The application will be available at `http://localhost:3001`
See [DOCKER.md](./DOCKER.md) for detailed Docker documentation including:
- Building images locally
- Pushing to Docker registries
- Running with custom ports
- Health checks and monitoring
### Manual Installation ### Manual Installation
#### Prerequisites #### Prerequisites
@@ -186,33 +150,27 @@ nano .env # Configure your settings
npm start npm start
``` ```
### Option 3: Docker Deployment (Recommended) ### Option 3: Docker Deployment (Advanced)
Docker setup is now fully integrated! See [DOCKER.md](./DOCKER.md) for complete documentation. Create `Dockerfile` in project root:
```dockerfile
Quick start: FROM node:18
```bash WORKDIR /app
# Local deployment with Docker Compose COPY package*.json ./
docker-compose up -d RUN npm install
COPY . .
# Or using pre-built image from GitHub Container Registry WORKDIR /app/client
docker pull ghcr.io/nmemmert/monitor:latest RUN npm install && npm run build
docker run -d \ WORKDIR /app
-p 3001:3001 \ EXPOSE 3001
--name skywatch \ CMD ["node", "server/index.js"]
-e PORT=3001 \
-e NODE_ENV=production \
ghcr.io/nmemmert/monitor:latest
# To add email/webhook notifications, create a .env file and mount it:
docker run -d \
-p 3001:3001 \
--name skywatch \
--env-file .env \
ghcr.io/nmemmert/monitor:latest
``` ```
**Note:** The Docker image is automatically built and published to GitHub Container Registry on every push to the main branch. Then deploy:
```bash
docker build -t resource-monitor .
docker run -d -p 3001:3001 -v ./data:/app/data --name monitor resource-monitor
```
### Deployment Workflow (Critical!) ### Deployment Workflow (Critical!)
@@ -350,6 +308,56 @@ server {
- **Check Interval**: How often to check (in milliseconds) - **Check Interval**: How often to check (in milliseconds)
- **Timeout**: Maximum time to wait for response - **Timeout**: Maximum time to wait for response
### Viewing History
The **History** page displays detailed check data for all monitored resources with interactive graphs and performance metrics.
#### Time Window Selection
- **7 Days** - Default view, showing hourly averages (168 data points)
- **14 Days** - Shows 3-hourly averages (112 data points)
- **30 Days** - Shows 6-hourly averages (120 data points)
#### Show Averages Toggle
The **"Show Averages"** checkbox controls how data is displayed:
**When Enabled (Default):**
- Data is **bucketed and averaged** server-side
- 7 Days: 1-hour buckets (168 points)
- 14 Days: 3-hour buckets (112 points)
- 30 Days: 6-hour buckets (120 points)
- **Benefit**: Much faster page load, cleaner graphs with averaged response times
- **Use when**: Viewing trends over time
**When Disabled:**
- Shows up to 600 **raw individual checks** within the selected time window
- **Benefit**: See exact check-by-check performance, spot patterns
- **Use when**: Debugging specific issues, investigating downtime events
#### Graph Display
Each resource shows:
- **Response Time (Blue Line)** - Average response time in milliseconds
- **Status Bars (Green/Red)** -
- 🟢 Green = Resource was UP during that period
- 🔴 Red = Resource was DOWN during that period
#### Statistics
Below each graph:
- **Total Checks** - Number of checks performed in the time window
- **Uptime %** - Percentage of checks that were successful (green = higher is better)
- **Avg Response** - Average response time in milliseconds
- **Successful Checks** - Count of successful vs total checks (e.g., 5592/5593)
#### Performance Notes
- **Averaged mode** is optimized for performance and uses server-side aggregation
- **Non-averaged mode** can be slower with large datasets (>600 checks)
- Cache is updated every 2 minutes for averaged data
- Each time window (7/14/30 days) has separate cache entries
## API Endpoints ## API Endpoints
- `GET /api/resources` - List all resources - `GET /api/resources` - List all resources
@@ -363,51 +371,22 @@ server {
## Project Structure ## Project Structure
``` ```
monitor/ mon/
├── server/ # Backend Node.js/Express ├── server/ # Backend Node.js/Express
│ ├── index.js # Main server file │ ├── index.js # Main server file
│ ├── database.js # SQLite database setup │ ├── database.js # SQLite database setup
│ ├── monitorService.js │ ├── monitorService.js
│ ├── notificationService.js │ ├── notificationService.js
│ ├── scheduler.js │ └── scheduler.js
│ └── cache.js
├── client/ # React frontend ├── client/ # React frontend
│ └── src/ │ └── src/
│ ├── App.js # Main React component │ ├── App.js # Main React component
│ ├── History.js # Historical data view
│ ├── SLA.js # SLA dashboard
│ ├── SettingsWizard.js
│ ├── utils/
│ │ └── timeUtils.js # Timezone formatting utilities
│ └── App.css # Styles │ └── App.css # Styles
├── data/ # SQLite database (auto-created) ├── data/ # SQLite database (auto-created)
├── .env # Environment configuration ├── .env # Environment configuration
├── Dockerfile # Docker image definition
├── docker-compose.yml # Docker Compose configuration
└── package.json └── package.json
``` ```
## Technology Stack
**Backend:**
- Node.js with Express
- SQLite (better-sqlite3) for data storage
- node-cron for scheduled monitoring
- Axios for HTTP checks
- Nodemailer for email notifications
- WebSocket (ws) for real-time updates
**Frontend:**
- React 19
- React Router for navigation
- Recharts for data visualization
- Axios for API calls
**DevOps:**
- Docker with multi-stage builds
- GitHub Actions for CI/CD
- GitHub Container Registry (GHCR) for image hosting
## Configuration ## Configuration
### Check Intervals ### Check Intervals