安装zabbix agent shell 脚本

简介:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
[ -d  /usr/local/zabbix  ] &&  echo  "/usr/local/zabbix exist"  &&  exit
if  ps  -ef |  grep  zabbix_agentd |  grep  - v  grep  then
echo  "zabbix agent is installed"
exit
fi
yum  install  -y autoconf automake imake libxml2-devel expat-devel cmake gcc gcc-c++ libaio libaio-devel bzr bison libtool ncurses5-devel net-snmp\* libxml2 libxml2-devel  bzip2  libpng-devel freetype-devel  bzip2 -devel curl* curl-devel libjpeg\* openjpeg\*
if  [ $? != 0 ] ; then
echo  -e  "\033[31mInstall rpm failed\033[0m"
exit  0
fi
useradd  zabbix
cd  /tmp
wget http: //10 .10.45.81:8000 /zabbix-3 .2.6. tar .gz
tar  zvxf zabbix-3.2.6. tar .gz
cd  zabbix-3.2.6
. /configure  --prefix= /usr/local/zabbix  -- enable -agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2
make
make  install
while  true
do
ifconfig
echo  -e  "\033[31mPlease input network\033[0m"
read  input
if  ifconfig  $input> /dev/null  then
ip=` ifconfig  $input |  grep  "inet addr"  awk  '{print $2}'  awk  -F  ':'  '{print $2}' `
echo  $ip
break
else
echo  -e  "\033[31mInput Err\033[0m"
fi
done
sed  -i  's/Server=127.0.0.1/Server=10.10.45.152/g'  /usr/local/zabbix/etc/zabbix_agentd .conf
sed  -i  's/ServerActive=127.0.0.1/ServerActive=10.10.45.152/g'  /usr/local/zabbix/etc/zabbix_agentd .conf
sed  -i  "s/Hostname=Zabbix server/Hostname=$ip/g"  /usr/local/zabbix/etc/zabbix_agentd .conf
echo  "------------------------------- show zabbix agent conf file -------------------------------"
awk  '/^[^#]/'  /usr/local/zabbix/etc/zabbix_agentd .conf
/usr/local/zabbix/sbin/zabbix_agentd
if  grep  zabbix_agentd  /etc/rc . local  > /dev/null  ; then
echo  -e  "\033[31mNo need change rc.local\033[0m"
else 
echo  "/usr/local/zabbix/sbin/zabbix_agentd"  >>  /etc/rc . local
fi
相关文章
|
4天前
|
分布式计算 Hadoop Shell
使用shell脚本实现自动SSH互信功能
使用shell脚本实现自动SSH互信功能
10 1
|
5天前
|
Unix Shell Linux
轻松编写 AIX Shell 脚本
轻松编写 AIX Shell 脚本
12 1
|
6天前
|
监控 关系型数据库 Shell
Shell脚本入门:从基础到实践,轻松掌握Shell编程
Shell脚本入门:从基础到实践,轻松掌握Shell编程
|
6天前
|
关系型数据库 MySQL Shell
在Centos7中利用Shell脚本:实现MySQL的数据备份
在Centos7中利用Shell脚本:实现MySQL的数据备份
|
7天前
|
Shell Linux 编译器
C语言,Linux,静态库编写方法,makefile与shell脚本的关系。
总结:C语言在Linux上编写静态库时,通常会使用Makefile来管理编译和链接过程,以及Shell脚本来自动化构建任务。Makefile包含了编译规则和链接信息,而Shell脚本可以调用Makefile以及其他构建工具来构建项目。这种组合可以大大简化编译和构建过程,使代码更易于维护和分发。
24 5
|
8天前
|
Shell 程序员 数据安全/隐私保护
shell 脚本 if-else判断 和流程控制 (基本语法|基础命令)
shell 脚本 if-else判断 和流程控制 (基本语法|基础命令)
|
8天前
|
存储 Shell C语言
shell脚本 编程 变量 基本入门(详解)
shell脚本 编程 变量 基本入门(详解)
|
8天前
|
Shell Linux 编译器
C语言,Linux,静态库编写方法,makefile与shell脚本的关系。
总结:C语言在Linux上编写静态库时,通常会使用Makefile来管理编译和链接过程,以及Shell脚本来自动化构建任务。Makefile包含了编译规则和链接信息,而Shell脚本可以调用Makefile以及其他构建工具来构建项目。这种组合可以大大简化编译和构建过程,使代码更易于维护和分发。
15 3
|
14天前
|
弹性计算 运维 监控
|
14天前
|
存储 弹性计算 运维
自动化收集员工信息的Shell脚本
【4月更文挑战第30天】
13 0

推荐镜像

更多