Chinaunix首页 | 论坛 | 博客
  • 博客访问: 151263
  • 博文数量: 53
  • 博客积分: 1776
  • 博客等级: 上尉
  • 技术积分: 545
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-05 00:17
文章分类

全部博文(53)

文章存档

2016年(1)

2013年(2)

2012年(11)

2011年(6)

2010年(9)

2009年(19)

2008年(5)

我的朋友

分类: LINUX

2011-12-30 14:36:12

puppet-dashboard安装配置文档
环境:
CentOS release 5.3 (Final) 64位
ruby 1.8.7 (2008-05-31 patchlevel 0) [x86_64-linux]
mysql 5.0.77
一,升级ruby建立用户
centos5.3自带的ruby是1.8.5,安装ruby1.8.7
#cd /software/puppet/
#wget
#tar -zxvf ruby-1.8.7.tar.gz
#cd ruby-1.8.7
#./configure --prefix=/usr
#make
#make install
#ruby -v
ruby 1.8.7 (2008-05-31 patchlevel 0) [x86_64-linux]
安装成功
添加用户和组
#groupadd dashboard
#useradd -g dashboard -M -s /sbin/nologin dashboard
二,安装RubyGems及gem 模块
#cd /software/puppet
#wget
#tar -zxvf rubygems-1.8.12.tgz
#cd rubygems-1.8.12
#ruby setup.rb
#gem -v
1.8.12
安装成功
安装Rake
#gem source -r \\删除默认的源
#gem source -r
#gem sources -a \\由于国内网络原因(你懂的),导致 rubygems.org 存放在 Amazon S3 上面的资源文件间歇性连接失败,所以使用淘宝提供的镜像
#gem install rake -V //-V参数用来查看执行过程
安装rack
#gem install rack -V
安装rails
#gem install rails -V
安装ruby-mysql
#gem install ruby-mysql
三,安装mysql的gem模块
我的mysql是源码包编译安装的,所以安装如下,如果不是编译安装的,直接执行gem install mysql
#gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
创建数据库
创建数据库
mysql> create database puppet_dashboard character set utf8;
mysql> grant all privileges on puppet_dashboard.* to identified by '123456';
在/etc/my.conf里添加
max_allowed_packet = 32M
PS:需要重启数据库该参数才会生效,如果不想重启,可以采用下面的命令来实现
mysql> set global max_allowed_packet = 33554432;
mysql> flush privileges;
mysql> show variables like 'max%';
+----------------------------+----------------------+
| Variable_name              | Value                |
+----------------------------+----------------------+
| max_allowed_packet         | 33554432             |
如果不显示上面的内容,请退出mysql,再登录就会显示了
安装mysql-ruby
#wget
#tar -zxvf mysql-ruby-2.8.2.tar.gz
#cd mysql-ruby-2.8.2
#ruby extconf.rb --with-mysql-config --with-mysql-include=/usr/include/mysql/ --with-mysql-lib=/usr/lib/mysql/
这个编译项的选择要根据你mysql的安装位置来设定
#make
#make install
检查gem模块是否安装完毕
#gem list
*** LOCAL GEMS ***
actionmailer (3.1.3)
actionpack (3.1.3)
activemodel (3.1.3)
activerecord (3.1.3)
activeresource (3.1.3)
activesupport (3.1.3)
arel (2.2.1)
builder (3.0.0)
bundler (1.0.21)
erubis (2.7.0)
hike (1.2.1)
i18n (0.6.0)
json (1.6.4)
mail (2.3.0)
mime-types (1.17.2)
multi_json (1.0.4)
polyglot (0.3.3)
rack (1.4.0, 1.3.6)
rack-cache (1.1)
rack-mount (0.8.3)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.1.3)
railties (3.1.3)
rake (0.9.2.2)
rdoc (3.12)
ruby-mysql (2.9.4)
sprockets (2.0.3)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.31)
四,安装配置dashboard
#cd /software/puppet
#wget
#tar -zxvf puppet-dashboard_1.2.4-0.1rc1.tar.gz
#mv puppet-dashboard-1.2.4rc1/ /usr/local/puppet-dashboard
#chown -R dashboard:dashboard /usr/local/puppet-dashboard
#cd /usr/local/puppet-dashboard
#cp config/database.yml.example config/database.yml
修改database.yml:
production:
database: puppet_dashboard
username: puppet
password: 123456
encoding: utf8
adapter: mysql
注意:冒号后面以空格分隔,而不能以tab分隔
#创建表
#rake install
出现如下错误
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /usr/local/puppet-dashboard/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:21.
rake aborted!
uninitialized constant Gem::SyckDefaultKey
(See full trace by running task with --trace)
解决办法,降低rubygems版本
#gem update --system 1.6.2
DEPRECATION WARNING: Rake tasks in vendor/plugins/delayed_job/tasks are deprecated. Use lib/tasks instead. (called from /usr/local/puppet-dashboard/vendor/rails/railties/lib/tasks/rails.rb:10)
Please see the README.markdown file for installation instructions.
这个报警可以忽略

#rake RAILS_ENV=production db:migrate
rake aborted!
No such file or directory - /tmp/mysql.sock
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
解决办法,修改/etc/my.cnf,
socket=/var/lib/mysql/mysql.sock改为
socket=/tmp/mysql.sock
重启mysql
或者做软链接
#ln -sv /var/lib/mysql/mysql.sock /tmp/mysql.sock
启动
#/usr/local/puppet-dashboard/script/server -e production
=> Booting WEBrick
=> Rails 2.3.12 application starting on
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-12-29 14:29:09] INFO  WEBrick 1.3.1
[2011-12-29 14:29:09] INFO  ruby 1.8.7 (2008-05-31) [x86_64-linux]
[2011-12-29 14:29:09] INFO  WEBrick::HTTPServer#start: pid=5794 port=3000
启动脚本
#vi /etc/init.d/dashboard
#!/bin/bash
# Description: Puppet Dashboard init.d script
# Get function from functions library
. /etc/init.d/functions
# Start the service Puppet Dashboard
start() {
echo -n "Starting Puppet Dashboard: "
/usr/bin/ruby /usr/local/puppet-dashboard/script/server -e production >/dev/null 2>&1 &
### Create the lock file ###
touch /var/lock/subsys/puppetdb
success $"Puppet Dashboard startup"
echo
}
# Restart the service Puppet Dashboard
stop() {
echo -n "Stopping Puppet Dashboard: "
kill -9 `ps ax | grep "/usr/local/puppet-dashboard/script/server" | grep -v grep | awk '{ print $1 }'` >/dev/null 2>&1
### Now, delete the lock file ###
rm -f /var/lock/subsys/puppetdb
success $"Puppet Dashboard shutdown"
echo
}
### main logic ###
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status Puppet DB
;;
restart|reload|condrestart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac
exit 0
#chmod +x /etc/init.d/dashboard
#/etc/init.d/dashboard start
# netstat -natlp|grep 3000
tcp        0      0 0.0.0.0:3000                0.0.0.0:*                   LISTEN      5813/ruby
启动成功
现在在浏览器中输入就可以看到页面了,注意服务器的防火墙设置
还要启动delayed_job这个进程,不然不会有报告数据显示的,用下面的命令启动,该命令启动4个进程
#env RAILS_ENV=production /usr/local/puppet-dashboard/script/delayed_job -p dashboard -n 4 -m start
# ps -ef|grep delayed_job|grep -v grep
root      5983     1  0 14:42 ?        00:00:00 delayed_job.0_monitor                                                        
root      5984     1  0 14:42 ?        00:00:00 dashboard/delayed_job.0                                                      
root      5988     1  0 14:42 ?        00:00:00 delayed_job.1_monitor                                                        
root      5990     1  0 14:42 ?        00:00:00 dashboard/delayed_job.1                                                      
root      5994     1  0 14:42 ?        00:00:00 delayed_job.2_monitor                                                        
root      5996     1  0 14:42 ?        00:00:00 dashboard/delayed_job.2                                                      
root      6000     1  0 14:42 ?        00:00:00 delayed_job.3_monitor                                                        
root      6002     1  0 14:42 ?        00:00:00 dashboard/delayed_job.3                                                      

关闭命令
#env RAILS_ENV=production /usr/local/puppet-dashboard/script/delayed_job -p dashboard -n 4 -m stop
配置report
1,服务器端
/etc/puppet/puppet.conf
[master]
reports = store, http
reporturl =
修改显示的时间:
默认为UTC
/usr/local/puppet-dashboard/config/environment.rb
#config.time_zone = 'UTC'
 config.time_zone = 'Beijing'
区分大小写,可能不会立即生效。
2、客户端
/etc/puppet/puppet.conf
[agent]
    server = puppetmaster_hostnam
    report = true

3、导入已经存在的report
cd /usr/local/puppet_dashboard
rake RAILS_ENV=production reports:import
Importing 0 reports from /var/lib/puppet/reports/ in the background
Importing:     100% |############################################################################| Time: 00:00:00
0 of 0 reports queued
测试
在你的一台被管理的节点上运行
#puppet agent --test
在页面的左上角的Background Tasks里德pending tasks数值会加1
阅读(3240) | 评论(0) | 转发(0) |
0

上一篇:puppet安装文档

下一篇:thrift 0.7安装文档

给主人留下些什么吧!~~