Mointoring
System Monitoring Setup
Ubuntu Monitoring Configuration:
bash
# Install monitoring tools
sudo apt install -y prometheus node-exporter grafana
# Configure Prometheus
sudo cat > /etc/prometheus/prometheus.yml << 'EOF'
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'flowise'
static_configs:
- targets: ['localhost:3000']
metrics_path: '/api/v1/metrics'
- job_name: 'node'
static_configs:
- targets: ['localhost:9100']
- job_name: 'system'
static_configs:
- targets: ['localhost:9090']
EOF
# Start monitoring services
sudo systemctl enable prometheus grafana-server node-exporter
sudo systemctl start prometheus grafana-server node-exporter
# Configure Flowise metrics endpoint
npm install --save prom-client
# Create metrics configuration
cat > ~/flowise-metrics.js << 'EOF'
const client = require('prom-client');
// Create custom metrics
const httpRequestDuration = new client.Histogram({
name: 'flowise_http_request_duration_seconds',
help: 'Duration of HTTP requests in seconds',
labelNames: ['method', 'status_code']
});
const activeFlows = new client.Gauge({
name: 'flowise_active_flows_total',
help: 'Total number of active flows'
});
const apiCalls = new client.Counter({
name: 'flowise_api_calls_total',
help: 'Total number of API calls',
labelNames: ['endpoint', 'method']
});
// Export metrics
module.exports = {
httpRequestDuration,
activeFlows,
apiCalls,
register: client.register
};
EOF
RHEL8 Monitoring Configuration:
bash
# Install monitoring tools
sudo dnf install -y prometheus2 grafana node_exporter
# Configure SELinux for monitoring
sudo setsebool -P httpd_can_network_connect 1
sudo semanage port -a -t http_port_t -p tcp 3000
sudo semanage port -a -t http_port_t -p tcp 9090
sudo semanage port -a -t http_port_t -p tcp 3001
# Configure Prometheus (same as Ubuntu)
sudo cat > /etc/prometheus/prometheus.yml << 'EOF'
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'flowise'
static_configs:
- targets: ['localhost:3000']
metrics_path: '/api/v1/metrics'
- job_name: 'node'
static_configs:
- targets: ['localhost:9100']
- job_name: 'system'
static_configs:
- targets: ['localhost:9090']
EOF
# Configure firewall
sudo firewall-cmd --permanent --add-port=9090/tcp
sudo firewall-cmd --permanent --add-port=3001/tcp
sudo firewall-cmd --permanent --add-port=9100/tcp
sudo firewall-cmd --reload
# Start services
sudo systemctl enable prometheus grafana-server node_exporter
sudo systemctl start prometheus grafana-server node_exporter