Description: Installs the Zabbix client in a Linux system environment.
First, set the host name
[Email protected] ~]# hostname agent01.ewin.com[[email protected] ~]# vi/etc/sysconfig/networknetworking=yeshostname =agent01.ewin.com
Second, manual installation method
1. Dependent software
[email protected] ~]# Yum install-y gcc Curl
2. Download
http://www.zabbix.com/download.php
[[email protected] ~]# mkdir/home/zabbix[[email protected] ~]# cd/home/zabbix[[email protected] zabbix]# wget Http://jai St.dl.sourceforge.net/project/zabbix/zabbix%20latest%20stable/2.2.5/zabbix-2.2.5.tar.gz
3. Installation
[[email protected] zabbix]# useradd zabbix-s/sbin/nologin[[email protected] zabbix]# tar zvxf zabbix-2.2.5.tar.gz[[emai L protected] zabbix]# CD Zabbix-2.2.5[[email protected] zabbix-2.2.5]#./configure--prefix=/usr/local/zabbix_agent--e Nable-agent[[email protected] zabbix-2.2.5]# make install
4. Configuration
[Email protected] zabbix-2.2.5]# vi/usr/local/zabbix_agent/etc/zabbix_agentd.confserver=10.188.1.103 #zabbix服务 iphostname=10.188.1.88 #客户端本机IPUnsafeUserParameters =1 #允许用户自定义参数EnableRemoteCommands =1 #允许执行远程命令Us Erparameter=tcpportlisten,/usr/local/zabbix_agent/sbin/discovertcpport.sh "$" #自定义的自动监听端口脚本, see later chapters
Description: Zabbix server IP is 10.188.1.103, you can also use the hostname zabbix.ewin.com, you need to set up local domain name resolution:
[Email protected] zabbix-2.2.5]# echo "10.188.1.103 zabbix.ewin.com" >>/etc/hosts
5. Port
[[email protected] zabbix-2.2.5]# iptables-i input-p TCP--dport 10050:10051-j accept[[email protected] zabbix-2.2.5]# Iptables-i input-p UDP--dport 10050:10051-j accept[[email protected] zabbix-2.2.5]# service Iptables Save
6. Start
[[email protected] zabbix-2.2.5]# cp /usr/local/zabbix_agent/sbin/zabbix_agentd /etc/ Init.d/[[email protected] zabbix-2.2.5]# chmod a+x /etc/init.d/zabbix_agentd[[email protected] zabbix-2.2.5]# service zabbix_agentd start[[email protected] zabbix-2.2.5]# echo "/etc/init.d/zabbix_agentd start" >> /etc/rc.local[[email protected] zabbix-2.2.5]# ps ax|grep zabbix_agentd43136 ? S 0:00 /etc/init.d/zabbix_agentd start43137 ? s 3:49 /etc/init.d/zabbix_agentd: collector [idle 1 sec]43138 ? S 1:16 /etc/init.d/zabbix_agentd: listener #1  [WAITING&Nbsp;for connection]43139 ? s 1:19 /etc/init.d/zabbix_agentd: listener #2 [waiting for connection] 43140 ? s 1:18 / etc/init.d/zabbix_agentd: listener #3 [waiting for connection]45111 pts/1 s+ 0:00 grep zabbix_agentd
Three, automatic installation method
1. Write the automatic installation script
[[email protected] ~]# cd /home[[email protected] home]# vi autozabbix.sh#!/bin/bash# Download Compile install Zabbix client Yum install -y gcc curlmkdir /home/zabbixcd /home/zabbixwget http://jaist.dl.sourceforge.net/project/zabbix/zabbix%20latest%20stable/2.2.5/ Zabbix-2.2.5.tar.gzuseradd zabbix -s /sbin/nologintar zvxf zabbix-2.2.5.tar.gzcd zabbix-2.2.5./configure --prefix=/usr/local/zabbix_agent --enable-agentmake install# automatically gets the IP address of the client to the configuration file, which specifies that the network segment begins with 10.188.1 and modifies the ip= "' ifconfig |grep 10.188.1|grep " according to its own network segment INET ADDR: "|awk -f " bcast: " ' {print $1} ' |awk -f " inet addr : " ' {print $2} '" echo "server=10.188.1.103" > /usr/local/zabbix_agent/etc/zabbix_ agentd.confecho "Hostname=${ip}" >> /usr/local/zabbix_agent/etc/zabbix_agentd.confecho "Unsafeuserparameters=1" >> /usr/local/zabbix_agent/etc/zabbix_agentd.confecho "Enableremotecommands=1" >> /usr/local/zabbix_agent/etc/zabbix_agentd.confecho "Userparameter=tcpportlisten,/usr/local/zabbix_ agent/sbin/discovertcpport.sh "$" " >> /usr/local/zabbix_agent/etc/zabbix_agentd.conf# Configure Firewall Open Port iptables -i input -p tcp --dport 10050:10051 -j Acceptiptables -i input -p udp --dport 10050:10051 -j acceptservice iptables save# Start Service Cp /usr/local/zabbix_agent/sbin/zabbix_agentd /etc/init.d/chmod +x /etc/init.d/zabbix_agentdservice zabbix_agentd startecho "/etc/init.d/zabbix_agentd Start >> /etc/rc.local# Displays the installation complete and displays the process startup status and configuration file echo Zabbix_agentd already install ." Ps ax|grep zabbix_agentdless /usr/local/zabbix_agent/etc/zabbix_agentd.confexitfi
2. Run the installation script
[Email protected] ~]# cd/home[[email protected] home]# chmod +x autozabbix.sh[[email protected] home]#./autozabbix.sh
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/53/8E/wKiom1Rq4ivhwdZFAAOiqMorqf0506.jpg "title=" Picture 13.png "alt=" Wkiom1rq4ivhwdzfaaoiqmorqf0506.jpg "/>
is a graph that is truncated on a VM virtual machine and the IP and path are not examples of this chapter, much the same, for informational purposes only.
Iv. Testing
After installation, the connection test can be performed on the Zabbix server.
[Email protected] ~]#/usr/local/zabbix/bin/zabbix_get-s 10.188.1.88-p 10050-k "System.uptime" 1060020
The above command returns the client's online duration, in seconds, with data return indicating successful installation.
V. About service restart
Running the service zabbix_agentd restart|status|start|stop command on the client is not valid, for unknown reasons, restarting services can be used in the following way:
1. Review the process
[[email protected] ~]# ps ax|grep zabbix_agentd43136 ? S 0:00 /etc/init.d/zabbix_agentd Start43137 ? s 3:55 /etc/init.d/zabbix_agentd: collector [idle 1 sec]43138 ? S 1:19 /etc/init.d/zabbix_agentd: listener #1 [waiting for connection]43139 ? S 1:21 /etc/init.d/zabbix_agentd: listener #2 [ waiting for connection]43140 ? s 1:20 /etc/init.d/zabbix_agentd: listener #3 [waiting for connection]48048 pts/1 &nBsp; s+ 0:00 grep zabbix_agentd
2. Close the process
[[Email protected] ~]# PS ax|grep zabbix_agentd|grep-v grep |awk ' {print $} ' |xargs kill-9
Description: Do not understand the above command, you can kill the process: Kill-9 43136 (43136-43140 is the process ID, kill all), delete and then use the PS command to check whether to kill clean.
3. Start the service
[[Email protected] ~]# service ZABBIX_AGENTD start
Note: After starting, use the PS command to see if it started successfully.
This article is from the "Moon Ching Xing Fei" blog, please be sure to keep this source http://ywzhou.blog.51cto.com/2785388/1579060
Zabbix Installation (iv): Zabbix Agent for Linux