标签:style blog http io ar sp on 文件 div
过程:
1.安装一些依赖的包
2.编译安装libconfuse包
3.编译安装ganglia
4.配置gmond、启动gmond
准备:
1.master 1台
2.源文件:
salt://tools/Ganglia/package/ganglia-3.6.0.tar.gz
salt://tools/Ganglia/package/confuse-2.7.tar.gz
3.minion 8台
软件都装在/usr/local/
开始:
(这里我分开写sls文件,便于调节和理解)
1.安装依赖
# Check package && install pkg: cmd.run: - name: yum install -y gcc glibc glibc-common rrdtool rrdtool-devel apr apr-devel expat expat-devel pcre pcr e-devel dejavu-lgc-sans-mono-fonts dejavu-sans-mono-fonts zlib-devel
# Get confuse confuse-2.7: file.managed: - name: /home/tools/Ganglia/package/confuse-2.7.tar.gz - source: salt://tools/Ganglia/package/confuse-2.7.tar.gz # Extract it extract-confuse: cmd.run: - cwd: /home/tools/Ganglia/package - name: tar xvf confuse-2.7.tar.gz - require: - file: confuse-2.7 # Configure it configure-confuse: cmd.run: - name: ./configure CFLAGS=-fPIC --disable-nls && make && make install - cwd: /home/tools/Ganglia/package/confuse-2.7 - unless: test -d /usr/local/confuse
第5行则是文件的来源,拷贝整个文件夹请参考上一篇
第10行是执行命令时当前的文件夹
第11行是执行的命令
第12、13行则是最终目的,达成才会返回succeed
第20行是判断存不存在文件夹,存在就不执行name的命令,不存在则执行
3.编译安装ganlia
# Get it ganglia-3.6.0: file.managed: - name: /home/tools/Ganglia/package/ganglia-3.6.0.tar.gz - source: salt://tools/Ganglia/package/ganglia-3.6.0.tar.gz # Extract it extract-ganglia: cmd.run: - cwd: /home/tools/Ganglia/package - name: tar xvf ganglia-3.6.0.tar.gz - require: - file: ganglia-3.6.0 # Configure it configure-ganglia: cmd.run: - name: ./configure --prefix=/usr/local/ganglia && make && make install - cwd: /home/tools/Ganglia/package/ganglia-3.6.0 - unless: test -d /usr/local/ganglia
4.配置gmond
/usr/local/ganglia/etc/gmond.conf: file.managed: - source: salt://ganglia/gmond.conf - makedirs: True - user: nobody - group: nobody - mode: 777 /etc/init.d/gmond: file.managed: - source: salt://ganglia/gmond - user: nobody - group: nobody - mode: 777 #add-chkconfig: # cmd.run: # - name: service gmond start && chkconfig --add gmond # - require: # - file: /usr/local/ganglia/etc/gmond.conf
/srv/salt/ganlia/gmond.conf
开机启动文件按安装位置修改放到:
/srv/salt/ganglia/gmond
sls文件也在:
/srv/salt/ganglia
执行:
salt -E "^s1-3-*" state.sls ganglia.confuse_configure.sls salt -E "^s1-3-*" state.sls ganglia.ganglia_configure.sls salt -E "^s1-3-*" state.sls ganglia.gmond_configuration.sls
标签:style blog http io ar sp on 文件 div
原文地址:http://blog.csdn.net/tmpbook/article/details/41803729