Update Readme.md
This commit is contained in:
157
README.md
157
README.md
@@ -1,53 +1,104 @@
|
|||||||
<p># prtg-linux-service-monitor Ein kleines Bash Script um Linux Services mit dem PRTG Monitor zu überwachen</p>
|
<p align="center">
|
||||||
<div style="direction: ltr; border-width: 100%;">
|
<a href="https://techniverse.net">
|
||||||
<div style="direction: ltr; margin-top: 0in; margin-left: 0in; width: 7.4361in;">
|
<img src="https://assets.techniverse.net/f1/git/graphics/repo-techniverse-logo.png" alt="Techniverse Community" height="70" />
|
||||||
<div style="direction: ltr; margin-top: 0in; margin-left: 0in; width: 7.4361in;">
|
</a>
|
||||||
<ol style="direction: ltr; unicode-bidi: embed; margin-top: 0in; margin-bottom: 0in; font-family: Calibri; font-size: 11.0pt; font-weight: normal; font-style: normal;" type="1">
|
</p>
|
||||||
<li style="margin-top: 0; margin-bottom: 0; vertical-align: middle;" value="1"><span style="font-family: Calibri; font-size: 11.0pt; font-weight: normal; font-style: normal;">Script installieren</span></li>
|
|
||||||
</ol>
|
<h1 align="center">PRTG Linux Service Monitor</h1>
|
||||||
<p style="margin: 0in; margin-left: .75in; font-family: Calibri; font-size: 11.0pt;">mkdir -p /temp && cd /temp</p>
|
|
||||||
<p style="margin: 0in; margin-left: .75in; font-family: Calibri; font-size: 11.0pt;">git clone <a href="https://git.media-techport.de/scriptos/prtg-linux-service-monitor.git">https://git.media-techport.de/scriptos/prtg-linux-service-monitor.git</a></p>
|
<h4 align="center">
|
||||||
<p style="margin: 0in; margin-left: .75in; font-family: Calibri; font-size: 11.0pt;">cd prtg-linux-service-monitor</p>
|
Ein Bash-Script zur automatischen Überwachung und Neustart von Linux-Diensten mit PRTG Network Monitor
|
||||||
<p style="margin: 0in; margin-left: .75in; font-family: Calibri; font-size: 11.0pt;">cp prtg-service-mon.sh /home/scripts/default/prtg-service-mon.sh</p>
|
</h4>
|
||||||
<p style="margin: 0in; margin-left: .75in; font-family: Calibri; font-size: 11.0pt;">chmod 711 /home/scripts/default/prtg-service-mon.sh</p>
|
|
||||||
<p style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"> </p>
|
<h6 align="center">
|
||||||
<ol style="direction: ltr; unicode-bidi: embed; margin-top: 0in; margin-bottom: 0in; font-family: Calibri; font-size: 11.0pt; font-weight: normal; font-style: normal;" type="1">
|
<a href="https://www.cleveradmin.de">🏰 Website</a>
|
||||||
<li style="margin-top: 0; margin-bottom: 0; vertical-align: middle;" value="2"><span style="font-family: Calibri; font-size: 11.0pt; font-weight: normal; font-style: normal;">Cronjob einrichten</span></li>
|
·
|
||||||
</ol>
|
<a href="https://techniverse.net">📰 Community</a>
|
||||||
<p style="margin: 0in; margin-left: .75in; font-family: Calibri; font-size: 11.0pt;">cat <(crontab -l) <(echo "*/5 * * * * /home/scripts/default/prtg-service-mon.sh mariadb push.mon01.media-techport.de:5050 b2949934-1f05-40b0-afd8-856ac7e534cd > /dev/null 2>&1") | crontab -</p>
|
·
|
||||||
<p style="margin: 0in; margin-left: 1.125in; font-family: Calibri; font-size: 11.0pt;">Beschreibung für die Parameter hinter dem Befehl:</p>
|
<a href="https://social.techniverse.net/@donnerwolke">🐘 Mastodon</a>
|
||||||
<p style="margin: 0in; margin-left: 1.125in; font-family: Calibri; font-size: 11.0pt;"><span style="font-size: 11pt;">1. ist der Service, welcher überwacht werden soll</span></p>
|
·
|
||||||
<p style="margin: 0in; margin-left: 1.125in; font-family: Calibri; font-size: 11.0pt;"><span style="font-family: Calibri; font-size: 11.0pt;">2. ist der Server, an dem die Push gesendet wird</span></p>
|
<a href="https://matrix.to/#/#support:techniverse.net">💬 Support</a>
|
||||||
<p style="margin: 0in; margin-left: 1.125in; font-family: Calibri; font-size: 11.0pt;"><span style="font-family: Calibri; font-size: 11.0pt;">3. ist die GUID zur Identifizierung (der sogenannte Ident, dieser muss für jeden Sensor anders sein)</span></p>
|
</h6>
|
||||||
<p style="margin: 0in; margin-left: 1.125in; font-family: Calibri; font-size: 11.0pt;">Kann hier generiert werden: <a href="https://guidgenerator.com/">https://guidgenerator.com/</a></p>
|
<br><br>
|
||||||
<p style="margin: 0in; margin-left: .75in; font-family: Calibri; font-size: 11.0pt;"> </p>
|
|
||||||
<ol style="direction: ltr; unicode-bidi: embed; margin-top: 0in; margin-bottom: 0in; font-family: Calibri; font-size: 11.0pt; font-weight: normal; font-style: normal;" type="1">
|
**prtg-linux-service-monitor** ist ein leichtgewichtiges Bash-Script, das Linux-Dienste mit dem [PRTG Network Monitor](https://www.paessler.com/prtg) überwacht. Es prüft kontinuierlich, ob ein definierter Service läuft, startet ihn bei Ausfall automatisch neu und sendet den Status per HTTP-Push an PRTG.
|
||||||
<li style="margin-top: 0; margin-bottom: 0; vertical-align: middle;" value="3"><span style="font-family: Calibri; font-size: 11.0pt; font-weight: normal; font-style: normal;">Sensor einrichten</span></li>
|
|
||||||
<ol style="direction: ltr; unicode-bidi: embed; margin-top: 0in; margin-bottom: 0in; font-family: Calibri; font-size: 11.0pt; font-weight: normal; font-style: normal;" type="a">
|
### ✨ Features
|
||||||
<li style="margin-top: 0; margin-bottom: 0; vertical-align: middle;" value="1"><span style="font-family: Calibri; font-size: 11.0pt; font-weight: normal; font-style: normal;">in PRTG anmelden</span></li>
|
|
||||||
<li style="margin-top: 0; margin-bottom: 0; vertical-align: middle;"><span style="font-family: Calibri; font-size: 11.0pt;">Server, dessen Service überwacht werden soll, aufrufen</span></li>
|
- ✅ **Automatische Dienstprüfung** – Prüft in regelmäßigen Intervallen, ob ein Service läuft
|
||||||
<li style="margin-top: 0; margin-bottom: 0; vertical-align: middle;"><span style="font-family: Calibri; font-size: 11.0pt;">Neuen Sensor hinzufügen</span></li>
|
- 🔄 **Auto-Restart** – Startet ausgefallene Dienste automatisch neu
|
||||||
</ol>
|
- 📡 **PRTG Integration** – Sendet Statusmeldungen per HTTP-Push an PRTG
|
||||||
</ol>
|
- ⚡ **Leichtgewichtig** – Kein zusätzlicher Aufwand, nur ein einfaches Bash-Script
|
||||||
<p style="margin: 0in; margin-left: .75in;"><img src="https://assets.media-techport.de/f1/git/scriptos/prtg-linux-service-monitor/prtg1.png" alt="" /></p>
|
|
||||||
<ol style="direction: ltr; unicode-bidi: embed; margin-top: 0in; margin-bottom: 0in; font-family: Calibri; font-size: 11.0pt; font-weight: normal; font-style: normal;" type="a">
|
## 📦 Script installieren
|
||||||
<li style="margin-top: 0; margin-bottom: 0; vertical-align: middle;" value="4"><span style="font-family: Calibri; font-size: 11.0pt; font-weight: normal; font-style: normal;">Folgende Felder ausfüllen:</span></li>
|
|
||||||
<ol style="direction: ltr; unicode-bidi: embed; margin-top: 0in; margin-bottom: 0in; font-family: Calibri; font-size: 11.0pt; font-weight: normal; font-style: normal;" type="1">
|
```bash
|
||||||
<li style="margin-top: 0; margin-bottom: 0; vertical-align: middle;" value="1"><span style="font-family: Calibri; font-size: 11.0pt; font-weight: normal; font-style: normal;">Name des Sensors: "Service: MariaDB"</span></li>
|
mkdir -p /temp && cd /temp
|
||||||
<li style="margin-top: 0; margin-bottom: 0; vertical-align: middle;"><span style="font-family: Calibri; font-size: 11.0pt;">Einstellungen für SSL: unsicher</span></li>
|
git clone https://git.media-techport.de/scriptos/prtg-linux-service-monitor.git
|
||||||
<li style="margin-top: 0; margin-bottom: 0; vertical-align: middle;"><span style="font-family: Calibri; font-size: 11.0pt;">Port: "5050"</span></li>
|
cd prtg-linux-service-monitor
|
||||||
<li style="margin-top: 0; margin-bottom: 0; vertical-align: middle;"><span style="font-family: Calibri; font-size: 11.0pt;">Token für Identifikation: Dieser wird aus dem Cronjob übernommen</span></li>
|
cp prtg-service-mon.sh /home/scripts/default/prtg-service-mon.sh
|
||||||
<li style="margin-top: 0; margin-bottom: 0; vertical-align: middle;"><span style="font-family: Calibri; font-size: 11.0pt;">Keine hereinkommenden Daten: Auf "Nach x Minuten auf "Fehler" wechseln" setzen</span></li>
|
chmod 711 /home/scripts/default/prtg-service-mon.sh
|
||||||
<li style="margin-top: 0; margin-bottom: 0; vertical-align: middle;"><span style="font-family: Calibri; font-size: 11.0pt;">Schwellenwert für Zeit (Minuten): "10"</span></li>
|
```
|
||||||
</ol>
|
|
||||||
</ol>
|
## ⏰ Cronjob einrichten
|
||||||
<p style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"> </p>
|
|
||||||
<p style="margin: 0in; margin-left: .75in; font-family: Calibri; font-size: 11.0pt;">Das ganze könnte dann so aussehen:</p>
|
Füge folgenden Eintrag zur Crontabelle hinzu (z. B. alle 5 Minuten):
|
||||||
<p style="margin: 0in; margin-left: .75in;"><img src="https://assets.media-techport.de/f1/git/scriptos/prtg-linux-service-monitor/prtg2.png" alt="" /></p>
|
|
||||||
<p style="margin: 0in; margin-left: .75in;"><img src="https://assets.media-techport.de/f1/git/scriptos/prtg-linux-service-monitor/prtg3.png" alt="" /></p>
|
```bash
|
||||||
<p style="margin: 0in; margin-left: .75in; font-family: Calibri; font-size: 11.0pt;"> </p>
|
cat <(crontab -l) <(echo "*/5 * * * * /home/scripts/default/prtg-service-mon.sh mariadb push.mon01.media-techport.de:5050 b2949934-1f05-40b0-afd8-856ac7e534cd > /dev/null 2>&1") | crontab -
|
||||||
Quellen:
|
```
|
||||||
<p style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"><a href="https://kb.paessler.com/en/topic/70771-how-can-i-monitor-and-automatically-restart-a-service-on-a-linux-host">https://kb.paessler.com/en/topic/70771-how-can-i-monitor-and-automatically-restart-a-service-on-a-linux-host</a> <a href="https://www.paessler.com/manuals/prtg/http_push_data_advanced_sensor">https://www.paessler.com/manuals/prtg/http_push_data_advanced_sensor</a></p>
|
|
||||||
</div>
|
### 🛠 Parameter des Scripts
|
||||||
</div>
|
|
||||||
</div>
|
| # | Beschreibung |
|
||||||
|
|---|------|
|
||||||
|
| 1 | Der Service, welcher überwacht werden soll |
|
||||||
|
| 2 | Der Server, an dem die Push-Nachricht gesendet wird |
|
||||||
|
| 3 | Die GUID zur Identifizierung (der sogenannte *Ident*, muss für jeden Sensor eindeutig sein) |
|
||||||
|
|
||||||
|
> 💡 GUIDs können hier generiert werden: https://guidgenerator.com/
|
||||||
|
|
||||||
|
## 🔧 Sensor einrichten
|
||||||
|
|
||||||
|
### 1️⃣ PRTG Sensor erstellen
|
||||||
|
|
||||||
|
1. In PRTG anmelden
|
||||||
|
2. Den Server aufrufen, dessen Service überwacht werden soll
|
||||||
|
3. **Neuen Sensor hinzufügen**
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### 2️⃣ Felder ausfüllen
|
||||||
|
|
||||||
|
| Feld | Wert |
|
||||||
|
|------|------|
|
||||||
|
| Name des Sensors | `Service: MariaDB` |
|
||||||
|
| Einstellungen für SSL | **Unsicher** |
|
||||||
|
| Port | `5050` |
|
||||||
|
| Token für Identifikation | Wird aus dem Cronjob übernommen |
|
||||||
|
| Keine hereinkommenden Daten | **Nach x Minuten auf "Fehler" wechseln** |
|
||||||
|
| Schwellenwert für Zeit (Minuten) | `10` |
|
||||||
|
|
||||||
|
### 3️⃣ Beispiel
|
||||||
|
|
||||||
|
Das ganze könnte dann so aussehen:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## 📚 Quellen
|
||||||
|
|
||||||
|
- [KB: How can I monitor and automatically restart a service on a Linux host](https://kb.paessler.com/en/topic/70771-how-can-i-monitor-and-automatically-restart-a-service-on-a-linux-host)
|
||||||
|
- [PRTG: HTTP Push Data Advanced Sensor](https://www.paessler.com/manuals/prtg/http_push_data_advanced_sensor)
|
||||||
|
|
||||||
|
<br><br>
|
||||||
|
<p align="center">
|
||||||
|
<img src="https://assets.techniverse.net/f1/git/graphics/gray0-catonline.svg" alt="">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<sub>
|
||||||
|
© Patrick Asmus · Techniverse Network · <a href="./LICENSE">Lizenz</a>
|
||||||
|
</sub>
|
||||||
|
</p>
|
||||||
|
|||||||
BIN
assets/img/prtg1.png
Normal file
BIN
assets/img/prtg1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
BIN
assets/img/prtg2.png
Normal file
BIN
assets/img/prtg2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 87 KiB |
BIN
assets/img/prtg3.png
Normal file
BIN
assets/img/prtg3.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
Reference in New Issue
Block a user