首页 > 代码库 > puppet学习—默认WEBRick安装DashBoard

puppet学习—默认WEBRick安装DashBoard

  DashBoard是puppet的控制台,用于显示puppet master和puppet agent的相关信息。本文以默认的WEBRick提供Web服务。DashBoard 安装在master.test.com。并且在客户端配置文件做如下配置

  #vim /etc/puppet/puppet.conf

   [agent]

   report = true

一、安装依赖软件包

    #rpm -ivh http://yum.puppetlabs.com/el/6Server/products/x86_64/puppetlabs-release-6-6.noarch.rpm

    #yum -y install mysql mysql-devel mysql-server ruby ruby-devel ruby-irb ruby-mysql ruby-rdoc ruby-ri rubygems

    #gem install rake

二、安装DashBoard软件包

    #yum install -y  puppet-dashboard 

三、配置DashBoard

    1创建数据库

    #vim /etc/my.cnf

     max_allowed_packet = 32M

    #service mysqld start

    #chkconfig mysqld on

    #mysql

     mysql>create database dashboard CHARACTER SET utf8;

     mysql>create user ‘dashboard‘@‘localhost‘ IDENTIFIED BY ‘dashboard‘;

     mysql>grant all privileges on dashboard.* TO ‘dashboard‘@‘localhost‘;

     mysql>flush privileges;

    2修改配置文件

    #vim /usr/share/puppet-dashboard/config/database.yml     

     production:

       database: dashboard

       username: dashboard

       password: dashboard

       encoding: utf8

       adapter: mysql

    #vim /usr/share/puppet-dashboard/config/settings.yml

       time_zone: ‘Asia/Shanghai‘

    3导入数据库,启动服务

    #cd /usr/share/puppet-dashboard/config

    #rake RAILS_ENV=production db:migrate

    #service puppet-dashboard start

    #chkconfig puppet-dashboard on

    #rake RAILS_ENV=production db:raw:optimize   #优化数据库

    4导入现有报告

    #cd /usr/share/puppet-dashboard

    #rake RAILS_ENV=production reports:import

    5配置实时发送报告

    #vim /etc/puppet/puppet.conf    

     reports = store,tagmail,log,puppet_dashboard,http

     reporturl = http://172.16.30.220:3000/reports

    6开启报告

    #rake RAILS_ENV=production jobs:work 2 &>1 &

    7访问dashboard

    http://172.16.30.220:3000/reports

四、数据库管理

    1当puppet dashboard数据量过多的时候,需要优化数据库,可使用命令:

    #rake RAILS_ENV=production db:raw:optimize

    2清理dashborad一个月之前的数据:

    #rake RAILS_ENV=production reports:prune upto=1 unit=mon

    3备份puppet dashborad数据库:

    #rake RAILS_ENV=production FILE=/my/backup/file.sql db:raw:dump

    4恢复数据:

    #rake RAILS_ENV=production FILE=production.sql db:raw:restore

    

    

本文出自 “不莱梅乐队” 博客,谢绝转载!