Zabbix_agnet deployment,
Originally published in cu:
Reference:
I. Environment
Server: CentOS-7-x86_64-1511-based, zabbix-3.0.1 Server deployed
Server IP: 192.168.11.252
Agent: CentOS-6.4-x86_64
Agent IP Address: 192.168.21.252, route up to server
2. software acquisition
Zabbix Official Website: http://www.zabbix.com/download.php
As of, the latest LTS version: http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.0.1/zabbix-3.0.1.tar.gz
3. Prepare 1. iptables settings
# Zabbix_agent port 10050: The agent uses the passive mode and is actively connected to the agent by the server. The agent also has the active mode, which can be configured in the agent configuration file; # zabbix_trapper port 10051, the agent actively connects to the server or trapper. # the ip address of the server is specified for security purposes, which can be ignored. [Root @ localhost ~] # Vim/etc/sysconfig/iptables-a input-s 192.168.11.252-p tcp-m state -- state NEW-m tcp -- dport 10050-j ACCEPT-A OUTPUT-d 192.168.11.252-p tcp- m state -- state NEW-m tcp -- dport 10051-j ACCEPT
2. selinux
# Check whether selinux is disabled. If you need to disable selinux during running, [root @ localhost ~] # Getenforce [root @ localhost ~] # Vim/etc/selinux/config # SELINUX = enforcing SELINUX = disabled [root @ localhost ~] # Setenforce 0
4. Install zabbix_agent1. Dependency package
Note: zabbix_agent requires a relatively small number of dependent packages, but the basic compilation dependency packages are still required, such as gcc and gcc-c ++. Here, the initial centos system is installed according to the compiling environment, and the compilation and installation are successful. You cannot determine which dependency packages are required in addition to the basic compiling environment. You can first compile and install them, handle any errors.
2. Add a user
# Create a user zabbix and add the user zabbix to the user group zabbix groupadd zabbixuseradd-g zabbix-s/sbin/nologin zabbix
3. Add a service port
# Add the port corresponding to the zabbix service, vim/etc/services # emerge-agent 10050/tcp # Zabbix Agentzabbix-agent 10050/udp # Zabbix Agentzabbix-trapper 10051/tcp # Zabbix Trapperzabbix-trapper 10051 is added to the default services documentation /udp # Zabbix Trapper
4. Install zabbix_agent
# Libiconv may not be found. so.2 file, no impact on ln-s/usr/local/lib/libiconv is found. so.2/usr/lib/libiconv. so.2 # Make the configuration take effect immediately/sbin/ldconfigtar-zxvf/usr/local/src/zabbix-3.0.1.tar.gzcd/usr/local/src/zabbix-3.0.1 # Only install zabbix_agent. /configure -- prefix =/usr/local/zabbix -- enable-agentmakemake install # Add a soft link ln-s/usr/local/zabbix/sbin/*/usr to the zabbix Agent file /local/sbin/ln-s/usr/local/zabbix/bin/*/usr/local/bin/
5. Configure and modify the zabbix_agnet configuration file
# Enable the path of the custom key sub-configuration file, and enable vim/usr/local/zabbix/etc/zabbix_agentd.confServer = 192.168.11.252Include =/usr/local/zabbix/etc/zabbix_agentd.conf.d/UnsafeUserParameters = 1
Add boot script
# Client cp/usr/local/src/zabbix-3.0.1/misc/init. d/fedora/core/zabbix_agentd/etc/rc. d/init. d/zabbix_agentd # Add the script execution permission chown zabbix: zabbix/etc/rc. d/init. d/zabbix_agentdchmod + x/etc/rc. d/init. d/zabbix_agentd # edit the zabbix installation directory vim/etc/rc in the client STARTUP script. d/init. d/zabbix_agentdBASEDIR =/usr/local/zabbix/# Add boot start chkconfig -- level 35 zabbix_agentd on
6. Start verification
Service zabbix_agentd start # Check whether the Zabbix client is running properly. ps aux | grep zabbix_agentdnetstat-tunlp | grep zabbix
Test whether the Zabbix client communicates with the Zabbix server normally. Run the following command on the zabbix Server:
# If data is returned to the video, the communication is normal. 192.168.21.252 is the IP address of the zabbix client. If the ECHO is abnormal, you can view the agent logs. According to the file configuration, default Value:/tmp/zabbix_agentd.logzabbix_get-s 192.168.21.252-p 10050-k "system. uptime "2533194
5. Add linux host monitoring 1. Create a host
Open the zabbix server in the browser:
Http: // 192.168.11.252/zabbix
Configuration à Hosts à Create host
2. host information
Under the Host Tag:
Custom "Host name ";
Select "Groups". If not, create "New group ";
In monitoring mode, select "Agent interfaces" and enter "ip address". Port 10050 is connected by IP by default, and no changes are made.
3. Select a monitoring template
Under the Templates Tag:
"Link new templates", Select à selected Template OS Linux Template à Add confirm to Add the Template, the added Template will be displayed in "Linked Templates;
Click "Add" at the bottom of the page. The host is successfully added.
4. Status observation
After the host is successfully added, the Hosts page is automatically returned. For the newly created host, observe the STATUS of "STATUS" and "AVAILABILITY" as follows:
If the status is abnormal, you can view the server logs. The default value is/tmp/zabbix_server.log according to the configuration file.