Skip to content

Commit b6ed50f

Browse files
committed
Update README
1 parent 2e2b1ea commit b6ed50f

File tree

1 file changed

+0
-216
lines changed

1 file changed

+0
-216
lines changed

src/swf_fastmon_client/README.md

Lines changed: 0 additions & 216 deletions
Original file line numberDiff line numberDiff line change
@@ -16,220 +16,4 @@ The client is designed to receive metadata from the `swf-fastmon-agent` and disp
1616
* It uses ActiveMQ to receive TFs metadata via STOMP protocol.
1717
* Store the metadata in a configurable database backend using Django ORM (SQLite, PostgreSQL, or MySQL).
1818
* Uses Typer for command-line interface.
19-
* Django ORM provides flexibility for database backend selection and future migrations.
2019
* It can be extended to provide a web interface for monitoring
21-
22-
## Installation and Setup
23-
24-
### Dependencies
25-
26-
The client requires the following Python packages:
27-
- `django` - Web framework with ORM for database operations
28-
- `typer` - Command-line interface framework
29-
- `stomp.py` - STOMP protocol client for ActiveMQ
30-
31-
**Database Drivers** (choose based on your backend):
32-
- SQLite: Built-in support (no additional packages needed)
33-
- PostgreSQL: `psycopg2-binary` or `psycopg`
34-
- MySQL: `mysqlclient` or `PyMySQL`
35-
36-
Install core dependencies:
37-
```bash
38-
pip install django typer stomp.py
39-
```
40-
41-
For PostgreSQL support:
42-
```bash
43-
pip install psycopg2-binary
44-
```
45-
46-
For MySQL support:
47-
```bash
48-
pip install mysqlclient
49-
```
50-
51-
### Database Initialization
52-
53-
Before first use, initialize the database. The client now supports multiple database backends:
54-
55-
**SQLite (default):**
56-
```bash
57-
python main.py init-db --db-engine sqlite --db-name /path/to/fastmon.db
58-
```
59-
60-
**PostgreSQL:**
61-
```bash
62-
python main.py init-db --db-engine postgresql --db-name fastmon_db --db-user admin --db-password your_password --db-host localhost
63-
```
64-
65-
**MySQL:**
66-
```bash
67-
python main.py init-db --db-engine mysql --db-name fastmon_db --db-user admin --db-password your_password --db-host localhost
68-
```
69-
70-
## Usage Examples
71-
72-
### Basic Usage
73-
74-
Start the monitoring client with default settings (SQLite):
75-
```bash
76-
python main.py start
77-
```
78-
79-
Start with custom SQLite database:
80-
```bash
81-
python main.py start --db-engine sqlite --db-name /path/to/my_fastmon.db
82-
```
83-
84-
Start with PostgreSQL:
85-
```bash
86-
python main.py start --db-engine postgresql --db-name fastmon_db --db-user admin --db-password your_password
87-
```
88-
89-
### Remote ActiveMQ Connection
90-
91-
Connect to a remote ActiveMQ broker with SSL and PostgreSQL:
92-
```bash
93-
python main.py start \
94-
--db-engine postgresql \
95-
--db-name fastmon_db \
96-
--db-user db_admin \
97-
--db-password db_password \
98-
--host pandaserver02.sdcc.bnl.gov \
99-
--port 61612 \
100-
--ssl \
101-
--ca-certs /path/to/ca-certificates.pem \
102-
--user your_username \
103-
--password your_password
104-
```
105-
106-
### Monitoring Status
107-
108-
Check overall monitoring status (SQLite default):
109-
```bash
110-
python main.py status
111-
```
112-
113-
View details for a specific run:
114-
```bash
115-
python main.py status --run 12345
116-
```
117-
118-
Check status with custom database backend:
119-
```bash
120-
python main.py status --db-engine postgresql --db-name fastmon_db --db-user admin --db-password password --run 12345
121-
```
122-
123-
Check status with SQLite database:
124-
```bash
125-
python main.py status --db-engine sqlite --db-name /path/to/fastmon.db --run 12345
126-
```
127-
128-
### Advanced Configuration
129-
130-
Start with verbose logging and custom topic:
131-
```bash
132-
python main.py start \
133-
--verbose \
134-
--topic epic.fastmon.tf.custom \
135-
--host localhost \
136-
--port 61613
137-
```
138-
139-
### Command Reference
140-
141-
#### `start` - Launch monitoring client
142-
- `--config, -c`: Configuration file path (future feature)
143-
- `--db-engine`: Database engine (sqlite, postgresql, mysql) (default: `sqlite`)
144-
- `--db-name`: Database name or SQLite file path (default: `fastmon_client.db`)
145-
- `--db-host`: Database host (default: `localhost`)
146-
- `--db-port`: Database port (default: auto-detected)
147-
- `--db-user`: Database username
148-
- `--db-password`: Database password
149-
- `--host`: ActiveMQ host (default: `localhost`)
150-
- `--port`: ActiveMQ port (default: `61613`)
151-
- `--topic`: ActiveMQ topic for TF metadata (default: `epic.fastmon.tf`)
152-
- `--user`: ActiveMQ username (default: `admin`)
153-
- `--password`: ActiveMQ password (default: `admin`)
154-
- `--ssl`: Use SSL connection
155-
- `--ca-certs`: Path to CA certificates file
156-
- `--verbose, -v`: Enable verbose logging
157-
158-
#### `status` - Display statistics
159-
- `--db-engine`: Database engine (sqlite, postgresql, mysql) (default: `sqlite`)
160-
- `--db-name`: Database name or SQLite file path (default: `fastmon_client.db`)
161-
- `--db-host`: Database host (default: `localhost`)
162-
- `--db-port`: Database port (default: auto-detected)
163-
- `--db-user`: Database username
164-
- `--db-password`: Database password
165-
- `--run`: Specific run number to show details
166-
167-
#### `init-db` - Initialize database
168-
- `--db-engine`: Database engine (sqlite, postgresql, mysql) (default: `sqlite`)
169-
- `--db-name`: Database name or SQLite file path (default: `fastmon_client.db`)
170-
- `--db-host`: Database host (default: `localhost`)
171-
- `--db-port`: Database port (default: auto-detected)
172-
- `--db-user`: Database username
173-
- `--db-password`: Database password
174-
175-
## Database Schema
176-
177-
The client uses Django ORM models to manage database schema across different backends. Two main tables are created:
178-
179-
### `tf_metadata`
180-
Django model: `TfMetadata`
181-
Stores Time Frame metadata received from ActiveMQ:
182-
- `id`: Auto-incrementing primary key
183-
- `file_id`: Unique identifier for the TF file (unique constraint)
184-
- `run_number`: Run number associated with the TF
185-
- `tf_number`: Time Frame number within the run
186-
- `file_url`: URL/path to the TF file
187-
- `file_size_bytes`: Size of the TF file in bytes
188-
- `checksum`: File checksum for integrity verification
189-
- `status`: Processing status of the TF
190-
- `created_at`: Timestamp when TF was created
191-
- `received_at`: Timestamp when message was received by client (auto-generated)
192-
- `metadata_json`: Full JSON metadata from ActiveMQ message
193-
194-
**Indexes:**
195-
- `run_number` - for efficient run-based queries
196-
- `created_at` - for time-based queries
197-
198-
### `runs`
199-
Django model: `Run`
200-
Stores run-level information and statistics:
201-
- `run_number`: Unique run identifier (primary key)
202-
- `start_time`: When the run started
203-
- `end_time`: When the run ended (if applicable)
204-
- `total_tfs`: Total number of TFs received for this run (auto-calculated)
205-
- `run_conditions`: Text field for run configuration/conditions
206-
207-
**Database Backend Compatibility:**
208-
The Django ORM automatically handles SQL dialect differences between SQLite, PostgreSQL, and MySQL, ensuring consistent behavior across all supported database backends.
209-
210-
## Configuration
211-
212-
The client supports both command-line arguments and configuration files (future feature). ActiveMQ connection parameters can be customized for different deployment environments.
213-
214-
### Security Considerations
215-
216-
- Use SSL connections for production deployments
217-
- Store credentials securely (avoid command-line passwords in production)
218-
- Consider using certificate-based authentication for ActiveMQ
219-
- Database files should have appropriate file permissions
220-
- For PostgreSQL/MySQL: Use dedicated database users with minimal required privileges
221-
- Consider using environment variables or configuration files for sensitive database credentials
222-
223-
## Future Enhancements
224-
225-
- Configuration file support for easier deployment
226-
- Web interface for monitoring visualization using Django views
227-
- Real-time dashboard with statistics and charts
228-
- Integration with existing monitoring systems
229-
- Export capabilities for monitoring data (CSV, JSON)
230-
- Database migration support for schema evolution
231-
- Connection pooling for improved database performance
232-
- Automated database backup and recovery tools
233-
234-
235-

0 commit comments

Comments
 (0)