Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
442b2ff660 | ||
|
|
362a5071ca |
@@ -60,7 +60,7 @@ Dieses Projekt implementiert ein flexibles und robustes VPN-Überwachungsskript,
|
|||||||
chmod +x functions/*.sh
|
chmod +x functions/*.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Passe die `config.conf` Datei an:
|
4. Kopiere `config.conf.sample` zu `config.conf` und passe die Datei an:
|
||||||
- Definiere Netzwerkinterface, Schwellenwerte, Datenbankeinstellungen, SSH-Details und Logdateipfad.
|
- Definiere Netzwerkinterface, Schwellenwerte, Datenbankeinstellungen, SSH-Details und Logdateipfad.
|
||||||
|
|
||||||
5. (Optional) Füge die Logrotation hinzu:
|
5. (Optional) Füge die Logrotation hinzu:
|
||||||
|
|||||||
@@ -25,7 +25,9 @@ function check_network_traffic() {
|
|||||||
if (( $(echo "$avg_inbound < $THRESHOLD_INBOUND" | bc -l) )) || (( $(echo "$avg_outbound < $THRESHOLD_OUTBOUND" | bc -l) )); then
|
if (( $(echo "$avg_inbound < $THRESHOLD_INBOUND" | bc -l) )) || (( $(echo "$avg_outbound < $THRESHOLD_OUTBOUND" | bc -l) )); then
|
||||||
log_critical "Network traffic below thresholds. Avg In: $avg_inbound KB/s, Avg Out: $avg_outbound KB/s."
|
log_critical "Network traffic below thresholds. Avg In: $avg_inbound KB/s, Avg Out: $avg_outbound KB/s."
|
||||||
restart_service
|
restart_service
|
||||||
|
exit 2 # Exit with error status if thresholds are not met
|
||||||
else
|
else
|
||||||
log_info "Network traffic is above thresholds. Avg In: $avg_inbound KB/s, Avg Out: $avg_outbound KB/s."
|
log_info "Network traffic is above thresholds. Avg In: $avg_inbound KB/s, Avg Out: $avg_outbound KB/s."
|
||||||
|
exit 0 # Exit with success status
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,4 +21,5 @@ function restart_service() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
log_info "Service $SERVICE_NAME successfully restarted and verified."
|
log_info "Service $SERVICE_NAME successfully restarted and verified."
|
||||||
}
|
return 0 # Erfolg
|
||||||
|
}
|
||||||
@@ -19,7 +19,9 @@ function check_sql_activity() {
|
|||||||
if (( (now - last_order_epoch) > 3600 && (now - last_bsi_epoch) > 7200 )); then
|
if (( (now - last_order_epoch) > 3600 && (now - last_bsi_epoch) > 7200 )); then
|
||||||
log_critical "SQL activity check failed. No activity in expected timeframes."
|
log_critical "SQL activity check failed. No activity in expected timeframes."
|
||||||
restart_service
|
restart_service
|
||||||
|
exit 2 # Fehler, Dienst wurde neu gestartet
|
||||||
else
|
else
|
||||||
log_info "SQL activity is within acceptable limits."
|
log_info "SQL activity is within acceptable limits."
|
||||||
|
exit 0 # Erfolg
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
+4
-2
@@ -1,6 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Source Konfigurations- und Modul-Dateien
|
|
||||||
source config.conf
|
source config.conf
|
||||||
source functions/logging.sh
|
source functions/logging.sh
|
||||||
source functions/network_check.sh
|
source functions/network_check.sh
|
||||||
@@ -17,7 +16,7 @@ function is_within_business_hours() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Hauptlogik
|
# Hauptscript
|
||||||
function main() {
|
function main() {
|
||||||
log_info "Starting VPN monitoring script."
|
log_info "Starting VPN monitoring script."
|
||||||
|
|
||||||
@@ -28,6 +27,9 @@ function main() {
|
|||||||
log_info "Outside business hours. Running SQL activity check."
|
log_info "Outside business hours. Running SQL activity check."
|
||||||
check_sql_activity
|
check_sql_activity
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
log_info "VPN monitoring script completed successfully."
|
||||||
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
main
|
main
|
||||||
|
|||||||
Reference in New Issue
Block a user