Install Zabbix and configure the client's Autodiscover options using the shell script one-click

Source: Internet
Author: User

1. Reasons:

My own ESXi server recently added a lot of virtual hosts, but I'm not installing, using, the kind of batch OPS (Saltstack,ansible,puppet, etc.). Although there is another way: to open several windows at a time through the shell tool, and then in the edit box to enter a row of input commands, click All Windows execution. But my old notebook can't hold so many windows.

2. Then

Started to write zabbix_agent installation script, by hand upload to each virtual machine execution, it is recommended that when you initialize Linux, do not forget to install LRZSZ,RZ and sz can drag upload files to Linux. Very convenient.

There is another way of thinking: When initializing Linux, configure a shared mount file directory on the management machine to those managed machines, and then distribute the script in this manner. But I feel a bit crooked. It's better to go to the whole ansible. Let's leave this for something.

printf  "Close and block service Firewalld." Systemctl stop firewalld > /dev/null 2>&1systemctl mask firewalld  > /dev/null 2>&1printf  "\033[32;1m%20s\033[0m\n"   "[ ok ]" printf   "Install zabbix3.4.2 source ..." yum -y install http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/ zabbix-release-3.4-2.el7.noarch.rpm > /dev/null 2>&1printf  "\033[32;1m%20s\033[ 0m\n " " [ ok ] "printf " Install zabbix-agent ... "yum -y install zabbix-agent  > /dev/null 2>&1printf  "\033[32;1m%20s\033[0m\n"   "[ ok ]" printf   "Change zabbix-agent profile" sed  -i  "s/server=127.0.0.1/server=192.168.1.120/g"  /etc/zabbix/ zabbix_agentd.confsed  -i  "S/serveractive=127.0.0.1/serveractive=192.168.1.120/g"  /etc/ zabbix/zabbix_agentd.confsed  -i  "s/# hostmetadataitem=/hostmetadataitem=system.uName/g " /etc/zabbix/zabbix_agentd.confsed  -i " s/# hostnameitem=system.hostname/ Hostnameitem=system.hostname/g " /etc/zabbix/zabbix_agentd.confsed  -i " S/hostname=zabbix  server/# hostname=zabbix server/g " /etc/zabbix/zabbix_agentd.confprintf " \033[32;1m% 20s\033[0m\n " " [ ok ] "printf " setting zabbix-agent self-booting ... " systemctl enable zabbix-agent > /dev/null 2>&1printf  "\033[32;1m%20s\ 033[0m\n " " [ ok ] "printf " Start zabbix-agent service .... "Systemctl restart zabbix-agent  > /dev/null 2>&1printf  "\033[32;1m%20s\033[0m\n"   "[ ok ]"

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/06/A2/wKiom1m7aKuQGKh1AABKjb6MEK8325.jpg-wh_500x0-wm_ 3-wmp_4-s_2450779539.jpg "title=" 8.jpg "alt=" Wkiom1m7akuqgkh1aabkjb6mek8325.jpg-wh_50 "/>

Explained below:

    • Prohibit firewall from booting can be used systemctl disable FIREWALLD This command is not a problem on CentOS 7,

      But in the homologous FedoraServer26 always can not succeed, so use more brutal systemctl mask firewalld Way, directly to the FIREWALLD directory, so Systemctl find FIREWALLD.

    • Zabbix using the latest version

    • Change the configuration file here, I have re-specified the server address.

i.e. server=192.168.1.120 (passive, for auto-discovery Action)

Serveractive=192.168.1.120 (active, for self-initiated registration operation to the server)

Hostnameitem=system.hostname (defines the name of the host, which is useful when auto-registering)

Hostmetadataitem=system.uname (defines the host's metadata information, which is useful when auto-registering)

    • Then the service is turned on.


This article is from "Long SQL Road ..." Blog, be sure to keep this source http://l0vesql.blog.51cto.com/4159433/1965543

Install Zabbix and configure the client's Autodiscover options using the shell script one-click

Related Article

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.