A lightweight Network Monitoring System built with Java Vert.x, Go, and PostgreSQL, designed for monitoring SSH devices with comprehensive metrics collection.
- HTTP Server: Java Vert.x with JWT authentication and comprehensive security features
- Device Monitoring: SSH device support with CPU, Memory, Disk, and Network metrics
- Configurable Polling: Timer-based metrics collection with configurable intervals
- Database Storage: PostgreSQL for storing device information and metrics
- REST APIs: Complete API for credential management, device discovery, and monitoring
- Security: JWT authentication, rate limiting, CORS, and security headers
- Backend: Java 17 + Vert.x 4.4.6
- Database: PostgreSQL 13+
- Polling Engine: Go (to be implemented)
- Authentication: JWT with RS256/HS256
- Build Tool: Maven 3.8+
- Java 17 or higher
- Maven 3.8 or higher
- PostgreSQL 13 or higher (optional - application can run without database)
- Go 1.19 or higher (for polling engine - future implementation)
-
Setup PostgreSQL Database:
# Create database and user sudo -u postgres psql CREATE DATABASE nms_lite; CREATE USER nms_user WITH PASSWORD 'nms_password'; GRANT ALL PRIVILEGES ON DATABASE nms_lite TO nms_user; \q # Initialize schema psql -U nms_user -d nms_lite -f database/init/schema.sql
-
Build and Run:
cd backend mvn clean package -DskipTests java -jar target/nms-lite-backend-1.0.0.jar
The application can run without a database connection for development purposes:
-
Build and Run:
cd backend mvn clean package -DskipTests java -jar target/nms-lite-backend-1.0.0.jar -
Verify Application is Running:
# Test health endpoint curl http://localhost:8080/health # Test readiness endpoint curl http://localhost:8080/ready # Test liveness endpoint curl http://localhost:8080/live
Common Issues and Solutions:
-
"Main method not found" error:
- This has been fixed in the current version
- Make sure you're using the latest code
-
SLF4J/Logback errors:
- These have been resolved by adding proper dependencies
- Rebuild the project:
mvn clean package -DskipTests
-
Netty dependency errors:
- Fixed by removing unnecessary exclusions from Maven shade plugin
- Rebuild the project:
mvn clean package -DskipTests
-
Database SSL errors:
- Fixed by setting SSL to false in configuration
- Check
application.ymlfordatabase.ssl: false
-
SCRAM authentication errors:
- Fixed by adding SCRAM dependency
- Rebuild the project:
mvn clean package -DskipTests
Expected Output:
2025-10-07 14:50:44.685 [main] INFO [] com.nms.Main - Starting NMS Lite Backend Application...
2025-10-07 14:50:44.817 [vert.x-eventloop-thread-0] INFO [] com.nms.Main - Starting NMS Lite Backend Service...
2025-10-07 14:50:44.972 [vert.x-eventloop-thread-0] INFO [] com.nms.Main - Configuration loaded successfully
2025-10-07 14:50:45.185 [vert.x-eventloop-thread-0] INFO [] com.nms.Main - Database connection established successfully
2025-10-07 14:50:45.227 [vert.x-eventloop-thread-0] INFO [] com.nms.Main - HTTP server started on 0.0.0.0:8080
2025-10-07 14:50:45.228 [vert.x-eventloop-thread-0] INFO [] com.nms.Main - NMS Lite Backend Service started successfully on port: 8080
2025-10-07 14:50:45.229 [vert.x-eventloop-thread-2] INFO [] com.nms.Main - Main verticle deployed successfully with ID: b5ef4053-1074-405e-b3dd-6a8d4710963a
One-liner to run the project:
cd backend && mvn clean package -DskipTests && java -jar target/nms-lite-backend-1.0.0.jarStop the application: Press Ctrl+C in the terminal where the application is running.
Edit backend/src/main/resources/application.yml to configure:
- Server port and host
- Database connection details
- JWT secret and expiration
- CORS settings
- Rate limiting
- Security settings
POST /api/auth/login- User loginPOST /api/auth/refresh- Refresh access tokenPOST /api/auth/logout- User logout
GET /health- Basic health checkGET /ready- Readiness checkGET /live- Liveness check
GET /api/devices- List all devicesPOST /api/devices- Add new deviceGET /api/devices/{id}- Get device detailsPUT /api/devices/{id}- Update deviceDELETE /api/devices/{id}- Delete device
GET /api/credentials- List credential profilesPOST /api/credentials- Create credential profileGET /api/credentials/{id}- Get credential profilePUT /api/credentials/{id}- Update credential profileDELETE /api/credentials/{id}- Delete credential profile
POST /api/discovery/start- Start device discoveryGET /api/discovery/status/{jobId}- Get discovery statusGET /api/discovery/results/{jobId}- Get discovery results
- Username: admin
- Password: admin123
- Role: admin
- JWT-based authentication with configurable expiration
- Password hashing using BCrypt
- Rate limiting with token bucket algorithm
- CORS configuration
- Security headers (X-Frame-Options, CSP, etc.)
- Input validation and sanitization
- Account lockout after failed login attempts
NMS_lite1/
├── backend/ # Java Vert.x application
│ ├── src/main/java/com/nms/
│ │ ├── Main.java # Main application class
│ │ ├── config/ # Configuration classes
│ │ ├── handlers/ # Request handlers
│ │ ├── middleware/ # Middleware components
│ │ ├── services/ # Business logic services
│ │ └── utils/ # Utility classes
│ ├── src/main/resources/
│ │ ├── application.yml # Application configuration
│ │ └── logback.xml # Logging configuration
│ └── pom.xml # Maven dependencies
├── database/
│ └── init/
│ └── schema.sql # Database schema
└── README.md
# Build the project (skip tests for faster build)
mvn clean package -DskipTests
# Build with tests
mvn clean package
# Run tests only
mvn test
# Clean build (remove all generated files)
mvn cleanThe application provides several monitoring endpoints:
- Health Check:
/health- Overall application health - Readiness:
/ready- Application readiness for traffic - Liveness:
/live- Application liveness
Logs are written to:
- Console (INFO level and above)
logs/nms-lite.log(all levels)logs/nms-lite-error.log(ERROR level only)
Log rotation is configured with:
- Daily rotation
- 100MB max file size
- 30 days retention
- 3GB total size cap
- Polling Engine: Implement Go-based polling engine for device metrics collection
- Device Discovery: Add network scanning and device discovery functionality
- Metrics Storage: Implement time-series data storage and retrieval
- Alerting: Add threshold-based alerting system
- Web UI: Create web-based user interface
This project is licensed under the MIT License.