SYSTEM NOTICE

Auto translation by AI. Be sure, accuracy, nuances and authorial intent may not be fully reflected.
見出し画像

Trying out ZABBIX Part 3

Good evening, this is Cardy.
I might be using ZABBIX at work, so I decided to try it out personally as well, and I plan to write about ZABBIX on my blog for a while.
It is planned to be an 8-part series.

STEP 1: Installing ZABBIX AGENT
STEP 2: Configuring ZABBIX AGENT
STEP 3: Setting up ZABBIX Server with Docker ← This article is here
STEP 4: Server configuration
STEP 5: Monitoring the moment monitoring begins
STEP 6: Defining triggers
STEP 7: Alert settings & notifications
STEP 8: Summary?


Checking Docker

This time, the Zabbix server will run inside Docker. Therefore, first, I will check if Docker is installed.
I will run the following command in the command prompt.

docker compose version

If the version information is displayed like this, it is installed.

If it is not installed, you will need to install Docker.Herecontains the procedures and such, so please refer to it.

Creating a YAML file

Paste the following code into Notepad to create "docker-compose.yml".
It can be anywhere, but C:\temp should be fine.

version: '3.8'

services:
  mysql:
    image: mysql:8.0
    command:
      - --log-bin-trust-function-creators=1
    environment:
      MYSQL_DATABASE: zabbix
      MYSQL_USER: zabbix
      MYSQL_PASSWORD: zabbix
      MYSQL_ROOT_PASSWORD: root
    volumes:
      - mysql_data:/var/lib/mysql

  zabbix-server:
    image: zabbix/zabbix-server-mysql:latest
    environment:
      DB_SERVER_HOST: mysql
      MYSQL_DATABASE: zabbix
      MYSQL_USER: zabbix
      MYSQL_PASSWORD: zabbix
    depends_on:
      - mysql
    ports:
      - "10051:10051"

  zabbix-web:
    image: zabbix/zabbix-web-nginx-mysql:latest
    environment:
      DB_SERVER_HOST: mysql
      MYSQL_DATABASE: zabbix
      MYSQL_USER: zabbix
      MYSQL_PASSWORD: zabbix
      ZBX_SERVER_HOST: zabbix-server
      PHP_TZ: Asia/Tokyo
    depends_on:
      - mysql
      - zabbix-server
    ports:
      - "8080:8080"

volumes:
  mysql_data:

Use the YAML file you just created to start the container.

docker compose up -d

Once it starts running, it will look something like this. Depending on your PC's specs, I think it will finish in about 5 minutes.

When it finishes, it will look like this.

docker ps

It seems that having three tasks start up here is the correct result.

  • zabbix-web

  • zabbix-server

  • mysql

However, in my environment, it looks like this...

Four tasks have started up, but since the bottom one is a container for Re:View, all the tasks are effectively running.

Checking the logs

Once the Zabbix server starts running, it begins collecting logs.
If you execute the following command, you can see the logs that Zabbix has started collecting.

docker compose logs -f zabbix-server

There is an error

The last three lines of the log above indicate errors.

cannot send list of active checks to "172.18.0.1": host [TOTTENHAM] not found

This is because while my device's IP is 192.168.11.47, it seems to be registered as 172.18.0.1 on Zabbix.

This is changed in the Zabbix server settings, but that will be for next time.

Status of what we have achieved so far

✅ Understood and operated the Zabbix "three-piece configuration"
✅ Created a "reproducible monitoring infrastructure" using Docker Compose
✅ Became able to read the Zabbix Server "startup log"

That is all for this article.
Next time, we will cover STEP 4, "Server Settings." We will also address the error mentioned above then. 🙌


いいなと思ったら応援しよう!

かーでぃ / KAMADA Makoto 「いいね」以上、「スポンサー」未満の気持ちで、 もしよければ応援してもらえると嬉しいです。 いただいたチップは、次の記事を書くためのコーヒーと時間に変わります☕