Zabbixエージェントのインストール
次に監視対象となるサーバーに、監視用のzabbix-agentをインストールします
yumリポジトリを登録
ここでも同じく、Zabbix SIAのリポジトリを登録します
$ sudo rpm -ivh http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/zabbix-release-2.2-1.el6.noarch.rpm
zabbix-agentをインストール
$ sudo yum install zabbix-agent
zabbix-agentの設定ファイルを修正
$ sudo vi /etc/zabbix/zabbix_agentd.conf
修正箇所は3箇所
まずはZabbixサーバーのIPアドレスを指定
### Option: Server # List of comma delimited IP addresses (or hostnames) of Zabbix servers. # Incoming connections will be accepted only from the hosts listed here. # # Mandatory: no # Default: # Server= # Server=127.0.0.1 Server=(ZabbixサーバーのIPアドレス)
次に、Zabbix Agentのアクティブチェックをする際に必要な設定
##### Active checks related ### Option: ServerActive # List of comma delimited IP:port (or hostname:port) pairs of Zabbix servers for active checks. # If port is not specified, default port is used. # IPv6 addresses must be enclosed in square brackets if port for that host is specified. # If port is not specified, square brackets for IPv6 addresses are optional. # If this parameter is not specified, active checks are disabled. # Example: ServerActive=127.0.0.1:20051,zabbix.domain,[::1]:30051,::1,[12fc::1] # # Mandatory: no # Default: # ServerActive= # ServerActive=127.0.0.1 ServerActive=(ZabbixサーバーのIPアドレス) ### Option: Hostname # Unique, case sensitive hostname. # Required for active checks and must match hostname as configured on the server. # Value is acquired from HostnameItem if undefined. # # Mandatory: no # Default: # Hostname= # Hostname=Zabbix server Hostname=(Zabbixサーバーが使用する、このサーバのホスト名。実際のホスト名である必要はありません)
MySQLを監視する場合の設定
MySQLも簡単に監視できるようになりますが、そのためには少し準備が必要です
このサーバで動いているMySQLを監視したい人だけ、この項目を実行してください
まず監視用のMySQLユーザーを作成します
$ mysql -uroot -p mysql> grant process on *.* to 'zabbix_agent'@'localhost' identified by '(任意のパスワード)';
次にZabbix agentが、そのIDとパスワードを使用するためのファイルを作成します
$ sudo mkdir /var/lib/zabbix $ sudo vi /var/lib/zabbix/.my.cnf
新規ファイルなので、こちらを記述
[client] user = zabbix_agent password = (上で設定した任意のパスワード)
保存したら、ファイルのアクセス権などを変更しておきます
$ sudo chown -R zabbix:zabbix /var/lib/zabbix $ sudo chmod 400 /var/lib/zabbix/.my.cnf
サービスとの起動と登録
初期設定は完了しましたので、サービスを起動しましょう
$ sudo service zabbix-agent start Starting Zabbix agent: [ OK ] $ sudo chkconfig zabbix-agent
ファイアウォールの設定
Zabbix agentはZabbix serverとTCPのポート10050で通信します
従って、Zabbix serverとの間に、iptablesやファイアウォールでアクセス制限がかかっているサーバやネットワークにおきましては、Zabbix serverとのTCP 10050での通信を許可するよう、設定を変更してください
次の記事で、Zabbixサーバから実際に監視するためのWebフロントエンドへの登録方法を記載します
次の記事へ CentOSでのZabbix 2.2導入-5.監視対象のWebフロントエンドへの登録
■ AD ■ | |
---|---|