{"id":14434,"date":"2024-03-08T20:34:56","date_gmt":"2024-03-08T19:34:56","guid":{"rendered":"https:\/\/linux-bibel.at\/?p=14434"},"modified":"2024-03-08T20:34:59","modified_gmt":"2024-03-08T19:34:59","slug":"monitoring-mit-prometheus-unter-linux","status":"publish","type":"post","link":"https:\/\/linux-bibel.at\/index.php\/2024\/03\/08\/monitoring-mit-prometheus-unter-linux\/","title":{"rendered":"Monitoring mit Prometheus unter Linux"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Nicht nur f\u00fcr Firmen zahlt es sich aus, die laufenden Server, Ger\u00e4te und das Netzwerk zu monitoren &#8211; also zu beobachten. Wir haben auf der Linux Bibel neben vielen kleinen Tools, auch schon das gro\u00dfe Monitoring-System <a href=\"https:\/\/linux-bibel.at\/index.php\/2023\/09\/10\/zabbix-monitoring-des-netzwerkes-und-der-geraete\/\" data-type=\"post\" data-id=\"2665\">Zabbix<\/a> kennengelernt &#8211; in diesem Beitrag geht es um das Monitoring mit Prometheus.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Prometheus ist nicht so Hardware-lastig wie Zabbix, f\u00fcr manche Dinge vor allem nicht so kompliziert und umst\u00e4ndlich, vor allem, wenn es um einfache Dinge geht. Man muss auch sagen &#8211; wird es spezieller, als rein nur normale Rechner zu monitoren, kann es schon auch komplizierter werden.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Prometheus installieren<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Unter auf Debian basierenden Linux-Distributionen installieren Sie diese Software wie \u00fcblich ganz einfach \u00fcber die Paket-Verwaltung durch das Paket &#8222;<strong>prometheus<\/strong>&#8222;. Etwa am einfachsten als root am Terminal mit dem Befehl:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt install prometheus<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Ich habe hier Prometheus auf einem Raspberry Pi installiert. Die Software braucht auch einen Webserver &#8211; hierzu installiere ich den schlanken Nginx:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt install nginx<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Jetzt muss der Webserver darauf konfiguriert werden, dass Prometheus auch angezeigt wird &#8211; hierzu \u00f6ffnen wir dessen Konfigurationsdatei. In diesem Fall mit dem professionellen Editor Vim:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim \/etc\/nginx\/conf.d\/prometheus.conf<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Hier f\u00fcgen wir folgenden Code ein:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>server {\n    listen 80;\n    server_name prometheus.robert.org;\n    location \/ {\n        proxy_pass http:\/\/localhost:9090;\n        proxy_http_version 1.1;\n        proxy_set_header Upgrade $http_upgrade;\n        proxy_set_header Connection 'upgrade';\n        proxy_set_header Host $host;\n        proxy_cache_bypass $http_upgrade;\n    }\n\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Den <code>server_name<\/code> passen Sie nat\u00fcrlich entsprechend an, den Port, wenn gew\u00fcnscht ebenfalls, anschlie\u00dfend starten Sie den Server neu:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl restart nginx.service<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Anschlie\u00dfend rufen Sie Prometheus \u00fcber den Webbrowser auf &#8211; etwa auf dem lokalen Rechner mit &#8222;<em>http:\/\/localhost:80<\/em>&#8220; oder auf einem anderen Rechner, mit der IP-Adresse des Rechners &#8222;<em>http:\/\/192.168.1.105:80<\/em>&#8220; &#8211; zuletzt geben Sie nach einem Doppelpunkt den Port an:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-scaled.jpeg\" rel=\"lightbox-0\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-1024x640.jpeg\" alt=\"\" class=\"wp-image-14437\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-1024x640.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-1536x960.jpeg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-2048x1280.jpeg 2048w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-150x94.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-300x188.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-768x480.jpeg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Damit w\u00e4re Prometheus betriebsbereit, wir m\u00fcssen nur noch entsprechende zu \u00fcberwachende Systeme einf\u00fcgen. Wollen wir als Erstes gleich einmal den Prometheus-Host angeben &#8211; hierzu ist unter Debian mit Prometheus auch gleich der passende Exporter installiert, dieser l\u00e4uft auch bereits, wie der Befehl:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl status prometheus-node-exporter.service<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">zeigt:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-1.jpeg\" rel=\"lightbox-1\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"419\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-1-1024x419.jpeg\" alt=\"\" class=\"wp-image-14438\" style=\"width:700px;height:auto\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-1-1024x419.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-1-1536x629.jpeg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-1-2048x839.jpeg 2048w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-1-150x61.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-1-300x123.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-1-768x315.jpeg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Wir m\u00fcssen Prometheus jetzt nur noch anweisen, den Exporter zu nutzen &#8211; dies erledigen wir wieder als root am Terminal mit dem gew\u00fcnschten Editor \u00fcber die Datei &#8222;<em>\/etc\/prometheus\/prometheus.yml<\/em>&#8222;:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim \/etc\/prometheus\/prometheus.yml<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Hier scrollen Sie erst einmal ganz hinunter und finden folgenden Code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  - job_name: node\n    # If prometheus-node-exporter is installed, grab stats about the local\n    # machine by default.\n    static_configs:\n      - targets: &#91;'localhost:9100']<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-2.jpeg\" rel=\"lightbox-2\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"600\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-2-1024x600.jpeg\" alt=\"\" class=\"wp-image-14440\" style=\"width:694px;height:auto\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-2-1024x600.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-2-1536x900.jpeg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-2-2048x1200.jpeg 2048w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-2-150x88.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-2-300x176.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-2-768x450.jpeg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Unter Debian ist dieser Exporter bereits aktiv, Sie m\u00fcssen also nichts weiter tun. Wichtig ist, von dieser Datei schon einmal geh\u00f6rt zu haben &#8211; es ist die zentrale Konfigurationsdatei. Im Webbrowser klicken Sie jetzt auf &#8222;<em>Status \u2192 Targets<\/em>&#8220; &#8211; hier sehen Sie bereits den aktiven Exporter, der lokale Rechner wird also bereits \u00fcberwacht:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-3-scaled.jpeg\" rel=\"lightbox-3\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-3-1024x640.jpeg\" alt=\"\" class=\"wp-image-14441\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-3-1024x640.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-3-1536x960.jpeg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-3-2048x1280.jpeg 2048w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-3-150x94.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-3-300x188.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-3-768x480.jpeg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Die Funktion k\u00f6nnen wir auch \u00fcberpr\u00fcfen, indem Sie auf &#8222;<strong>Prometheus<\/strong>&#8220; klicken und im Feld &#8222;<em>Execute<\/em>&#8220; etwa folgenden Befehl eingeben:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>node_memory_MemAvailable_bytes<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Anschlie\u00dfend klicken Sie auf &#8222;<strong>Execute<\/strong>&#8222;, im Feld darunter erhalten Sie den aktuellen Wert:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-4-scaled.jpeg\" rel=\"lightbox-4\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-4-1024x640.jpeg\" alt=\"\" class=\"wp-image-14442\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-4-1024x640.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-4-1536x960.jpeg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-4-2048x1280.jpeg 2048w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-4-150x94.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-4-300x188.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-4-768x480.jpeg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Sie k\u00f6nnten jetzt in der Prometheus-Oberfl\u00e4che entsprechende Graphen einf\u00fcgen, dies ist jedoch weder bequem noch sch\u00f6n. Verbinden Sie doch die Software Grafana mit Prometheus. Doch &#8211; dazu mehr sp\u00e4ter, jetzt wollen wir einen weiteren Host einf\u00fcgen. F\u00fcr normale Betriebssysteme (<em>Linux, macOS, BSD, Windows-Zeugs und so weiter<\/em>) nutzen man sogenannte <strong>Node-Exporter<\/strong>, die man auf den entsprechenden Hosts installiert. Diese finden Sie auf <a href=\"https:\/\/github.com\/prometheus\/node_exporter\/releases\" target=\"_blank\" rel=\"noreferrer noopener\">GitHub<\/a> &#8211; laden Sie den passenden herunter. Einen Exporter f\u00fcr Windows finden Sie unter <a href=\"https:\/\/prometheus.io\/docs\/instrumenting\/exporters\/\" target=\"_blank\" rel=\"noreferrer noopener\">Prometheus-Exporter<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Unter Linux starten Sie den Exporter entweder beim Start des Systems per Script, \u00fcber <a href=\"https:\/\/linux-bibel.at\/index.php\/2023\/09\/09\/aufgaben-mit-cron-unter-linux-automatisieren\/\" data-type=\"post\" data-id=\"1662\">Cron<\/a> oder auch \u00fcber <a href=\"https:\/\/linux-bibel.at\/index.php\/2023\/09\/03\/aufgaben-mit-systemd-unter-linux-automatisch-starten-alternative-zu-cron\/\" data-type=\"post\" data-id=\"805\">Systemd<\/a>. Zum Test l\u00e4sst sich dieser nach dem Entpacken auch einfach mit dem Befehl:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/node_exporter<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">starten. Jetzt wechseln Sie wieder auf Ihren Prometheus-Server und \u00f6ffnen die Konfigurationsdatei, scrollen ganz nach unten &#8211; hier finden Sie die Zeile:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>\u00a0- <\/strong>targets: &#91;'localhost:9100']<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Hier f\u00fcgen Sie die IP-Adresse des entsprechenden Hosts ein &#8211; und den Port <strong>9100<\/strong> &#8211; dieser muss \u00fcber die Firewall freigeschaltet sein:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>\u00a0- <\/strong>targets: &#91;'localhost:9100','192.168.1.101:9100']<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Anschlie\u00dfend starten Sie Prometheus neu:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl restart prometheus.service<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Jetzt finden Sie in der Prometheus-GUI unter den &#8222;<em>Targets<\/em>&#8220; den neuen Host:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-5-scaled.jpeg\" rel=\"lightbox-5\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-5-1024x640.jpeg\" alt=\"\" class=\"wp-image-14445\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-5-1024x640.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-5-1536x960.jpeg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-5-2048x1280.jpeg 2048w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-5-150x94.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-5-300x188.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-5-768x480.jpeg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">F\u00fcr weiteres Monitoring (<em>eigentlich geht so gut wie alles<\/em>) finden Sie unter <a href=\"https:\/\/prometheus.io\/docs\/instrumenting\/exporters\/\" target=\"_blank\" rel=\"noreferrer noopener\">Prometheus-Exporter<\/a> entsprechende Exporter und die passenden Anleitungen.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Grafana als GUI f\u00fcr Prometheus<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Gleich einmal zu Beginn &#8211; die Konfiguration von Prometheus wird \u00fcber die Konfigurationsdatei gemacht &#8211; siehe Link oben, Grafana zeigt gemonitorte Werte an. Sie finden die Software unter Grafana zum Download, inklusive entsprechenden Anleitungen. Unter Debian laden Sie einfach das entsprechende Debian-Paket herunter &#8211; etwa:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wget https:\/\/dl.grafana.com\/oss\/release\/grafana_8.2.3_arm64.deb\napt install .\/grafana_8.2.3_arm64.deb<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Jetzt aktivieren und starten Sie Grafana:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl enable --now grafana-server.service<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Anschlie\u00dfend wechseln Sie im Browser auf den Host mit dem Port <strong>3000<\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-6-scaled.jpeg\" rel=\"lightbox-6\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-6-1024x640.jpeg\" alt=\"\" class=\"wp-image-14446\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-6-1024x640.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-6-1536x960.jpeg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-6-2048x1280.jpeg 2048w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-6-150x94.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-6-300x188.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-6-768x480.jpeg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Hier loggen Sie sich mit dem Benutzer <strong>admin<\/strong> und dem Passwort <strong>admin<\/strong> ein, anschlie\u00dfend werden Sie aufgefordert das Passwort zu \u00e4ndern:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-7-scaled.jpeg\" rel=\"lightbox-7\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-7-1024x640.jpeg\" alt=\"\" class=\"wp-image-14447\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-7-1024x640.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-7-1536x960.jpeg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-7-2048x1280.jpeg 2048w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-7-150x94.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-7-300x188.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-7-768x480.jpeg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Hier klicken Sie links auf das Zahnrad und w\u00e4hlen &#8222;<em>Data sources<\/em>&#8222;, klicken auf den Schalter &#8222;<strong>Add data source<\/strong>&#8222;:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-8-scaled.jpeg\" rel=\"lightbox-8\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-8-1024x640.jpeg\" alt=\"\" class=\"wp-image-14448\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-8-1024x640.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-8-1536x960.jpeg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-8-2048x1280.jpeg 2048w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-8-150x94.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-8-300x188.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-8-768x480.jpeg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Hier zeigt sich gleich einmal Prometheus, klicken Sie darauf:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-9-scaled.jpeg\" rel=\"lightbox-9\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-9-1024x640.jpeg\" alt=\"\" class=\"wp-image-14449\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-9-1024x640.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-9-1536x960.jpeg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-9-2048x1280.jpeg 2048w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-9-150x94.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-9-300x188.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-9-768x480.jpeg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Unter &#8222;<em>HTTP \u2192 URL<\/em>&#8220; geben Sie die lokale Adresse ein &#8222;<em>http:\/\/localhost:9090<\/em>&#8220; und klicken ganz unten auf &#8222;<strong>Save &amp; Test<\/strong>&#8222;. Was Sie jetzt noch ben\u00f6tigen, ist ein passendes Dashboard &#8211; k\u00f6nnte man selbst erstellen, schneller geht es nat\u00fcrlich mit vorgefertigten. Solche f\u00fcr Prometheus finden Sie unter <a href=\"https:\/\/grafana.com\/grafana\/dashboards\/?dataSource=prometheus\" target=\"_blank\" rel=\"noreferrer noopener\">Grafana Dashboards<\/a>. Ein passendes f\u00fcr alle m\u00f6glichen Hosts w\u00e4re etwa <a href=\"https:\/\/grafana.com\/grafana\/dashboards\/10242-node-exporter-full\/\" target=\"_blank\" rel=\"noreferrer noopener\">Node exporter full with node name<\/a>. Hier kopieren Sie die ID unten rechts &#8211; jetzt klicken Sie in Grafana links auf das Plus und w\u00e4hlen &#8222;<em>Import<\/em>&#8222;, f\u00fcgen die ID ein und klicken auf &#8222;<strong>Load<\/strong>&#8222;:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-10-scaled.jpeg\" rel=\"lightbox-10\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-10-1024x640.jpeg\" alt=\"\" class=\"wp-image-14450\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-10-1024x640.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-10-1536x960.jpeg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-10-2048x1280.jpeg 2048w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-10-150x94.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-10-300x188.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-10-768x480.jpeg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Unten w\u00e4hlen Sie &#8222;<em>Prometheus<\/em>&#8220; und klicken auf &#8222;<strong>Import<\/strong>&#8222;:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-11-scaled.jpeg\" rel=\"lightbox-11\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-11-1024x640.jpeg\" alt=\"\" class=\"wp-image-14451\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-11-1024x640.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-11-1536x960.jpeg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-11-2048x1280.jpeg 2048w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-11-150x94.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-11-300x188.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-11-768x480.jpeg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Schon wird der erste Host angezeigt, oben k\u00f6nnen Sie zwischen den \u00fcberwachten Hosts wechseln. Rechts oben passen Sie das Intervall f\u00fcr die automatische Aktualisierung der Anzeige an, scrollen Sie hinunter, finden Sie weitere Daten, die Sie nur ausklappen m\u00fcssen:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-12-scaled.jpeg\" rel=\"lightbox-12\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-12-1024x640.jpeg\" alt=\"\" class=\"wp-image-14452\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-12-1024x640.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-12-1536x960.jpeg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-12-2048x1280.jpeg 2048w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-12-150x94.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-12-300x188.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-12-768x480.jpeg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Es dauert ein wenig, bis sich die ganzen Ausgaben mit Daten f\u00fcllen, ist dann in Grafana aber sehr \u00fcbersichtlich &#8211; geradezu h\u00fcbsch. In Grafana finden Sie in den Einstellungen auch den Alert-Manager, \u00fcber diesen k\u00f6nnen Sie sich bei Problemen informieren lassen (<em>mehr hierzu unter <a href=\"https:\/\/grafana.com\/docs\/grafana\/latest\/alerting\/fundamentals\/alertmanager\/\" target=\"_blank\" rel=\"noreferrer noopener\">Grafana<\/a><\/em>).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Grunds\u00e4tzlich ist Prometheus ein System f\u00fcr die Echtzeit-\u00dcberwachung, gespeichert und angezeigt werden nur die letzten acht Stunden. M\u00f6chten Sie Daten \u00fcber l\u00e4ngere Zeit speichern, verbinden Sie Prometheus zus\u00e4tzlich mit einer Timescale-DB.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-13-scaled.jpeg\" rel=\"lightbox-13\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-13-1024x640.jpeg\" alt=\"\" class=\"wp-image-14453\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-13-1024x640.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-13-1536x960.jpeg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-13-2048x1280.jpeg 2048w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-13-150x94.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-13-300x188.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/prometheus-13-768x480.jpeg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Nicht nur f\u00fcr Firmen zahlt es sich aus, die laufenden Server, Ger\u00e4te und das Netzwerk zu monitoren &#8211; also zu beobachten. Wir haben auf der Linux Bibel neben vielen kleinen Tools, auch schon das gro\u00dfe Monitoring-System Zabbix kennengelernt &#8211; in diesem Beitrag geht es um das Monitoring mit Prometheus. Prometheus ist nicht so Hardware-lastig wie [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":14451,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38,72],"tags":[39,37],"class_list":["post-14434","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-netzwerk","category-sicherheit","tag-netzwerk","tag-sicherheit"],"_links":{"self":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/14434","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/comments?post=14434"}],"version-history":[{"count":1,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/14434\/revisions"}],"predecessor-version":[{"id":14454,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/14434\/revisions\/14454"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/media\/14451"}],"wp:attachment":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/media?parent=14434"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/categories?post=14434"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/tags?post=14434"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}