您的位置:首页 > 运维架构

[7]DevOps 自动化运维工具Chef---如何安装Chef的Report?

2016-09-22 17:06 1146 查看
Chef Report是一个非常有用的功能,它能检测所有的chef节点的任务执行情况: 成功,失败,终止。 而且能记录客户端节点的执行情况。Chef report的最低执行版本如下:

Chef server 12

chef-client version 11.6.0 (or later)

具体的执行运行效果如下,

1.历史执行的任务已经明细



2.执行的趋势图



废话少说,直接分享安装的步骤:

1. 在Chef Master服务上安装report

sudo chef-server-ctl install opscode-reporting

或者直接把opscode-reporting_1.6.4-1_amd64.deb安装包从chef.io网站下载下来,并通过下面的命令安装

sudo dpkg -i opscode-reporting_1.6.4-1_amd64.deb


2.在Chef服务上配置Chef 服务器

sudo chef-server-ctl reconfigure

3.在chef 服务器上配置 Report的service

sudo opscode-reporting-ctl reconfigure --accept-license

4. 验证安装

$ sudo opscode-reporting-ctl test

出现类似下面的界面



恭喜你,安装成功了!!!!

安装成功后,可以在客户机器上执行下面的命令,

chef-client -l info

这个时候,其执行命令的结果将会显示在report的历史(history)中。

如果执行其他的任务,其也会显示出来。

此外,在workstation或者client的机器上执行下面的命令:

knife runs list, knife runs show

也会看到一些任务执行的情况,比如运行,knife runs list



运行,

knife runs show 31caaf4f-3dd6-4dc3-8df8-da08a15ba008


ubuntu@chef-client-01-rodney:~$ knife runs show 31caaf4f-3dd6-4dc3-8df8-da08a15ba008
run_detail:
  data:
  end_time:          2016-09-22T08:39:15Z
  node_name:         chef-client-02-rodney
  run_id:            31caaf4f-3dd6-4dc3-8df8-da08a15ba008
  run_list:          ["recipe[starter]","recipe[rodneytest]"]
  start_time:        2016-09-22T08:39:15Z
  status:            success
  total_res_count:   2
  updated_res_count: 2
run_resources:
  cookbook_name:    starter
  cookbook_version: 1.0.0
  duration:         1
  final_state:
    message: Welcome to Chef, Sam Doe!
  id:               Welcome to Chef, Sam Doe!
  initial_state:
  name:             Welcome to Chef, Sam Doe!
  result:           write
  type:             log
  uri:              https://chef-master-rodney.example.com/organizations/example/reports/org/runs/31caaf4f-3dd6-4dc3-8df8-da08a15ba008/0

  cookbook_name:    rodneytest
  cookbook_version: 0.1.0
  duration:         14
  final_state:
    checksum:      0d45ed7c5225e25ae1846bb57535c8ea8a19a143ef987e7839a9e7c5b88e97cf
    group:         ubuntu
    mode:          0664
    owner:         ubuntu
    path:          /home/ubuntu/motdgggg2.txt
    verifications:

  id:               /home/ubuntu/motdgggg2.txt
  initial_state:
    group:
    mode:
    owner:
    path:  /home/ubuntu/motdgggg2.txt
  name:             /home/ubuntu/motdgggg2.txt
  result:           create
  type:             file
  uri:              https://chef-master-rodney.example.com/organizations/example/reports/org/runs/31caaf4f-3dd6-4dc3-8df8-da08a15ba008/1
ubuntu@chef-client-01-rodney:~$




参考文章:

1.https://docs.chef.io/install_reporting.html

2.https://docs.chef.io/reporting.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐