Batch deploy Zabbix Agent

Source: Internet
Author: User

Batch deploy Zabbix Agent

Zabbix, as a system-level monitoring system, is still very powerful. It always tirelessly checks and verifies the system in the background, and then expresses the system warning through emails, text messages, graphics, and other methods.

Zabbix agent is a component required on the client. In this passive mode, the pressure on zabbix server is greatly reduced, because it is to push information to the server on the agent end, instead of the server's active retrieval.

Let's take a look at the previous figure. In fact, this architecture and principle must be very familiar to everyone.

The server and zabbix server of the customer's ticket interact with each other through the specific port of the network. Therefore, the firewall must be considered between two servers.

If you want to install the agent on each server, at least copy the installation media, create a directory, create a user, and then configure the network, finally, run the agent installation file to make install and so on.

If every client does this, the steps are similar. It takes a lot of time and effort. I tried to install it manually. As a result, after installing a few servers, I was suffering. Some of the steps in the middle have failed, and analysis is required. Finally, it is found to be a very simple small error.

At least for me, I think the simplest installation method is to provide only one IP address, and the rest can be completed automatically.

For example, if we have a script named zabbix_agent.sh, we only need to enter the IP address of the machine where the agent is to be installed, and the installation will start automatically, which saves time and effort.

We can further refine the problem, and refine it into several sections that can be implemented. For example, if I need to connect to each server to install the agent on an intermediate proxy server, the first thing I need to do is to create the corresponding directory on the target machine, copy all the files required for installation, or release the agent for short.

After the file directory and so on are available, we need to configure the network firewall, create the zabbix agent operating system user, call the installation file, this part is short for deploying the agent

Therefore, I divide the script into two parts. when running the script, I only need to provide the IP address.

./Publish_zabbix_agd.sh $1
./Zabbix_agent_dep.sh $1

After clarifying the target task, the rest is the specific implementation.

For the release program, in order to achieve one-click release and deployment effect, the script is dynamically run in the reverse CT mode.

Currently, I use the following methods:

The script for releasing the agent is as follows. Assume that the agent directory is new_agent, create a folder and copy the installation file to the specified directory/home/zabbix.

#! /Usr/bin/CT
Set ip_addr [lindex $ argv 0]
Set timeout 2
Spawn ssh $ ip_addr
CT "*#"
Send "mkdir-p/home/zabbix \ r"
CT eof
Spawn scp-r/home/jeanron/new_agent $ ip_addr:/home/zabbix
Send "exit \ r"
CT eof

Then the agent deployment script is as follows, we configure the network, call the installation files are concentrated in the install-zabbix-agentd.sh. One-time call.

#! /Usr/bin/CT
Set ip_addr [lindex $ argv 0]
Set timeout 120
Spawn ssh $ ip_addr
CT "*#"
Send "cd/home/zabbix/new_agent/zabbix_agent \ r"
Send "chmod + x install-zabbix-agentd.sh \ r"
Send "./install-zabbix-agentd.sh \ r"
Send "exit \ r"
Send "exit \ r"
CT eof

Based on this idea, you can install zabbix agent with one click. Before dinner, run the script. After dinner, dozens of agents will be automatically installed and automatically identified in zabbix.

Some Zabbix Tutorials:

Compile and install Zabbix2.4.5 source code in Ubuntu 14.04

Install and deploy the distributed monitoring system Zabbix 2.06

Install and deploy the distributed monitoring system Zabbix 2.06

Install and deploy Zabbix in CentOS 6.3

Zabbix distributed monitoring system practice

Under CentOS 6.3, Zabbix monitors apache server-status

Monitoring MySQL database Parameters Using Zabbix in CentOS 6.3

Install Zabbix 2.0.6 in 64-bit CentOS 6.2

ZABBIX details: click here
ZABBIX: click here

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.