Schulung-Teil5-Zabbix aufsetzen: Unterschied zwischen den Versionen

Aus revampedia
 
(4 dazwischenliegende Versionen von einem anderen Benutzer werden nicht angezeigt)
Zeile 1: Zeile 1:
 +
{{#switch:{{#IfLang:}}
 +
|en=
 +
== Vorwort ==
 +
<br>
 +
This training sessioin took place on 02-02-17. If you have serveral servers it's advisable to monitor them. For that you need a [https://en.wikipedia.org/wiki/Network_management Netzwerk-Management]-Tool. In our case we chose [https://en.wikipedia.org/wiki/Zabbix Zabbix], as we're already using that on our productive server.<br>
 +
The installation requires a web server, in our case an [http://wiki.revamp-it.ch/index.php?title=Schulung-Teil3-Webserver_aufsetzen Apache] and also a [http://wiki.revamp-it.ch/index.php?title=Schulung-Teil4-Joomla_aufsetzen MySQL-database]. As the links show, they are building on our past training sessions.<br>
 +
This [https://www.zabbix.com/documentation/3.0/manual documentation] was the base for our installation. Some things are outdated that the synthax is no longer correct. We chose version 3.0, as that is the [https://en.wikipedia.org/wiki/Long-term_support LTS]-version of the program.<br>
 +
For our training purposes we created the username "zabbix" in the MySQL-database. For security purposes, you should pick a different name in a productive system.<br>
 +
<br />
 +
<pre>
 +
If there are still questions open after these instructions, please go to "Views" and then "Discussion" to leave your feedback, so I can add more Details to this page. jr
 +
</pre>
 +
<br />
 +
<br />
 +
== Installation of the program ==
 +
=== Installing the package ===
 +
As we're installing the LTS version in our training session, we have to add an additional repository in Debian Jessie. To do that we need to modify the file /etc/apt/sources.list on our virtual machine.<br />
 +
user1@vm1:~$ sudo nano /etc/apt/sources.list
 +
# jessie-backports
 +
deb    http://debian.ethz.ch/debian/    jessie-backports main contrib non-free
 +
<br />
 +
You simply copy the line under Jessie and add it a second time to the file. Then you need to change "jessie" into "jessie-backports". Alternatively you create a new file under /etc/apt/sources.list.d/ with the new repository.<br />
 +
<br />
 +
To be able to use the repository from jessie-backports, we have to update the package listin apt:
 +
user1@vm1:~$ sudo apt update
 +
<br />
 +
The following command shows us why we've added the repository from jessie-backports. The regular jessie repository only has version 2.2 and we want to use version 3.0.
 +
user1@vm1:~$ apt-cache policy zabbix-server-mysql
 +
zabbix-server-mysql:
 +
  Installed: (none)
 +
  Candidate: 1:2.2.7+dfsg-2+deb8u1
 +
  Version table:
 +
    1:3.0.7+dfsg-1~bpo8+1 0
 +
        100 http://debian.ethz.ch/debian/ jessie-backports/main amd64 Packages
 +
    1:2.2.7+dfsg-2+deb8u1 0
 +
        500 http://debian.ethz.ch/debian/ jessie/main amd64 Packages
 +
<br />
 +
To be able to install the desired version of the program, we need to set the parameter "-t jessie-backports":<br />
 +
user1@vm1:~$ sudo apt -t jessie-backports install zabbix-server-mysql zabbix-frontend-php
 +
<br />
 +
=== Configuration in the CLI ===
 +
Our next step is to activate the configuration of zabbix-frontend-php on our apache2 server. To do this, we enter the following command:
 +
<br />
 +
user1@vm1:~$ sudo a2enconf zabbix-frontend-php
 +
<br />
 +
If we would restart the web server now, we could access the configuration of our new program under http://"VM-IP-address"/zabbix, but we're still missing some steps to be able to do that.<br />
 +
There are two options to restart the web server:
 +
user1@vm1:/etc/apache2/conf-available$ sudo apache2ctl restart
 +
user1@vm1:~$ sudo systemctl restart apache2
 +
The difference between the two commands is that [https://httpd.apache.org/docs/2.4/programs/apachectl.html apache2ctl] also checks the configuration files of the web server.
 +
<br />
 +
First we go to the directory /etc/, where configurations files are stored in linux.<br />
 +
<br />
 +
user1@vm1:~$ cd /etc/
 +
<br />
 +
Next we search for "date.timezone" in this directory and it's subdirectories. We also tell the search to ignore lower and upper case writing<br />
 +
<br />
 +
user1@vm1:/etc$ grep -ri 'date.timezone'
 +
<br />
 +
The file we're looking for is in /etc/apache2/conf-available/, so we change to that directory and make a copy of the file:<br />
 +
<br />
 +
user1@vm1:/etc/apache2/conf-available$ sudo cp zabbix-frontend-php.conf zabbix-frontend-php.conf_2017-03-02
 +
<br />
 +
Next we edit the file:
 +
<br />
 +
user1@vm1:/etc/apache2/conf-available$ sudo nano zabbix-frontend-php.conf
 +
        php_value date.timezone Europe/Zurich
 +
<br />
 +
 +
=== Add user to MySQL database and create a new database ===
 +
 +
Fortunately we can copy most of it from the documentation of Zabbix that we don't need to know the commands in advance. For a [https://dev.mysql.com/doc/refman/5.7/en/mysql-commands.html list] of MySQL commands you best visit the link. We learned in the training session that MySQL commands need to be finished with a ";". Otherwise the database doesn't know that the command has ended.<br>
 +
So, first we login to the database. We've installed [http://wiki.revamp-it.ch/index.php?title=Schulung-Teil4-Joomla_aufsetzen MySQL] in a previous training session.<br />
 +
user1@vm1:~$ mysql -uroot -p*****
 +
<br />
 +
With the first line we create a new database and tell it that we wish to use the [https://en.wikipedia.org/wiki/UTF-8 UTF-8]-character encoding.
 +
<br />
 +
mysql> create database zabbix character set utf8 collate utf8_bin;
 +
<br />
 +
With the second command we give the user "zabbix" all rights to the database "zabbix" with the password "*****" (pick your own password here)
 +
<br />
 +
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '*****';
 +
<br />
 +
To leave the MySQL database we type "quit". This command would also work without the ";".
 +
<br />
 +
mysql> quit;
 +
<br />
 +
Now we need to give our database a schema and the first set of data. As the documentation is outdated, the file /usr/share/doc/zabbix-server-mysql/README.Debian tells us the correct synthax:
 +
<br />
 +
<pre>
 +
zcat /usr/share/zabbix-server-mysql/{schema,images,data}.sql.gz    | mysql -uzabbix -p***** zabbix
 +
</pre>
 +
<br />
 +
=== Configure Zabbix to interact with the MySQL database and what username it should use ===
 +
First we make a copy of the configuration file:
 +
<br />
 +
user1@vm1:~$ sudo cp /etc/zabbix/zabbix_server.conf /etc/zabbix/zabbix_server.conf_2017-03-02
 +
<br />
 +
Next we edit it. Sometimes the # at the beginning of the line needs to be removed.
 +
<br />
 +
user1@vm1:~$ sudo nano /etc/zabbix/zabbix_server.conf
 +
DBHost=localhost
 +
DBName=zabbix
 +
DBUser=zabbix
 +
DBPassword=<*****>
 +
<br />
 +
Now we start the service, so that our data will be logged:
 +
<br />
 +
user1@vm1:/etc/zabbix$ sudo systemctl start zabbix-server
 +
<br />
 +
If you want this service to automatically start when the server boots, you also have to enter the following command:
 +
<br />
 +
user1@vm1:/etc/zabbix$ sudo systemctl enable zabbix-server
 +
<br />
 +
 +
== Configure frontend in the browser ==
 +
 +
Now that we've prepared everything in the CLI we can go and configure the frontend of Zabbix. Also im Browser auf http://"VM-IP-address"/zabbix. The summary at the end looked like this for me:<br />
 +
<pre>
 +
Database type      MySQL
 +
Database server    localhost
 +
Database port      default
 +
Database name      zabbix
 +
Database user      zabbix
 +
Database password  *****
 +
   
 +
Zabbix server      localhost
 +
Zabbix server port  10051
 +
Zabbix server name  juerg-zabbix
 +
</pre>
 +
<br />
 +
When you finish in the browser, you will receive an error. It's missing a file on the server that it won't have the premission to create. You get the option to download the file an open it in an editor (geany in our case). The content of the file now needs to be entered into an empty file. It is possible that you'll get another error if there is an empty line at the end of the file. So far I haven't been able to get rid of an empty line at the end of the document in the editor nano. To solve this issue, you best use the editor vim. With "Shift+g" you go to the end of the file and with "dd" you delete that empty line. With ":wq" you save the file and exit the editor. This is how the file looked for me in the end. For each installation, the file will look a bit different.<br />
 +
<br />
 +
<pre>
 +
user1@vm1:/etc/zabbix$ sudo nano /etc/zabbix/zabbix.conf.php
 +
<?php
 +
// Zabbix GUI configuration file.
 +
global $DB;
 +
 +
$DB['TYPE']    = 'MYSQL';
 +
$DB['SERVER']  = 'localhost';
 +
$DB['PORT']    = '0';
 +
$DB['DATABASE'] = 'zabbix';
 +
$DB['USER']    = 'zabbix';
 +
$DB['PASSWORD'] = '*****';
 +
 +
// Schema name. Used for IBM DB2 and PostgreSQL.
 +
$DB['SCHEMA'] = '';
 +
 +
$ZBX_SERVER      = 'localhost';
 +
$ZBX_SERVER_PORT = '10051';
 +
$ZBX_SERVER_NAME = 'juerg-zabbix';
 +
 +
$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
 +
</pre>
 +
<br />
 +
If the file was added correctly you get the login mask of Zabbix under http://"VM-IP-address"/zabbix. The username is "Admin" and the password "zabbix".<br />
 +
So far, only the virtual machine that has the Zabbix installed will show up here. To see what machines are monitored or to add a new one we go to "Configuration" and then "Hosts".<br />
 +
<br />
 +
<br />
 +
== Monitor an additional server ==
 +
 +
In our training session we take the physical server as an additional host. For that we need to install the client program of Zabbix.In unserem Beispiel nehmen wir den physischen Server als zusätzlichen Host im Zabbix auf. Dazu braucht es auf dem Server das "Client-Programm" von Zabbix. We didn't add the jessie-backports repository to the server so far, but that isn't necessary, as also an older version of the client program can communicate with the server.<br />
 +
To make sure that the client program is available we enter the following command:<br />
 +
<br />
 +
user1@server1:~$ sudo apt-cache policy zabbix-agent
 +
<br />
 +
To install the package we need to enter the next command:<br />
 +
user1@server1:~$ sudo apt install zabbix-agent
 +
<br />
 +
After the installation we go to the configuration folder of the Zabbix client and create a copy of the configuration file:
 +
<br />
 +
user1@server1:~$ cd /etc/zabbix/
 +
user1@server1:/etc/zabbix$ sudo cp zabbix_agentd.conf zabbix_agentd.conf_2017-03-02
 +
<br />
 +
Now we have to edit the configuration file and change a few things:
 +
<br />
 +
user1@server1:/etc/zabbix$ sudo nano zabbix_agentd.conf
 +
Server="Zabbix-Server-IP"
 +
ServerActive="Zabbix-Server-IP"
 +
#Hostname=Zabbix server
 +
HostnameItem=system.hostname
 +
<br />
 +
As we've made modifications to the configuration file we need to restart the service of the Zabbix client. The second line shows us the status of the service.
 +
<br />
 +
user1@server1:/etc/zabbix$ sudo systemctl restart zabbix-agent
 +
user1@server1:/etc/zabbix$ sudo systemctl status zabbix-agent
 +
<br />
 +
<br />
 +
In the frontend of Zabbix we can now add the new machine under "Configuration" and then "Hosts" so we monitor this machine as well.
 +
 +
|#default=
 +
 
== Vorwort ==
 
== Vorwort ==
 
<br>
 
<br>
Zeile 88: Zeile 281:
 
Nun müssen wir unserer neuen Datenbank auch ein Anfangs-Schema geben und die ersten Daten. Die Dokumentation auf der Zabbix-Webseite veraltet ist verrät uns die Datei unter /usr/share/doc/zabbix-server-mysql/README.Debian wie der korrekte Befehl lautet:
 
Nun müssen wir unserer neuen Datenbank auch ein Anfangs-Schema geben und die ersten Daten. Die Dokumentation auf der Zabbix-Webseite veraltet ist verrät uns die Datei unter /usr/share/doc/zabbix-server-mysql/README.Debian wie der korrekte Befehl lautet:
 
<br />
 
<br />
zcat /usr/share/zabbix-server-mysql/{schema,images,data}.sql.gz    | mysql -uzabbix -p***** zabbix
+
<pre>
<br />
+
zcat /usr/share/zabbix-server-mysql/{schema,images,data}.sql.gz    | mysql -uzabbix -p***** zabbix
 +
</pre><br />
 
=== Zabbix die MySQL-Datenbank und Logindaten beibringen ===
 
=== Zabbix die MySQL-Datenbank und Logindaten beibringen ===
 
Als erstes machen wir erst wieder eine Kopie der Konfigurationsdatei:
 
Als erstes machen wir erst wieder eine Kopie der Konfigurationsdatei:
Zeile 159: Zeile 353:
 
== Weiteren Server überwachen ==  
 
== Weiteren Server überwachen ==  
  
In unserem Beispiel nehmen wir den physischen Server als zusätzlichen Host im Zabbix auf. Dazu braucht es auf dem Server das "Client-Programm" von Zabbix. Dem Server haben wir bisland das jessie-backports Repository bisher nicht beigebracht, doch das ist auch nicht erforderlich, da auch ältere Client-Versionen mit dem Server kommunizieren können.<br />
+
In unserem Beispiel nehmen wir den physischen Server als zusätzlichen Host im Zabbix auf. Dazu braucht es auf dem Server das "Client-Programm" von Zabbix. Dem Server haben wir bislang das jessie-backports Repository bisher nicht beigebracht, doch das ist auch nicht erforderlich, da auch ältere Client-Versionen mit dem Server kommunizieren können.<br />
 
Zum Sicherstellen, dass es das Client-Programm gibt kann man in der Konsole als erstes das folgende eingeben:<br />  
 
Zum Sicherstellen, dass es das Client-Programm gibt kann man in der Konsole als erstes das folgende eingeben:<br />  
 
<br />
 
<br />
Zeile 188: Zeile 382:
 
Im Frontend von Zabbix können wir nun die neue Maschine unter "Configuration" und dann "Hosts" erstellen, dass auch dieser überwacht wird.
 
Im Frontend von Zabbix können wir nun die neue Maschine unter "Configuration" und dann "Hosts" erstellen, dass auch dieser überwacht wird.
  
[[Kategorie:Schulungen_/_Workshops]]
+
}}
 +
 
 +
[[Kategorie:Schulungen_/_Workshops]],[[Kategorie:Server-Schulung]]

Aktuelle Version vom 24. April 2017, 01:31 Uhr

Vorwort


Diese Schulung hat am 02.02.2017 stattgefunden. Wenn man mehrere Server am Laufen hat, macht es Sinn, dass man diese Überwachen kann. Dazu benötigt man ein Netzwerk-Monitoring-Tool. In unserem Fall wählen wir [1], da dies auch schon für unsere produktiven Server im Einsatz ist.
Die Installation benötigt ebenfalls einen Webserver, in unserem Fall ein Apache, sowie eine MySQL-Datenbank. Wie die Links zeigen, haben wir dies in vergangenen Schulungen bereits gemacht.
Zur Installation hat uns die Dokumentation als Grundlage gedient. Einige Dinge darin sind mittlerweile veraltet, dass die Synthax nicht mehr so ist wie es dort geschrieben ist. Es wurde Version 3.0 gewählt, da es sich dabei um die LTS-Version handelt.
Für die Schulung wurde die MySQL-Datenbank und auch der Benutzername in MySQL für Zabbix auf "zabbix" gsetzt. Sicherheitstechnisch sollte man auf einem produktiven Server andere Namen wählen.

Falls noch Fragen offen sind nach dieser Anleitung bitte oben bei "Ansichten" auf "Diskussion" gehen und Feedback hinterlassen, dass ich noch weitere Details hinzufügen kann. jr



Installation des Programms

Packetinstallation

Da wir wie bereits erwähnt die LTS Version installieren wollen, müssen wir unter Debian Jessie noch ein weiteres Repository hinzufügen. Dazu gehen wir auf unserer virtuellen Maschine in der Konsole die Datei /etc/apt/sources.list anpassen.

user1@vm1:~$ sudo nano /etc/apt/sources.list
# jessie-backports
deb     http://debian.ethz.ch/debian/     jessie-backports main contrib non-free


Man kopiert einfach die Zeile von Jessie und fügt sie ein zweites Mal ein. Dann muss man einfach noch "jessie" auf "jessie-backports" anpassen. Alternativ kann man sich eine neue Datei unter /etc/apt/sources.list.d/ erstellen.

Dass wir das jessie-backports Repository auch nutzen können müssen wir die Liste der möglichen Packete in apt aktualisieren:

user1@vm1:~$ sudo apt update


Der folgende Befehl zeigt uns warum wir das jessie-backports Repository hinzugefügt haben. Im normalen jessie gibt es nur die Version 2.2 und wir wollen ja die Version 3.0.

user1@vm1:~$ apt-cache policy zabbix-server-mysql
zabbix-server-mysql:
 Installed: (none)
 Candidate: 1:2.2.7+dfsg-2+deb8u1
 Version table:
    1:3.0.7+dfsg-1~bpo8+1 0
       100 http://debian.ethz.ch/debian/ jessie-backports/main amd64 Packages
    1:2.2.7+dfsg-2+deb8u1 0
       500 http://debian.ethz.ch/debian/ jessie/main amd64 Packages


Um jetzt beim Installieren zu sagen, dass wir die Version aus jessie-backports wollen geben wir dies mit dem Parameter "-t jessie-backports" an:

user1@vm1:~$ sudo apt -t jessie-backports install zabbix-server-mysql zabbix-frontend-php


Konfiguration in Konsole

Als nächstes müssen wir die Konfiguration von zabbix-frontend-php auf dem Apache2-Server aktivieren. Dies machen wir über den folgenden Befehl:

user1@vm1:~$ sudo a2enconf zabbix-frontend-php


Wenn wir jetzt den Apache2-Server neu starten können wir unter http://"VM-IP-Adresse"/zabbix gehen um das Programm zu konfigurieren. Jedoch sind noch weitere Schritte notwendig, dass wir die Konfiguration komplett durchführen können.
Es gibt zwei Möglichkeiten, die mir bekannt sind, um den Webserver neu zu starten:

user1@vm1:/etc/apache2/conf-available$ sudo apache2ctl restart
user1@vm1:~$ sudo systemctl restart apache2

Die beiden Befehle starten den Webserver neu, doch bei apache2ctl wird zusätzlich noch die Konfiguration überprüft.
Als erstes gehen wir in den Ordner /etc/, wo Linux die Konfigurationsdateien von Programmen hat.

user1@vm1:~$ cd /etc/


Anschliessend suchen wir nach "date.timezone" in dem Ordner sowie auch den Unterordnern. Zudem setzen wir den Parameter, dass Gross-/Kleinschreibung ignoriert werden soll.

user1@vm1:/etc$ grep -ri 'date.timezone'


Unsere gesuchte Datei befindet sich im Ordner /etc/apache2/conf-available/, also wechseln wir dahin und machen als erstes eine Kopie von der Datei:

user1@vm1:/etc/apache2/conf-available$ sudo cp zabbix-frontend-php.conf zabbix-frontend-php.conf_2017-03-02


Nun können wir die Datei editieren gehen:

user1@vm1:/etc/apache2/conf-available$ sudo nano zabbix-frontend-php.conf
       php_value date.timezone Europe/Zurich


Wenn wir den Webserver neu starten würden könnten wir unter http://"VM-IP-Adresse"/zabbix eine Seite weiter kommen, doch wir müssen vorher noch weitere Dinge machen, dass wir die Konfiguration fertigstellen können.

Zabbix-Benutzer in der MySQL-Datenbank und neue MySQL-Datenbank erstellen

Glücklicherweise dürfen wir das meiste aus der Dokumentation von Zabbix kopieren, dass wir die Befehle nicht selber kennen müssen. Für eine Liste besucht man besser einen anderen Ort. Uns wurde an der Schulung begebracht, dass in MySQL Befehle mit einem ";" abgeschlossen werden, dass die Datenbank weiss, dass der Befehl zu Ende ist.
Also erst mal in die Datenbank einloggen. Wir haben ja beim Aufsetzen von Joomla eine MySQL-Datenbank erstellt.

user1@vm1:~$ mysql -uroot -p*****


Mit der ersten Zeile erstellen wir eine neue Datenbank mit dem Namen "zabbix" und sagen der Datenbank, dass wir den UTF-8-Zeichensatz nutzen wollen.

mysql> create database zabbix character set utf8 collate utf8_bin;


Mit dem zweiten Befehl geben wir in der Datenbank "zabbix" dem Benutzer "zabbix" alle Rechte mit dem Passwort "*****" (selber ein Passwort wählen)

mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '*****';


Um die MySQL-Datenbank zu verlassen geben wir "quit" ein. Dieser Befehl würde auch ohne ";" funktionieren.

mysql> quit;


Nun müssen wir unserer neuen Datenbank auch ein Anfangs-Schema geben und die ersten Daten. Die Dokumentation auf der Zabbix-Webseite veraltet ist verrät uns die Datei unter /usr/share/doc/zabbix-server-mysql/README.Debian wie der korrekte Befehl lautet:

zcat /usr/share/zabbix-server-mysql/{schema,images,data}.sql.gz    | mysql -uzabbix -p***** zabbix


Zabbix die MySQL-Datenbank und Logindaten beibringen

Als erstes machen wir erst wieder eine Kopie der Konfigurationsdatei:

user1@vm1:~$ sudo cp /etc/zabbix/zabbix_server.conf /etc/zabbix/zabbix_server.conf_2017-03-02


Dann editieren wir die Konfigurationsdatei. Teilweise muss man noch das # am Beginn der Zeile entfernen.

user1@vm1:~$ sudo nano /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=<*****>


Zum Schluss schalten wie noch den Dienst ein, dass die Daten erfasst werden:

user1@vm1:/etc/zabbix$ sudo systemctl start zabbix-server


Falls der Dienst auch nach einem Neustart vom Server wieder aktiv sein soll braucht es noch den folgenden Befehl:

user1@vm1:/etc/zabbix$ sudo systemctl enable zabbix-server


Frontend im Browser konfigurieren

Jetzt haben wir in der Konsole alles vorbereitet, dass wir die Frontend-Komponente vom Zabbix konfigurieren können. Also im Browser auf http://"VM-IP-Adresse"/zabbix. Am Schluss sah die Zusammenfassung bei mir dann so aus:

 Database type       MySQL
 Database server     localhost
 Database port       default
 Database name       zabbix
 Database user       zabbix
 Database password   *****
     
 Zabbix server       localhost
 Zabbix server port  10051
 Zabbix server name  juerg-zabbix


Beim Abschliessen wird es jedoch einen Fehler geben, da es eine Datei nicht auf dem Server schreiben kann. Man hat die Option diese Datei runterzuladen und anschliessend in einem Editor (in unserem Fall war es Geany) zu öffnen. Den Inhalt dieser Datei müssen wir jetzt auf der Konsole in diese noch leere Datei einfügen. Es kann zu Fehlern kommen, wenn am Ende der Datei noch eine extra leere Zeile ist. In "nano" habe ich es bislang noch nicht geschafft eine leere Zeile am Schluss zu entfernen, doch in "vim" geht das ohne Probleme ("Shift+g" um ans Ende der Datei zu kommen und dann mit "dd" die leere Zeile löschen. Mit ":wq" speichern und verlassen). Im folgenden sieht man wie die Datei bei mir aussah. Eine neue Installlation wird bei jedem ein wenig anders aussehen.

 user1@vm1:/etc/zabbix$ sudo nano /etc/zabbix/zabbix.conf.php
 <?php
 // Zabbix GUI configuration file.
 global $DB;

 $DB['TYPE']     = 'MYSQL';
 $DB['SERVER']   = 'localhost';
 $DB['PORT']     = '0';
 $DB['DATABASE'] = 'zabbix';
 $DB['USER']     = 'zabbix';
 $DB['PASSWORD'] = '*****';

 // Schema name. Used for IBM DB2 and PostgreSQL.
 $DB['SCHEMA'] = '';

 $ZBX_SERVER      = 'localhost';
 $ZBX_SERVER_PORT = '10051';
 $ZBX_SERVER_NAME = 'juerg-zabbix';

 $IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;


Hat man die Datei korrekt eingefügt kriegt man jetzt unter http://"VM-IP-Adresse"/zabbix die Loginmaske vom Zabbix. Der Benutzername ist "Admin" und Passwort "zabbix".
Im Frontend haben wir bislang nur unsere virtuelle Maschine eingetragen. Um unsere Maschine zu sehen und neue hinzuzufügen gehen wir zu "Configuration" und dann "Hosts".


Weiteren Server überwachen

In unserem Beispiel nehmen wir den physischen Server als zusätzlichen Host im Zabbix auf. Dazu braucht es auf dem Server das "Client-Programm" von Zabbix. Dem Server haben wir bislang das jessie-backports Repository bisher nicht beigebracht, doch das ist auch nicht erforderlich, da auch ältere Client-Versionen mit dem Server kommunizieren können.
Zum Sicherstellen, dass es das Client-Programm gibt kann man in der Konsole als erstes das folgende eingeben:

user1@server1:~$ sudo apt-cache policy zabbix-agent


Zur Installlation des Packets nutzen wir den folgenden Befehl:

user1@server1:~$ sudo apt install zabbix-agent


Nach der Installation gehen wir in den Konfigurationsordner vom Zabbix-Client und erstellen uns ein Backup der Konfigurationsdatei:

user1@server1:~$ cd /etc/zabbix/
user1@server1:/etc/zabbix$ sudo cp zabbix_agentd.conf zabbix_agentd.conf_2017-03-02


Jetzt gehen wir die Konfigurationsdatei editieren und müssen einige Angaben anpassen:

user1@server1:/etc/zabbix$ sudo nano zabbix_agentd.conf
Server="Zabbix-Server-IP" 
ServerActive="Zabbix-Server-IP"
#Hostname=Zabbix server
HostnameItem=system.hostname


Da wir die Konfigurationsdatei geändert haben müssen wir den Dienst vom Zabbix-Client neu starten. Die zweite Zeile zeigt uns den Status des Dienstes.

user1@server1:/etc/zabbix$ sudo systemctl restart zabbix-agent
user1@server1:/etc/zabbix$ sudo systemctl status zabbix-agent



Im Frontend von Zabbix können wir nun die neue Maschine unter "Configuration" und dann "Hosts" erstellen, dass auch dieser überwacht wird.,