# 通常のリポジトリにはv1.8しか無かったため、別リポジトリを追加 sudo wget http://repo.zabbix.com/zabbix/2.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_2.0-1precise_all.deb sudo dpkg -i zabbix-release_2.0-1precise_all.deb sudo aptitude update # agentのインストール sudo aptitude install zabbix-agent sudo sysv-rc-conf zabbix-agent on # 設定 sudo vim /etc/zabbix/zabbix_agentd.conf ---- Server=192.168.1.10 ListenIP=192.168.1.20 ServerActive=192.168.1.10 Hostname=ubuntu.example.com ---- sudo service zabbix-agent restart # ポート開放(LANの場合) sudo ufw allow proto tcp from 192.168.1.0/24 to any port 10050
Timeout=10 LogFile=c:\zabbix\zabbix_agentd.log EnableRemoteCommands=1 LogRemoteCommands=1 Server=192.168.1.10 ListenIP=192.168.1.20 ServerActive=192.168.1.10 Hostname=win.example.com Include=c:\zabbix\zabbix_agentd.userparams.conf
cd C:\zabbix\bin\win64 zabbix_agentd.exe --config C:\zabbix\zabbix_agentd.conf --install zabbix_agentd.exe --config C:\zabbix\zabbix_agentd.conf --start
cd C:\zabbix\bin\win64 zabbix_agentd.exe --config C:\zabbix\zabbix_agentd.conf --stop zabbix_agentd.exe --config C:\zabbix\zabbix_agentd.conf --uninstall
※新規インストールする場合は、EPELではなく、Zabbix Official Repository を使った方が3.0へのバージョンアップもできて良い。
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm yum install zabbix20-server zabbix20-server-mysql zabbix20-web zabbix20-agent --enablerepo=epel
sudo su - cd /tmp # SELinuxは無効 vi /etc/sysconfig/selinux ---- SELINUX=disabled ---- reboot # yum yum -y install wget vim-enhanced expect ntp mailx postfix yum -y install mysql-server curl net-snmp unixODBC OpenIPMI-libs httpd php php-bcmath php-gd php-mbstring php-mysql php-xml # MTAをpostfixに変更 alternatives --config mta # 必要パッケージをダウンロード wget -q http://www.kodai74.net/packages/non-supported/rhel/5/x86_64/fping-2.4b2-16.el5.x86_64.rpm wget -q http://www.kodai74.net/packages/non-supported/rhel/5/x86_64/iksemel-1.4-2.el5.x86_64.rpm wget -q http://www.kodai74.net/packages/non-supported/rhel/5/x86_64/libssh2-1.4.0-2.el5.x86_64.rpm rpm -ivh \ fping-2.4b2-*.rpm \ iksemel-1.4-2.*.rpm \ libssh2-1.4.0-*.rpm # zabbix本体やagentをダウンロード # CentOS 5.xの場合 wget -q http://www.kodai74.net/packages/zabbix/zabbix-2.0/rhel/5/x86_64/zabbix-2.0.1-1.el5.x86_64.rpm wget -q http://www.kodai74.net/packages/zabbix/zabbix-2.0/rhel/5/x86_64/zabbix-agent-2.0.1-1.el5.x86_64.rpm wget -q http://www.kodai74.net/packages/zabbix/zabbix-2.0/rhel/5/x86_64/zabbix-server-2.0.1-1.el5.x86_64.rpm wget -q http://www.kodai74.net/packages/zabbix/zabbix-2.0/rhel/5/x86_64/zabbix-server-mysql-2.0.1-1.el5.x86_64.rpm wget -q http://www.kodai74.net/packages/zabbix/zabbix-2.0/rhel/5/x86_64/zabbix-web-2.0.1-1.el5.x86_64.rpm wget -q http://www.kodai74.net/packages/zabbix/zabbix-2.0/rhel/5/x86_64/zabbix-web-mysql-2.0.1-1.el5.x86_64.rpm wget -q http://www.kodai74.net/packages/zabbix/zabbix-2.0/rhel/5/x86_64/zabbix-web-japanese-2.0.1-1.el5.x86_64.rpm wget -q http://www.kodai74.net/packages/zabbix/zabbix-2.0/rhel/5/x86_64/zabbix-get-2.0.1-1.el5.x86_64.rpm wget -q http://www.kodai74.net/packages/zabbix/zabbix-2.0/rhel/5/x86_64/zabbix-sender-2.0.1-1.el5.x86_64.rpm #サーバとエージェント両方をインストールする場合 rpm -ivh \ zabbix-2.0.*.rpm \ zabbix-agent-2.0.*.rpm \ zabbix-server-2.0.*.rpm \ zabbix-server-mysql-2.0.*.rpm \ zabbix-web-2.0.*.rpm \ zabbix-web-mysql-2.0.*.rpm \ zabbix-web-japanese-2.0.*.rpm \ zabbix-get-2.0.*.rpm \ zabbix-sender-2.0.*.rpm #エージェントだけをインストールする場合 rpm -ivh \ zabbix-2.0.1-1.*.rpm \ zabbix-agent-2.0.1-1.*.rpm chkconfig httpd on chkconfig mysqld on # ポートを開放する vi /etc/sysconfig/iptables ---- # apache -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT # zabbix-server -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 10051 -j ACCEPT ---- service iptables restart # 時計を日本に yes | cp -f /usr/share/zoneinfo/Japan /etc/localtime cat > /etc/sysconfig/clock << 'EOS' ZONE="Asia/Tokyo" UTC=false ARC=fals10 EOS ntpdate ntp.nict.jp; hwclock --systohc; # apache 文字化け防止と、ディレクトリインデックスを止める vi /etc/httpd/conf/httpd.conf ---- #AddDefaultCharset UTF-8 <Directory "/var/www/html"> Options -Indexes FollowSymLinks ---- # php utf-8を使用可能に vi /etc/php.ini ---- max_execution_time = 300 memory_limit = 128M post_max_size = 16M upload_max_filesize = 2M max_input_time = 300 date.timezone = "Asia/Tokyo" output_handler = mb_output_handler auto_detect_line_endings = Off mbstring.language = Japanese mbstring.internal_encoding = UTF-8 mbstring.http_input = pass mbstring.http_output = pass mbstring.encoding_translation = On mbstring.detect_order = auto mbstring.substitute_character = none; ---- service httpd restart # DB作成 vi /etc/my.cnf ---- [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock user=mysql # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 skip-character-set-client-handshakecharacter-set-server=utf8 default-storage-engine=InnoDB innodb_log_file_size=128M innodb_data_file_path=ibdata1:1G innodb_file_per_table=1 innodb_file_format=Barracuda innodb_stats_on_metadata=0 #メモリに余裕がある場合は増やす innodb_buffer_pool_size=8M [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid [mysql] default-character-set=utf8 prompt="\u@\h[\d]> " auto-rehash [client] default-character-set=utf8 [mysqldump] default-character-set=utf8 max_allowed_packet=16M ---- service mysqld restart mkpasswd -s 0 > ~/.mysql-zabbix cat ~/.mysql-zabbix DBパスワード echo "DELETE FROM mysql.user WHERE user='';" | mysql -u root -p$(cat ~/.mysql-root) mysql echo "grant SELECT,INSERT,DELETE,UPDATE,CREATE,DROP,FILE,ALTER,INDEX,CREATE ROUTINE,CREATE VIEW,LOCK TABLES ON *.* TO 'zabbix'@'%' IDENTIFIED BY '$(cat ~/.mysql-zabbix)';FLUSH PRIVILEGES;" | mysql -u root -p$(cat ~/.mysql-root) mysql echo "CREATE DATABASE zabbix CHARACTER SET utf8;" | mysql -u root -p$(cat ~/.mysql-root) mysql # 接続テスト mysql -u zabbix -p$(cat ~/.mysql-zabbix) zabbix # DBインストール mysql -u zabbix -p$(cat ~/.mysql-zabbix) zabbix < /usr/share/doc/zabbix-server-mysql-2.0.1/create/schema.sql mysql -u zabbix -p$(cat ~/.mysql-zabbix) zabbix < /usr/share/doc/zabbix-server-mysql-2.0.1/create/images.sql mysql -u zabbix -p$(cat ~/.mysql-zabbix) zabbix < /usr/share/doc/zabbix-server-mysql-2.0.1/create/data.sql # Serverの設定 vim /etc/zabbix/zabbix_server.conf ---- DBPassword=**** ---- # Webインターフェースの設定 vim /etc/httpd/conf.d/zabbix.conf ---- # 追加 php_value date.timezone Asia/Tokyo ---- service httpd restart #エージェントの設定 vi /etc/zabbix/zabbix_agentd.conf ---- LogFileSize=0 Server=127.0.0.1 Hostname=Zabbix server ServerActive=127.0.0.1 ListenIP=127.0.0.1 ---- service zabbix-agent restart service zabbix-server restart chkconfig zabbix-server on chkconfig zabbix-agent on
yum install php-pecl-apc --enablerepo=epel vim /etc/php.d/apc.ini ---- apc.shm_size=32M ---- service httpd restart
yum install php-eaccelerator --enablerepo=epel vim /etc/php.d/eaccelerator.ini ---- eaccelerator.shm_size = "32" ---- service httpd restart
※新規インストールする場合は、EPELではなく、Zabbix Official Repository を使った方が3.0へのバージョンアップもできて良い。
wget http://repo.zabbix.com/zabbix/2.0/rhel/6/x86_64/zabbix-release-2.0-1.el6.noarch.rpm rpm -ivh http://repo.zabbix.com/zabbix/2.0/rhel/6/x86_64/zabbix-release-2.0-1.el6.noarch.rpm yum install zabbix-agent --enablerepo=zabbix
yum install zabbix20-agent --enablerepo=epel
vim /etc/rc.d/init.d/zabbix-agent ---- daemon --user zabbix $exec -c /etc/zabbix/zabbix_agentd.conf ----
sudo su - cd /tmp # SELinuxは無効 vi /etc/sysconfig/selinux ---- SELINUX=disabled ---- reboot # zabbix 10050/tcp ポートを開放する vi /etc/sysconfig/iptables ---- # zabbix-agent -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 10050 -j ACCEPT ---- service iptables restart # 最低限zabbix, zabbix-agentが有れば良い。デバッグ用にzabbix-get, zabbix-senderがあると便利 wget -q http://www.kodai74.net/packages/zabbix/zabbix-2.0/rhel/5/x86_64/zabbix-2.0.1-1.el5.x86_64.rpm wget -q http://www.kodai74.net/packages/zabbix/zabbix-2.0/rhel/5/x86_64/zabbix-agent-2.0.1-1.el5.x86_64.rpm wget -q http://www.kodai74.net/packages/zabbix/zabbix-2.0/rhel/5/x86_64/zabbix-get-2.0.1-1.el5.x86_64.rpm wget -q http://www.kodai74.net/packages/zabbix/zabbix-2.0/rhel/5/x86_64/zabbix-sender-2.0.1-1.el5.x86_64.rpm rpm -ivh \ zabbix-2.0.*.rpm \ zabbix-agent-2.0.*.rpm \ zabbix-get-2.0.*.rpm \ zabbix-sender-2.0.*.rpm vi /etc/zabbix/zabbix_agentd.conf ---- LogFileSize=0 Server=zabbixサーバのアドレスに修正 Hostname=agentのホスト名に変更 # 省略可:NICが複数ある場 + 合などエージェントがListenするIPを指定 #ListenIP=192.168.1.10 # zabbix-serverが1時間落ちてもデータロストしないようにAgentのバッファサイズを拡張 BufferSize=65535 ---- service zabbix-agent restart chkconfig zabbix-agent on
service zabbix-server stop service zabbix-agent stop
yum update zabbix-server \
zabbix-agent \
zabbix-server-mysql \
zabbix-web-japanese \
zabbix-web \
zabbix \
zabbix-web-mysql \
zabbix-get \
zabbix-sernder
wget -q http://www.kodai74.net/packages/zabbix/zabbix-2.0/rhel/5/x86_64/zabbix-2.0.1-1.el5.x86_64.rpm wget -q http://www.kodai74.net/packages/zabbix/zabbix-2.0/rhel/5/x86_64/zabbix-agent-2.0.1-1.el5.x86_64.rpm wget -q http://www.kodai74.net/packages/zabbix/zabbix-2.0/rhel/5/x86_64/zabbix-get-2.0.1-1.el5.x86_64.rpm wget -q http://www.kodai74.net/packages/zabbix/zabbix-2.0/rhel/5/x86_64/zabbix-server-2.0.1-1.el5.x86_64.rpm wget -q http://www.kodai74.net/packages/zabbix/zabbix-2.0/rhel/5/x86_64/zabbix-server-mysql-2.0.1-1.el5.x86_64.rpm wget -q http://www.kodai74.net/packages/zabbix/zabbix-2.0/rhel/5/x86_64/zabbix-web-2.0.1-1.el5.x86_64.rpm wget -q http://www.kodai74.net/packages/zabbix/zabbix-2.0/rhel/5/x86_64/zabbix-web-japanese-2.0.1-1.el5.x86_64.rpm wget -q http://www.kodai74.net/packages/zabbix/zabbix-2.0/rhel/5/x86_64/zabbix-web-mysql-2.0.1-1.el5.x86_64.rpm wget -q http://www.kodai74.net/packages/zabbix/zabbix-2.0/rhel/5/x86_64/zabbix-sender-2.0.1-1.el5.x86_64.rpm rpm -Uvh zabbix-2.0.*.rpm \ zabbix-agent-2.0.*.rpm \ zabbix-get-2.0.*.rpm \ zabbix-server-2.0.*.rpm \ zabbix-server-mysql-2.0.*.rpm \ zabbix-web-2.0.*.rpm \ zabbix-web-japanese-2.0.*.rpm \ zabbix-web-mysql-2.0.*.rpm \ zabbix-sender-2.0.*.rpm
/usr/share/doc/zabbix-server-mysql-2.0.1/upgrades/dbpatches/2.0/mysql/upgrade
mysql -u root -e 'drop database zabbix;' mysql -u root -e
グラフ でグラフの表示
sudo yum update zabbix20 zabbix20-web zabbix20-server zabbix20-agent --enablerepo=epel sudo service zabbix-agent restart sudo service zabbix-server restart sudo service httpd restart
yum update zabbix-agent \
zabbix
wget -q http://www.kodai74.net/packages/zabbix/zabbix-2.0/rhel/5/x86_64/zabbix-2.0.1-1.el5.x86_64.rpm wget -q http://www.kodai74.net/packages/zabbix/zabbix-2.0/rhel/5/x86_64/zabbix-agent-2.0.1-1.el5.x86_64.rpm wget -q http://www.kodai74.net/packages/zabbix/zabbix-2.0/rhel/5/x86_64/zabbix-get-2.0.1-1.el5.x86_64.rpm wget -q http://www.kodai74.net/packages/zabbix/zabbix-2.0/rhel/5/x86_64/zabbix-sender-2.0.1-1.el5.x86_64.rpm rpm -Uvh \ zabbix-2.0.*.rpm \ zabbix-agent-2.0.*.rpm \ zabbix-get-2.0.*.rpm \ zabbix-sender-2.0.*.rpm
service zabbix-agent restart
tail -f /var/log/zabbix/zabbix_agentd.log 6995:20120712:174713.028 failed to add UserParameter "vfs.partitions.discovery": duplicate key vi /etc/zabbix/zabbix_agentd.d/userparameter_examples.conf ---- #solarisの方をコメントアウト #UserParameter=vfs.partitions.discovery,/somewhere/solaris_partitions.sh ----
vi /etc/zabbix/zabbix_agentd.conf ---- Hostname=agentのホスト名に変更 # zabbix1.8 #DisableActive=0 # zabbix2.0 ServerActive=127.0.0.1:10051,zabbix.domain:10051 # zabbix-serverから監視項目のリストを取得する間隔 RefreshActiveChecks=120 ---- service zabbix-agent restart