目次~
#Contents
*概要 [#f0caed9a]
**前提 [#fdd6a5e9]
Raspberry Pi 3(ARMv7)向けのZabbix Agentはパッケージが存在しない(2016.12現在)kことから、ソースコードよりコンパイルしてインストールを行う。~

**環境 [#d91ab439]
|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|


*導入手順 [#vdba311d]
**環境準備 [#r2b518f2]
初期状態ではコンパイラが含まれていないため、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)


**ユーザ作成 [#d211f429]
エージェントプログラムを稼動させる専用のユーザを作成する。

 groupadd -g 300 zabbix
 useradd -u 300 -g zabbix -d /var/empty -s /sbin/nologin zabbix

**ディレクトリ作成 [#y4589b3e]
デーモンを動作させる上で必要なディレクトリを作成する。

 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

**コンパイル [#k1af3a09]
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/

設定ファイルを環境に合わせて変更する。
**サービス登録 [#jf01f674]
systemd向けの設定は同梱されていないため、手動で作成する。

-''設定例''
 Server=192.168.1.200
 Hostname=ZABBIX-Server
 StartAgents=3
 RefreshActiveChecks=60
 #DisableActive=1
 #DisablePassive=1
 EnableRemoteCommands=1
 DebugLevel=3
 PidFile=/var/tmp/zabbix_agentd.pid
 LogFile=/tmp/zabbix_agentd.log
 LogFileSize=10
 Timeout=3
 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

各設定項目の意味は以下となる。
自動起動を設定。

-''Server''~
ZabbixサーバのIPアドレス~
 systemctl enable zabbix-agent.service

-''Hostname''~
監視対象サーバのホスト名~

-''StartAgents''~
待ちうけするエージェントのプロセス数を指定。(初期値:3)~監視項目が多数になり、応答に遅延が発生した場合は数を増やすことが可能。(ただし、リソースの消費は増える)~

-''RefreshActiveChecks''~
アクティブチェックの実行頻度を秒で指定。(初期値:120)~

-''DisableActive''~
アクティブチェックの使用有無。(アクティブチェックを使用する場合はコメントアウトする)~

-''DisablePassive''~
パッシブチェックの使用有無。(パッシブチェックを使用する場合はコメントアウトする)~

-''EnableRemoteCommands''~
リモートコマンドの使用有無。(1 = 有効 / 0 = 無効)~

-''DebugLevel''~
ログの出力レベル設定。通常は3。通信不具合などが発生した場合は4(=debug)に設定することで詳細な情報を得ることが出来る。~

-''PidFile''~
PIDファイル保管場所/ファイル名~

-''LogFile''~
エージェントの動作ログファイル保管場所/ファイル名~

-''LogFileSize''~
エージェントの動作ログの上限サイズをMBで指定。(初期値:1)~

-''Timeout''~
通信のタイムアウトを設定。(初期値:3)~

**自動起動設定 [#j767271f]
ソースコードに含まれる起動スクリプトを修正した上で所定位置に配置する。

 cd /usr/local/src/zabbix
 cp ./misc/init.d/fedora/core/zabbix_agentd /etc/init.d/ 
 chmod 755 /etc/init.d/zabbix_agentd
 cd /etc/rc.d/rc3.d
 ln -s ../init.d/zabbix_agentd S99Zabbix_Agentd
 cd ../rc5.d
 ln -s ../init.d/zabbix_agentd S99Zabbix_Agentd

スクリプトのパラメータ設定を行う。

 vi /etc/init.d/zabbix_agentd

 BASEDIR=/usr/local
 FULLPATH=$BASEDIR/sbin/$BINARY_NAME
 PIDFILE=/var/run/zabbix/$BINARY_NAME.pid

**起動 [#a1221e20]
以下にてZABBIXエージェントを起動する
エージェントを起動する。

 /etc/init.d/zabbix_agentd start
 systemctl start zabbix-agent.service
 systemctl status zabbix-agent.service

正常に起動すると以下のプロセスが常駐する。

 zabbix    3296  0.0  0.0  3452  484 ?        SN   23:46   0:00 /usr/local/sbin/zabbix_agentd
 zabbix    3297  0.0  0.2  3452 1032 ?        SN   23:46   0:00  \_ /usr/local/sbin/zabbix_agentd
 zabbix    3298  0.0  0.0  3456  372 ?        SN   23:46   0:00  \_ /usr/local/sbin/zabbix_agentd
 zabbix    3299  0.0  0.0  3456  372 ?        SN   23:46   0:00  \_ /usr/local/sbin/zabbix_agentd
 zabbix    3300  0.0  0.0  3456  372 ?        SN   23:46   0:00  \_ /usr/local/sbin/zabbix_agentd
 zabbix    3301  0.0  0.0  3468  508 ?        SN   23:46   0:00  \_ /usr/local/sbin/zabbix_agentd

*参考 [#g78487f0]
**エラー [#jeb79709]
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

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS