Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Zabbix-client-install

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

#! / bin/bash

# this script mainly adds zabbix-agent for CentOS 6 or 7 version

# run scripts as root users

If [$(id-u)! = "0"]; then

Echo "You must be root to run this script..."

Exit 1

Fi

If [$#! = "1"]; then

Echo "Give me ZABBIX server IP..."

Exit 2

Fi

# selinux will prevent the service from being enabled, so shut down

Sed-I'/ SELINUX/s/enforcing/disabled/' / etc/selinux/config

Setenforce 0

If [- f / etc/redhat-release]; then

Edition= `grep-o'[[: digit:]]'/ etc/redhat-release | head-1`

Else

Edition= `uname`

Fi

Case "$Edition" in

7)

Echo-e "\ n\ 033 [34mStart installation.\ 033 [0m\ n"

Rpm-ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm

Yum-y install zabbix-agent zabbix-sender

Sed-I "/ Server/s/Server=127.0.0.1/Server=$1/" / etc/zabbix/zabbix_agentd.conf

Sed-I "/ Server/s/ServerActive=127.0.0.1/ServerActive=$1/" / etc/zabbix/zabbix_agentd.conf

Systemctl start zabbix-agent

Systemctl enable zabbix-agent

6)

Echo-e "\ n\ 033 [34mStart installation.\ 033 [0m\ n"

Rpm-ivh http://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-1.el6.noarch.rpm

Yum-y install zabbix-agent zabbix-sender

Sed-I "/ Server/s/Server=127.0.0.1/Server=$1/" / etc/zabbix/zabbix_agentd.conf

Sed-I "/ Server/s/ServerActive=127.0.0.1/ServerActive=$1/" / etc/zabbix/zabbix_agentd.conf

/ etc/init.d/zabbix-agent start

Chkconfig zabbix-agent on

*)

Echo "="

Echo "This system is not CentOS 6 or 7, script execution failed!"

Echo "="

Exit 3

Esac

If ss-ntl | grep 10050 & > / dev/null; then

Echo-e "\ n\ 033 [32mCongratulations, ZABBIX client installed successfully\ 033 [0m\ n"

Else

Echo-e "\ n\ 033 [31mSorry, please rerun the command or contact the administrator\ 033 [0m\ n"

Fi

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report