ZABBIX 3.2 Agent コンパイルインストール手順(CentOS7 + Raspberry Pi3)
http://extstrg.asabiya.net/pukiwiki/index.php?ZABBIX%203.2%20Agent%20%A5%B3%A5%F3%A5%D1%A5%A4%A5%EB%A5%A4%A5%F3%A5%B9%A5%C8%A1%BC%A5%EB%BC%EA%BD%E7%A1%CACentOS7%20%2B%20Raspberry%20Pi3%A1%CB目次
概要 †
前提 †
Raspberry Pi 3(ARMv7)向けのZabbix Agentはパッケージが存在しない(2016.12現在)kことから、ソースコードよりコンパイルしてインストールを行う。
環境 †
Hardware | Raspberry Pi 3 Model B |
CPU | ARMv7 Processor rev 4 (v7l) |
OS | CentOS Linux release 7.2.1511 (Core) |
ZABBIX | zabbix-3.2.2 |
導入手順 †
環境準備 †
初期状態ではコンパイラが含まれていないため、gccのパッケージを導入する。
yum install gcc
================================================================================================================== Package Arch Version Repository Size ================================================================================================================== Installing: gcc armv7hl 4.8.5-11.el7 base 12 M Installing for dependencies: cpp armv7hl 4.8.5-11.el7 base 4.3 M libatomic armv7hl 4.8.5-11.el7 base 43 k libgomp armv7hl 4.8.5-11.el7 base 149 k libmpc armv7hl 1.0.1-3.el7 base 42 k mpfr armv7hl 3.1.1-4.el7 base 189 k Updating for dependencies: libgcc armv7hl 4.8.5-11.el7 base 96 k Transaction Summary ================================================================================================================== Install 1 Package (+5 Dependent packages) Upgrade ( 1 Dependent package)
ユーザ作成 †
エージェントプログラムを稼動させる専用のユーザを作成する。
groupadd -g 300 zabbix useradd -u 300 -g zabbix -d /var/empty -s /sbin/nologin zabbix
ディレクトリ作成 †
デーモンを動作させる上で必要なディレクトリを作成する。
mkdir /etc/zabbix mkdir /var/run/zabbix mkdir /var/log/zabbix touch /var/log/zabbix/zabbix_agent.log chown -fR zabbix.zabbix /var/run/zabbix chown -fR zabbix.zabbix /var/log/zabbix
コンパイル †
Zabbixのソースコードは、configure内にエージェントのソースコードも格納されているため、これをコンパイルして使用する。
tar xfvz zabbix-3.2.2.tar.gz cd zabbix-3.2.2
configureオプションでエージェントのコンパイルのみを指定する。
./configure --enable-agent make make install
設定ファイルを所定位置に配置する
cd /usr/local/src/zabbix cp ./misc/conf/zabbix_agentd.conf /etc/zabbix/
サービス登録 †
systemd向けの設定は同梱されていないため、手動で作成する。
cat <<EOF > /usr/lib/systemd/system/zabbix-agent.service [Unit] Description=Zabbix Agentd After=network.target [Service] Type=oneshot ExecStart=/usr/local/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf PIDFile=/var/run/zabbix/zabbix_agentd.pid RemainAfterExit=yes [Install] WantedBy=multi-user.target EOF
自動起動を設定。
systemctl enable zabbix-agent.service
起動 †
エージェントを起動する。
systemctl start zabbix-agent.service systemctl status zabbix-agent.service
参考 †
エラー †
configure実行時に以下のエラーが出る場合、gccが導入されていない。
yumでgccのパッケージをインストールする。
# ./configure --enable-agent checking for a BSD-compatible install... /bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes configure: Configuring Zabbix 3.2.2 checking whether make sets $(MAKE)... (cached) yes checking build system type... armv7l-unknown-linux-gnueabihf checking host system type... armv7l-unknown-linux-gnueabihf checking for gcc... no checking for cc... no checking for cl.exe... no configure: error: in `/usr/local/src/zabbix-3.2.2': configure: error: no acceptable C compiler found in $PATH See `config.log' for more details
Last-modified: 2016-12-25 (日) 21:35:08 (2672d)