1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
1、创建sls文件
install-rpms:
cmd.run:
- name: yum install -y autoconf automake imake libxml2-devel expat-devel cmake gcc gcc-c++ libaio libaio-devel bzr bison libtool ncurses5-devel net-snmp\* java-1.7.0-openjdk.x86_64 java-1.7.0-openjdk-devel.x86_64 libxml2 libxml2-devel bzip2 libpng-devel freetype-devel bzip2-devel curl* curl-devel libjpeg\* openjpeg\*
install-zabbix_agent:
file.managed:
- name: /tmp/zabbix-3.0.3.tar.gz
- source: salt://init/files/zabbix-3.0.3.tar.gz
cmd.run:
- name: (id zabbix || useradd -u 600 zabbix) && cd /tmp && tar zxf zabbix-3.0.3.tar.gz && cd zabbix-3.0.3 && ./configure --prefix=/usr/local/zabbix --enable-agent --enable-java && make && make install && mkdir /usr/local/zabbix/log && chown zabbix:zabbix /usr/local/zabbix/log
- unless: test -d /usr/local/zabbix
config-zabbix_agent:
file.managed:
- name: /usr/local/zabbix/etc/zabbix_agentd.conf
- source: salt://init/files/zabbix_agentd.conf
cmd.run:
- name: (grep zabbix_agentd /etc/rc.local || echo "/usr/local/zabbix/sbin/zabbix_agentd">>/etc/rc.local) && /usr/local/zabbix/sbin/zabbix_agentd
- require:
- file: install-zabbix_agent
2、安装zabbix agent:salt-ssh '*' state.sls init.zabbix_agent
|
本文转自1321385590 51CTO博客,原文链接:http://blog.51cto.com/linux10000/1907998,如需转载请自行联系原作者