aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
blob: ba64fa1b9d92918cca77a8cdd5da58485a76207d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Server Monitoring Dashboard

A lightweight monitoring dashboard for servers with JWT authentication and real-time metrics.

## Features

- Real-time system metrics display
- Application performance monitoring
- Service status monitoring
- Secure JWT authentication
- Responsive web interface

## Requirements

- Python 3.6+
- Dependencies:
  - PyJWT
  - (Optional) python-dotenv for .env file support

## Installation

1. Clone this repository
2. Install dependencies:

```bash
pip install PyJWT
pip install python-dotenv  # Optional but recommended
```

## Configuration

You can configure the application using environment variables or by creating a `.env` file in the project root directory.

### Using .env file (recommended)

Create a `.env` file in the project root with the following variables:

```
# Security
JWT_SECRET=your_secret_jwt_key
AUTH_PASSWORD=your_secure_password

# Server Configuration
SERVER_PORT=8000
JWT_EXPIRATION_HOURS=8

# SNMP Configuration
SNMP_HOST=127.0.0.1
SNMP_COMMUNITY=your_snmp_community_string
SNMP_VERSION=2c
SNMP_COLLECTION_INTERVAL=10
```

### Using Environment Variables

Alternatively, you can set the environment variables directly:

```bash
export JWT_SECRET=your_secret_jwt_key
export AUTH_PASSWORD=your_secure_password
export SERVER_PORT=8000
# ... and so on
```

### Security Notes

- **JWT_SECRET**: Should be a random, secure string. You can generate one using:
  ```python
  python -c "import secrets; print(secrets.token_hex(32))"
  ```
- **AUTH_PASSWORD**: Choose a strong password to protect your metrics dashboard
- If no JWT_SECRET is provided, a random one will be generated at startup (not recommended for production)
- If no AUTH_PASSWORD is provided, a random one will be generated and displayed at startup

## Running the Server

```bash
python server.py
```

The server will start and display the URL where you can access the dashboard.

## Accessing the Dashboard

1. Navigate to the server URL in your browser (default: http://localhost:8000)
2. Click "View Server Metrics"
3. Enter the password configured in AUTH_PASSWORD
4. View your real-time metrics

## License

[MIT License](LICENSE)