#topicpath
----

#contents



** インストール [#u9b3918f]
*** インストール [#u9b3918f]
 $ brew install --agent-only zabbix
 Updating Homebrew...
 ==> Auto-updated Homebrew!
 Updated 1 tap (homebrew/core).
 ==> Updated Formulae
 restview
 
 ==> Installing dependencies for zabbix: pcre
 ==> Installing zabbix dependency: pcre
 ==> Downloading https://homebrew.bintray.com/bottles/pcre-8.42.high_sierra.bottl
 ######################################################################## 100.0%
 ==> Pouring pcre-8.42.high_sierra.bottle.tar.gz
 🍺  /usr/local/Cellar/pcre/8.42: 204 files, 5.3MB
 Warning: zabbix: --agent-only was deprecated; using --without-server-proxy instead!
 ==> Installing zabbix --without-server-proxy
 ==> Downloading https://downloads.sourceforge.net/project/zabbix/ZABBIX%20Latest
 ==> Downloading from https://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20La
 ######################################################################## 100.0%
 ==> ./configure --prefix=/usr/local/Cellar/zabbix/3.4.8 --sysconfdir=/usr/local/
 ==> make install
 🍺  /usr/local/Cellar/zabbix/3.4.8: 13 files, 1.4MB, built in 1 minute 17 seconds


***設定 [#o3834d1b]
 $ sudo cp -pfr /usr/local/etc/zabbix/zabbix_agentd.conf /usr/local/etc/zabbix/zabbix_agentd.conf.20180503
 $ sudo vi /usr/local/etc/zabbix/zabbix_agentd.conf
 $ diff /usr/local/etc/zabbix/zabbix_agentd.conf /usr/local/etc/zabbix/zabbix_agentd.conf.20180503
 93c93
 < Server=127.0.0.1,192.168.10.0/24
 ---
 > Server=127.0.0.1


***ユーザ作成 [#h6a0a49f]
GUIで zabbix ユーザを作成しておきます。共有ユーザで良いっぽい。


***起動確認 [#d6cc0db2]
 $ sudo /usr/local/sbin/zabbix_agentd -c /usr/local/etc/zabbix/zabbix_agentd.conf

 $ ps -ef | grep zabbix
   505  7156     1   0 10:35PM ??         0:00.01 /usr/local/sbin/zabbix_agentd -c /usr/local/etc/zabbix/zabbix_agentd.conf
   505  7157  7156   0 10:35PM ??         0:00.00 /usr/local/sbin/zabbix_agentd: collector [idle 1 sec]
   505  7158  7156   0 10:35PM ??         0:00.01 /usr/local/sbin/zabbix_agentd: listener #1 [waiting for connection]
   505  7159  7156   0 10:35PM ??         0:00.01 /usr/local/sbin/zabbix_agentd: listener #2 [waiting for connection]
   505  7160  7156   0 10:35PM ??         0:00.01 /usr/local/sbin/zabbix_agentd: listener #3 [waiting for connection]
   505  7161  7156   0 10:35PM ??         0:00.01 /usr/local/sbin/zabbix_agentd: active checks #1 [idle 1 sec]
   501  7165   915   0 10:35PM ttys000    0:00.00 grep zabbix

停止は以下の通り
 $ sudo kill -TERM  `cat /tmp/zabbix_agentd.pid`


*** マシン起動時に起動するようにする [#p10855b2]
Macに標準でついてる Launchd という機構にサービスとして登録します。

 $ ls -lrt /Library/LaunchDaemons/com.zabbix.zabbix_agentd.plist
 -rw-r--r--  1 root  wheel  579  5  3 20:24 /Library/LaunchDaemons/com.zabbix.zabbix_agentd.plist
 $ sudo chown root:wheel /Library/LaunchDaemons/com.zabbix.zabbix_agentd.plist
 
 $ cat /Library/LaunchDaemons/com.zabbix.zabbix_agentd.plist
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
 	<key>Label</key>
 	<string>com.zabbix.zabbix_agentd</string>
 	<key>ProgramArguments</key>
 	<array>
 		<string>/usr/local/sbin/zabbix_agentd</string>
 		<string>-c</string>
 		<string>/usr/local/etc/zabbix/zabbix_agentd.conf</string>
 	</array>
 	<key>RunAtLoad</key>
 	<true/>
 	<key>KeepAlive</key>
 	<dict>
 		<key>SuccessfulExit</key>
 		<false/>
 	</dict>
 	<key>StandardErrorPath</key>
 	<string>/tmp/zabbix.err</string>
 	<key>StandardOutPath</key>
 	<string>/tmp/zabbix.out</string>
 </dict>
 </plist>

こんなファイルを作っておいて、
 $ sudo launchctl load -w /Library/LaunchDaemons/com.zabbix.zabbix_agentd.plist

でやります。再起動してもzabbixが起動してればOK.

ただ、なんかうまくいかないこともあって、結果的に
 <key>ProgramArguments</key>
 <array>
   <string>/Users/xxx/start_zabbix.sh</string>
 </array>

とかして、起動コマンドをstart_zabbix.shに書いたりして、しのいでますorz。。


----
この記事は
#vote(おもしろかった,そうでもない)


#comment

#topicpath

SIZE(10){現在のアクセス:&counter;}

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