A lightweight, highly available Oracle Database health monitoring and visualization platform developed with Go and the Gin framework. It provides unified health monitoring and visual management capabilities for enterprise-level Oracle Data Guard environments, displaying core metrics such as primary/standby database status and synchronization delay in real-time through a web dashboard, helping operations teams efficiently manage database operations.
- Real-time Monitoring: Displays the status of primary database, standby database, and load balancer nodes in real-time.
- Multi-instance Support: Supports monitoring multiple Oracle database instances through configuration files.
- Multilingual Interface: Supports dynamic switching between Chinese, English, and Japanese interfaces.
- Command Line Support: Provides command-line parameters for specifying configuration files, checking version, etc.
- Highly Customizable: Flexible configuration of database connections, UI titles, refresh rates, etc., via
config.yaml
. - Extremely Simple Deployment: Can be compiled into a single binary file with no external dependencies, supporting operation as a service or in Docker.
- RESTful API: Provides data interfaces like
/api/data
for secondary development and system integration. - Mock Data Mode: Built-in independent mock data functionality for frontend development and testing (see Mock Data Guide).
- Backend: Go, Gin
- Frontend: Vanilla JavaScript, HTML, CSS
- Configuration: YAML
- Go 1.18 or higher
git clone https://github.com/goodwaysIT/go-oracle-dr-dashboard.git
cd go-oracle-dr-dashboard
- Configure
config.yaml
: Modify the database connection information according to your Oracle environment. - Run:
go run .
The application supports the following command-line arguments:
-f
,--file <path>
: Specify the path to the configuration file (default:config.yaml
).-v
,--version
: Display the current version of the application.-h
,--help
: Display help information.
Example:
go run . -f /etc/dashboard/prod.yaml
Dynamically switch the interface language by adding the lang
parameter to the URL.
- English:
http://localhost:8080/?lang=en
- Chinese:
http://localhost:8080/?lang=zh
- Japanese:
http://localhost:8080/?lang=ja
You can customize various parameters of the application, such as UI titles and layout. Here are some key configuration examples:
# UI Title Configuration
titles:
main_title: "Oracle Database DR Monitoring Dashboard"
prod_data_center: "Production Data Center"
dr_data_center: "Disaster Recovery Data Center"
# Layout Configuration
layout:
columns: 3 # Number of database columns to display per data center
These configurations will take effect when the application is running (non-mock mode).
Thanks to Go's features, this project can be compiled into a single binary file with no external dependencies, greatly simplifying the deployment process.
You can compile executable files for different operating systems.
For the current system:
go build -o oracle-dr-dashboard .
Cross-compile for Linux:
GOOS=linux GOARCH=amd64 go build -o oracle-dr-dashboard_linux .
After compilation, simply copy the generated executable file (e.g., oracle-dr-dashboard_linux
) and the config.yaml
configuration file to your server to run.
On Linux systems, it is recommended to use systemd
to manage the application for automatic startup and stable operation.
-
Create a
systemd
service file at/etc/systemd/system/dashboard.service
:[Unit] Description=Oracle DR Dashboard Service After=network.target [Service] Type=simple User=your_user # Replace with the user to run the service WorkingDirectory=/opt/dashboard # Replace with your application directory ExecStart=/opt/dashboard/oracle-dr-dashboard_linux -f /opt/dashboard/config.yaml Restart=on-failure RestartSec=5s [Install] WantedBy=multi-user.target
-
Reload and start the service:
sudo systemctl daemon-reload sudo systemctl start dashboard sudo systemctl enable dashboard # Enable auto-start on boot
You can also containerize the application using Docker for environment isolation and quick deployment.
-
Create a
Dockerfile
:# --- Build Stage --- FROM golang:1.18-alpine AS builder WORKDIR /app COPY . . RUN go build -o /oracle-dr-dashboard . # --- Final Stage --- FROM alpine:latest WORKDIR /app COPY --from=builder /oracle-dr-dashboard . COPY config.yaml . EXPOSE 8080 CMD ["./oracle-dr-dashboard", "-f", "config.yaml"]
-
Build and run the Docker image:
docker build -t oracle-dr-dashboard . docker run -p 8080:8080 -d --name dashboard oracle-dr-dashboard
- Web Framework: Gin
- Configuration Parsing: gopkg.in/yaml.v3
- Logging: Standard library log + optional logrotate
- Frontend: Static HTML/CSS/JS (customizable)
- Runtime Environment: Supports Windows/Linux
- Prepare the configuration file
config.yaml
(see example and field descriptions below). - Place the executable file and configuration file in the same directory.
- Start the service:
Or on Windows:
./oracle-dr-dashboard
oracle-dr-dashboard.exe
- Access the web dashboard:
Open
http://<server-ip>:8080/
in your browser (the port can be modified in the configuration file). - Logs are output to
oracle-dr-dashboard.log
.
# Server Configuration
server:
port: "8080" # Web service listening port
static_dir: "./static" # Static resource directory (optional)
refresh_interval: 60 # Data refresh interval (seconds)
public_base_path: "/" # Frontend base path (modify for subpath deployment)
# Logging Configuration
logging:
level: "info" # Log level (info/debug/warn/error)
filename: "oracle-dr-dashboard.log" # Log file name
max_size_mb: 100 # Maximum size of a single log file (MB)
max_backups: 5 # Maximum number of log file backups
max_age_days: 30 # Maximum log retention days
# Database Configuration
# Multiple database instances can be configured as follows:
databases:
- name: "Core Database"
lb_ip: "192.168.1.101"
prod_ip: "10.0.1.101"
dr_ip: "10.1.1.101"
port: 1521
service_name: "ORCLPDB1"
username: "monitor_user"
password: "your_secure_password_here"
# ... (additional database configurations can be added)
server.port
: Web service listening port.server.static_dir
: Static resource directory, default./static
, can be embedded in the build.server.refresh_interval
: Frontend auto-refresh interval (seconds).server.public_base_path
: Frontend base path, suitable for reverse proxy or subpath deployment.logging
: Logging-related configurations.databases
: List of database instances, supporting multiple instances.
- Start the service:
./oracle-dr-dashboard
- Access the web interface:
- Open
http://localhost:8080/
or the server's actual IP in your browser
- Open
- To configure multiple databases, simply append them under
databases
in the configuration file.
go build -o oracle-dr-dashboard main.go config.go logger.go status.go
GOOS=linux GOARCH=amd64 go build -o oracle-dr-dashboard main.go config.go logger.go status.go
GOOS=windows GOARCH=amd64 go build -o oracle-dr-dashboard.exe main.go config.go logger.go status.go
- Ensure the monitored databases are network accessible and the account has the correct permissions.
- Static resources can be customized, with the default directory being
./static
. - When deploying under a subpath, set
public_base_path
. - It is recommended to run as a background service with system monitoring.
For more help, please visit the project GitHub Repository or contact the developers.