Initial commit: add .gitignore and README
This commit is contained in:
47
monitoring/prometheus/install.sh
Executable file
47
monitoring/prometheus/install.sh
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
# Install Prometheus/Grafana Stack
|
||||
|
||||
set -e
|
||||
|
||||
NAMESPACE="monitoring"
|
||||
RELEASE_NAME="prometheus"
|
||||
|
||||
echo "📊 Installing Prometheus/Grafana Stack..."
|
||||
|
||||
# Check if helm is installed
|
||||
if ! command -v helm &> /dev/null; then
|
||||
echo "❌ Helm not found. Please install Helm first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if kubectl is installed
|
||||
if ! command -v kubectl &> /dev/null; then
|
||||
echo "❌ kubectl not found. Please install kubectl first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create namespace
|
||||
echo "📦 Creating namespace: $NAMESPACE"
|
||||
kubectl create namespace "$NAMESPACE" --dry-run=client -o yaml | kubectl apply -f -
|
||||
|
||||
# Add Prometheus Helm repo
|
||||
echo "📥 Adding Prometheus Helm repository..."
|
||||
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
|
||||
helm repo update
|
||||
|
||||
# Install Prometheus Stack
|
||||
echo "🚀 Installing Prometheus Stack..."
|
||||
helm upgrade --install "$RELEASE_NAME" prometheus-community/kube-prometheus-stack \
|
||||
--namespace "$NAMESPACE" \
|
||||
--create-namespace \
|
||||
--values values.yaml \
|
||||
--wait
|
||||
|
||||
echo "✅ Prometheus/Grafana Stack installed successfully!"
|
||||
echo ""
|
||||
echo "📝 Access Grafana:"
|
||||
echo " kubectl port-forward -n $NAMESPACE svc/$RELEASE_NAME-grafana 3000:80"
|
||||
echo ""
|
||||
echo "📝 Access Prometheus:"
|
||||
echo " kubectl port-forward -n $NAMESPACE svc/$RELEASE_NAME-kube-prom-prometheus 9090:9090"
|
||||
|
||||
86
monitoring/prometheus/values.yaml
Normal file
86
monitoring/prometheus/values.yaml
Normal file
@@ -0,0 +1,86 @@
|
||||
# Prometheus Stack Helm Values
|
||||
# For use with kube-prometheus-stack
|
||||
|
||||
prometheus:
|
||||
prometheusSpec:
|
||||
retention: 30d
|
||||
retentionSize: 50GB
|
||||
storageSpec:
|
||||
volumeClaimTemplate:
|
||||
spec:
|
||||
accessModes: ["ReadWriteOnce"]
|
||||
storageClassName: standard
|
||||
resources:
|
||||
requests:
|
||||
storage: 100Gi
|
||||
resources:
|
||||
requests:
|
||||
memory: 2Gi
|
||||
cpu: 1000m
|
||||
limits:
|
||||
memory: 4Gi
|
||||
cpu: 2000m
|
||||
serviceMonitorSelectorNilUsesHelmValues: false
|
||||
podMonitorSelectorNilUsesHelmValues: false
|
||||
ruleSelectorNilUsesHelmValues: false
|
||||
|
||||
grafana:
|
||||
enabled: true
|
||||
adminPassword: "admin" # Change in production
|
||||
persistence:
|
||||
enabled: true
|
||||
size: 10Gi
|
||||
resources:
|
||||
requests:
|
||||
memory: 256Mi
|
||||
cpu: 100m
|
||||
limits:
|
||||
memory: 512Mi
|
||||
cpu: 500m
|
||||
dashboardProviders:
|
||||
dashboardproviders.yaml:
|
||||
apiVersion: 1
|
||||
providers:
|
||||
- name: 'default'
|
||||
orgId: 1
|
||||
folder: ''
|
||||
type: file
|
||||
disableDelete: false
|
||||
editable: true
|
||||
options:
|
||||
path: /var/lib/grafana/dashboards/default
|
||||
dashboards:
|
||||
default:
|
||||
kubernetes-cluster:
|
||||
gnetId: 7249
|
||||
revision: 1
|
||||
datasource: Prometheus
|
||||
|
||||
alertmanager:
|
||||
enabled: true
|
||||
config:
|
||||
global:
|
||||
resolve_timeout: 5m
|
||||
route:
|
||||
group_by: ['alertname']
|
||||
group_wait: 10s
|
||||
group_interval: 10s
|
||||
repeat_interval: 12h
|
||||
receiver: 'default'
|
||||
receivers:
|
||||
- name: 'default'
|
||||
email_configs:
|
||||
- to: 'alerts@example.com'
|
||||
from: 'prometheus@example.com'
|
||||
smarthost: 'smtp.example.com:587'
|
||||
auth_username: 'prometheus'
|
||||
auth_password: 'password'
|
||||
headers:
|
||||
Subject: 'Prometheus Alert'
|
||||
|
||||
kubeStateMetrics:
|
||||
enabled: true
|
||||
|
||||
nodeExporter:
|
||||
enabled: true
|
||||
|
||||
Reference in New Issue
Block a user