|
Zabbix as a system-level monitoring is still very to the force, it is always in the background, repeatedly checking and verification tireless, then by e-mail, text messaging, graphics, and other ways to express the early warning system.
zabbix agent is a component on the client's needs, in this passive mode, zabbix server will greatly reduce the pressure, as is the agent began to push information to the terminal server, rather than take the initiative to get the server.
To interact between the server and the client list zabbix server through a specific network port. So between the two server you need to consider a firewall.
Now if you want to install the agent on each server, at least we need to copy the installation media in the past, create the appropriate directory, create a corresponding user, and then configure the network, and finally run the agent installation file, and so do make install.
If each client to do so again, in fact, the steps are similar, spend a lot of time, is very exhausting. I tried to manually install on their own after a few results of the installation, and much suffering. Some intermediate steps of a mistake, we have to further analysis, and finally found a very simple little errors.
At least for me, I think the easiest way is to install only a ip address, and then the rest of the things can be done automatically.
For example, suppose we have a script zabbix_agent.sh only need to install the agent to enter the ip address of the machine, the installation will start automatically, thus saving time and effort up.
We can continue to refine the problem, it is called thinning parts can be achieved. For example, I was in the middle of a proxy server, you need to connect through this server to each server to install agent, then the first thing to do is to create the corresponding directory on the target machine, the files required for installation gave a copy of the past, can Acronym release agent
After the file directory then so have, we need to configure the network firewall to create zabbix agent operating system user, calls the installation file, this section referred to as the deployment agent
So I put the script into two parts, the running time only need to provide ip address.
./publish_zabbix_agd.sh $ 1
./zabbix_agent_dep.sh $ 1
Clear goals after the task that remains is the concrete implementation.
For publishers, in order to achieve one-click publishing, deployment results, use expect dynamic way to run the script.
I am currently employed as follows:
Release agent script reads as follows, assuming the agent directory new_agent, on the line to create the folder, and then copy the installation files to the specified directory / home / zabbix
#! / Usr / bin / expect
set ip_addr [lindex $ argv 0]
set timeout 2
spawn ssh $ ip_addr
expect "* #"
send "mkdir -p / home / zabbix \ r"
expect eof
spawn scp -r / home / jeanron / new_agent $ ip_addr: / home / zabbix
send "exit \ r"
expect eof
The script then deploy the agent follows, we put the network configuration, call the installation files are part concentrated install-zabbix-agentd.sh inside. Direct calls can be disposable.
#! / Usr / bin / expect
set ip_addr [lindex $ argv 0]
set timeout 120
spawn ssh $ ip_addr
expect "* #"
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"
expect eof
According to this idea, it is possible to achieve a fundamental key to the installation zabbix agent. Before dinner, began to run scripts, and so came back after dinner, dozens of agent automatically installation is complete, the zabbix can be automatically identified. |
|
|
|