chore: sync repository to current working state
Some checks failed
Build and Test / Build Server (Linux) (push) Has been cancelled
Build and Test / Build Agent (Windows) (push) Has been cancelled
Build and Test / Security Audit (push) Has been cancelled
Build and Test / Build Summary (push) Has been cancelled
Run Tests / Test Server (push) Has been cancelled
Run Tests / Test Agent (push) Has been cancelled
Run Tests / Code Coverage (push) Has been cancelled
Run Tests / Lint and Format Check (push) Has been cancelled
Some checks failed
Build and Test / Build Server (Linux) (push) Has been cancelled
Build and Test / Build Agent (Windows) (push) Has been cancelled
Build and Test / Security Audit (push) Has been cancelled
Build and Test / Build Summary (push) Has been cancelled
Run Tests / Test Server (push) Has been cancelled
Run Tests / Test Agent (push) Has been cancelled
Run Tests / Code Coverage (push) Has been cancelled
Run Tests / Lint and Format Check (push) Has been cancelled
Brings azcomputerguru/guru-connect up to the authoritative working copy that had been maintained in the claudetools monorepo: Phase 1 security and infrastructure (middleware, metrics, utils, token blacklist, deployment scripts, security audits) plus the native-remote-control integration spec. Preserves the repo .gitignore, .cargo, and server/static/downloads. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
102
infrastructure/setup-monitoring.sh
Normal file
102
infrastructure/setup-monitoring.sh
Normal file
@@ -0,0 +1,102 @@
|
||||
#!/bin/bash
|
||||
# GuruConnect Monitoring Setup Script
|
||||
# Installs and configures Prometheus and Grafana
|
||||
|
||||
set -e
|
||||
|
||||
# Colors
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
echo "========================================="
|
||||
echo "GuruConnect Monitoring Setup"
|
||||
echo "========================================="
|
||||
|
||||
# Check if running as root
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
echo -e "${RED}ERROR: This script must be run as root (sudo)${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Update package list
|
||||
echo "Updating package list..."
|
||||
apt-get update
|
||||
|
||||
# Install Prometheus
|
||||
echo ""
|
||||
echo "Installing Prometheus..."
|
||||
apt-get install -y prometheus prometheus-node-exporter
|
||||
|
||||
# Copy Prometheus configuration
|
||||
echo "Copying Prometheus configuration..."
|
||||
cp prometheus.yml /etc/prometheus/prometheus.yml
|
||||
if [ -f "alerts.yml" ]; then
|
||||
cp alerts.yml /etc/prometheus/alerts.yml
|
||||
fi
|
||||
|
||||
# Set permissions
|
||||
chown prometheus:prometheus /etc/prometheus/prometheus.yml
|
||||
if [ -f "/etc/prometheus/alerts.yml" ]; then
|
||||
chown prometheus:prometheus /etc/prometheus/alerts.yml
|
||||
fi
|
||||
|
||||
# Restart Prometheus
|
||||
echo "Restarting Prometheus..."
|
||||
systemctl restart prometheus
|
||||
systemctl enable prometheus
|
||||
systemctl restart prometheus-node-exporter
|
||||
systemctl enable prometheus-node-exporter
|
||||
|
||||
# Install Grafana
|
||||
echo ""
|
||||
echo "Installing Grafana..."
|
||||
apt-get install -y software-properties-common
|
||||
add-apt-repository -y "deb https://packages.grafana.com/oss/deb stable main"
|
||||
wget -q -O - https://packages.grafana.com/gpg.key | apt-key add -
|
||||
apt-get update
|
||||
apt-get install -y grafana
|
||||
|
||||
# Start Grafana
|
||||
echo "Starting Grafana..."
|
||||
systemctl start grafana-server
|
||||
systemctl enable grafana-server
|
||||
|
||||
# Wait for Grafana to start
|
||||
sleep 5
|
||||
|
||||
# Configure Grafana data source (Prometheus)
|
||||
echo ""
|
||||
echo "Configuring Grafana data source..."
|
||||
curl -X POST -H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"name":"Prometheus",
|
||||
"type":"prometheus",
|
||||
"url":"http://localhost:9090",
|
||||
"access":"proxy",
|
||||
"isDefault":true
|
||||
}' \
|
||||
http://admin:admin@localhost:3000/api/datasources || true
|
||||
|
||||
echo ""
|
||||
echo "========================================="
|
||||
echo "Monitoring Setup Complete!"
|
||||
echo "========================================="
|
||||
echo ""
|
||||
echo "Services:"
|
||||
echo " Prometheus: http://172.16.3.30:9090"
|
||||
echo " Grafana: http://172.16.3.30:3000 (default login: admin/admin)"
|
||||
echo " Node Exporter: http://172.16.3.30:9100/metrics"
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo "1. Access Grafana at http://172.16.3.30:3000"
|
||||
echo "2. Login with default credentials (admin/admin)"
|
||||
echo "3. Change the default password"
|
||||
echo "4. Import the dashboard from grafana-dashboard.json"
|
||||
echo "5. Configure alerting (optional)"
|
||||
echo ""
|
||||
echo "To import the dashboard:"
|
||||
echo " Grafana > Dashboards > Import > Upload JSON file"
|
||||
echo " Select: infrastructure/grafana-dashboard.json"
|
||||
echo ""
|
||||
Reference in New Issue
Block a user