Use zabbix to Monitor your servers


今回は主にオープンソース無料の分散型モニタリングソフトウェアZabbixのインストール使用を紹介します.下位ストレージデータはPostgres 9.1で、以下は手順です.
1.準備
zabbixのサービス側とクライアントファイルをダウンロードし、
ダウンロード先:http://www.zabbix.com/download.php
サービス端末IP:192.168.2.140
クライアントIP:192.168.2.1138
2.サービス側の操作:
groupadd zabbix
useradd zabbix -g zabbix

tar -zxvf  zabbix-2.0.5.tar.gz
cd zabbix-2.0.5

source /home/postgres/.bash_profile
./configure --prefix=/usr/local/zabbix --enable-server  --with-postgresql --with-net-snmp --with-libcurl
期間中にいくつかのパッケージが見つからない問題に遭遇しました
checking for pg_config... no
configure: error: PostgreSQL library not found

checking for curl-config... no
configure: error: Curl library not found

checking for net-snmp-config... no
configure: error: Invalid NET-SNMP directory - unable to find net-snmp-config
サービス側にpostgresデータベースが装着されているため、最初の問題はrootの下でpostgresの環境変数を参照して解決する、すなわちsource$PGHOME/である.bash_profileの残りの2つはyumで済ませます.
yum install curl-devel
yum install net-snmp-devel
終わったら次のように、
Use zabbix to Monitor your servers_第1张图片
インストール
make && make install
3.データベースの構成
[postgres@localhost ~]$psql
Password: 
psql (9.1.3)
Type "help" for help.
postgres=# create database zabbix;
CREATE DATABASE
postgres=# create user zabbix with password '123456';
CREATE ROLE
postgres=# grant all on database zabbix to zabbix;
GRANT
postgres=# \q
[postgres@localhost ~]$

--  zabbix   
[postgres@localhost ~]$ cd /home/kenyon/zabbix-2.0.5/database/postgresql/
[postgres@localhost postgresql]$ psql -U zabbix -d zabbix -f schema.sql 
[postgres@localhost postgresql]$ psql -U zabbix -d zabbix -f images.sql
[postgres@localhost postgresql]$ psql -U zabbix -d zabbix -f data.sql
zabbixとPostgresの接続の構成
vi /usr/local/zabbix/etc/zabbix_server.conf
LogFile=/tmp/zabbix_server.log
DBName=zabbix
DBUser=zabbix

[root@localhost ~]# mkdir -p /var/www/html/zabbix
[root@localhost ~]# cp -r /home/kenyon/zabbix-2.0.5/frontends/php/*  /var/www/html/zabbix/
4.サーバ側のソフトウェアの起動
apacheの起動
/etc/init.d/httpd restart
--apacheのダウンロードアドレス:http://apache.org/dist/httpd/
zabbixの起動
/usr/local/zabbix/sbin/zabbix-server start
[postgres@localhost tmp]$ pwd
/tmp
[postgres@localhost tmp]$ ll zabbix_server.*
-rw-rw-r--. 1 zabbix zabbix 2517 Feb 26 22:19 zabbix_server.log
-rw-rw-r--. 1 zabbix zabbix 4 Feb 26 22:19 zabbix_server.pid
ウェブページをブラウズして、正常かどうかを見ますhttp://192.168.2.140/zabbixいくつかのオプションが異常になるかもしれませんが、yumの方法と修正/etc/phpでいくつか遭遇しました.iniの解決方法は、インタフェースが出ていない場合、いくつかのディレクトリファイルが出ている場合は、phpがyum install phpをインストールしていない可能性が高いので、apacheを再起動します.
yum install php-pgsql
yum install php-bcmath
yum install php-mbstring
yum install php-xml
yum install php-gd

Use zabbix to Monitor your servers_第2张图片
DBの構成
Use zabbix to Monitor your servers_第3张图片
表示される場合
  • pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: Permission denied Is the server running on host "192.168.2.158"and accepting TCP/IP connections on port 1949? [include/db.inc.php:99]
  • Error connecting to database

  • pg_をチェックしますhba.confファイルとファイアウォール、およびselinuxを閉じて、/etc/sysconfig/selinuxで変更したほうがいいです.
     
    ウィンドウにログインして、頭文字が大文字であることに注意して、ユーザーのパスワードを忘れてDBデータを修正することで取得することができて、デフォルトはAdmin/zabbixです:
    psql -U zabbix -d zabbix
    zabbix=# select userid,name,surname,passwd from users;     
     userid |  name   |    surname    |              passwd              
    --------+---------+---------------+----------------------------------
          1 | Zabbix  | Administrator | 5fce1b3e34b520afeffb37ce08c7cd66
          2 | Default | User          | d41d8cd98f00b204e9800998ecf8427e
    (2 rows)
    zabbix=# update users set passwd = md5('123456') where userid = 1;
    UPDATE 1
    Use zabbix to Monitor your servers_第4张图片
    最終的に下図を見て、サービス側が準備ができていることを説明し、クライアントからデータが届くのを待つだけです.
    Use zabbix to Monitor your servers_第5张图片
    5.構成クライアントのインストール
    クライアントファイル(zabbix_agents_2.0.4.linux 2_6_23.amd 64.tar.gz、ダウンロードアドレスとサービス側)を/home/kenyon/
    tar -zxvf zabbix_agents_2.0.4.linux2_6_23.amd64.tar.gz
    [root@localhost kenyon]# ls -l
    total 284
    drwxr-xr-x. 5 root root   4096 Feb 26 17:39 zabbix_agents
    -rw-r--r--. 1 root root 286523 Feb 25 23:22 zabbix_agents_2.0.4.linux2_6_23.amd64.tar.gz
    
    
    [root@localhost kenyon]# cd zabbix_agents/conf/
    [root@localhost conf]# vi zabbix_agentd.conf
    Server=192.168.2.140
    ServerActive=192.168.2.138
    Hostname=192.168.2.138
    
    エラーや画像が出ない場合は、サービス側とクライアントの/tmp/zabbix_を参照してください.server.log情報
    通常:
    Use zabbix to Monitor your servers_第6张图片
    参照先:http://metaler.dyndns.org/wordpress/?p=481