LoginSignup
2
1

More than 5 years have passed since last update.

AnsibleでZabbixエージェントをインストールする

Posted at

AnsibleでCentOSまたはUbuntuにZabbixエージェントをインストールする手順です。

Ansible Roleの取得

requirements.ymlに以下を追加します。

requirements.yml
- src: shomatan.zabbix-agent

ansible-galaxyコマンドでRoleを取得します。

ansible-galaxy install -p roles -r requirements.yml

設定項目一覧

キー デフォルト値 説明
zabbix_agent_version 3.2 Zabbixエージェントのバージョン
zabbix_agent_server_host 127.0.0.1 Zabbixサーバとアクティブチェック用サーバのホストまたはIPアドレス。
zabbix_agent_ListenPort 10050 サーバからの接続をリッスンするポート番号
zabbix_agent_ListenIP 0.0.0.0 エージェントがリッスンする必要のあるカンマで区切られたIPアドレスのリスト
zabbix_agent_Hostname "{{ ansible_fqdn }}" 一意で、大文字小文字を区別するホスト名。アクティブチェックに必要
zabbix_agent_LogFile /var/log/zabbix/zabbix_agentd.log ログファイルのパス

Inventoryファイルの作成

inventory.ymlを以下の内容で作成します。zabbix.agent.host部分をインストール対象のサーバに変更します。

inventory.yml
all:
  hosts:
    zabbix.agent.host:

Playbookの作成

install.ymlを以下の内容で作成します。zabbix.server.host部分をZabbixサーバのホスト名に変更します。

install.yml
- hosts: all
  become: true
  roles:
    - shomatan.zabbix-agent
  vars:
    zabbix_agent_server_host: zabbix.server.host

Playbookの実行

ansible-playbook -i inventory.yml install.yml

Firewallの設定

zabbix_agent_ListenPortで指定したポートをOpenします。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1