xenserver监控vm中的docker容器

参考地址:http://xenserver.org/partners/docker.html?id=159
        http://xenserver.org/overview-xenserver-open-source-virtualization/download.html

HOW TO GET STARTED WITH CONTAINER MONITORING ON COREOS

1) Install and configure CoreOS
配置和安装coreos
Provision the VM using the XenCenter “New VM” wizard. Select CoreOS as the operating system. Walk through the wizard. In the new Cloud Config Parameters tab,
you will have the option to customize ssh_authorized_keys. There is a sub-setting “- ssh-rsa”, that is commented out by default,
which can be used to register personal public SSH key to be able to login into the VM with the “core” user later:

# - ssh-rsa 

While adding your personal public key, you may also have noticed a separate “- ssh-rsa %XSCONTAINERRSAPUB%” setting in which the XenServer container management registers
and SSH key for its’ management operations. This is mandatory for the container management and should not be modified.

使用xencenter工具在创建VM(xenserver7支持coreos模板)的步骤中,有一步是配置cloudconfig文件,可以设置- ssh-rsa 为xenserver dom0的公共密钥
例如,在~/.ssh/id_rsa.pub

clouder@clouder-wenwen-pc:~$ cat ~/.ssh/id_rsa.pub 
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDXX0avbvS+UxJu7xgpsdTVSzXWy0Sr9n5wAwjR3PJwqERXFHWGHhNXsO0H+BsTYDRw9IYjYKu73mtlLAG2dPgE4wDTnjF26t3+cOt6dOIAlsxLZQfHhLrYvI0LKK0xkBsgpNUSMNND/9VQpwA6uqb9kNwc3llddPIuWDAHxWDYHujYHG3clXn5scTDiVMe3xhDZlwWqRohDJirzW1ifiEyno8MZ7lo8Pg6VefnBOEX43UJ03iGrm/L1jujXrFPnMwtGY1IrKJw0PWYF5nd7yj0i4+MjvzVMYoh0V+A2dMNCaQdVSwN3DxM3AKm7qpJWTe05fUfxJWfuiSeNX94Pwon clouder@clouder-wenwen-pc

去掉后面clouder@clouder-wenwen-pc

After following the remainder of “New VM” wizard, you can use your preferred method to install CoreOS. One way is to download the CoreOs-iso from here to your ISOSR and
boot the VM using that ISO. Subsequently run the following command on the VM-console, to install to the first harddisk:
使用下面的命令将coreos安装在指定的硬盘上

sudo coreos-install –d /dev/xvda –o xen –C stable

Next you can reboot into the installed VM:
重启机器

sudo reboot

For the container management to work, you need to ensure that the VM network can be reached from Dom0. In case you’re not using DHCP in your environment, you need to
configure the networking for the VM.

2) Enable Container management
重启机器后,在xencenter上右击VM的属性,在Enable Container management打勾。
After rebooting into the freshly installed VM, you can enable Container Management using the VM properties in XenCenter.

3) Confirm Container monitoring is working

检测容器监控是否工作,xenserver7上可以展开VM的下一级容器。
The easiest way to do this is to confirm that Docker Version information is available in the VM general tab in XenCenter.

You can spin up containers inside the CoreOS VM using the core-user:

docker run --name hello -d busybox /bin/sh -c "while true; do echo Hello World; sleep 1; done"

And you should be able to see and control the containers in the XenCenter tree-view as described in the above.

In case any of the above does not work, check the Notifications and Alerts, which may provide a pointer.

HOW TO MONITOR OTHER LINUX OSS
监控装有docker宿主机的容器

CoreOS VMs installed with the Cloud Config Drive are automatically prepared for Container Management and the management only needs to be enabled.
Other Linux VMs can be prepared manually.

1) Install Docker, ncat and SSHD inside the VM

The installation on Ubuntu can be performed using :

apt-get install docker.io nmap openssh-server
On RHEL/OEL/CentOS 7 the installation can be performed using:

yum install docker nmap-ncat openssh-server
# Enable autostart for docker.service
systemctl enable docker.service
# Start docker.service directly
systemctl start docker.service

A non-root user can be provided access to Docker by adding it to the “Docker” group.

2) Prepare the Container Monitoring of the VM

To prepare a VM, the following command needs to be run in Dom0:

xscontainer-prepare-vm –v [vm-uuid]  -u [username]

xscontainer-prepare-vm程序在xenserver6.5sp1后XenServer-6.5.0-SP1-xscontainer.iso文件则会出现。
With being the UUID of the VM, that should be prepared and being the username on the VM that the container management will attempt to use for SSH access.

This preparation script will guide you through the process and automatically enable container management for this VM.

The XenServer team has tested the prepare script and functionality with Ubuntu 14.04 and CentOS/RHEL/OEL 7.0. However other Linux distributions and versions may work as well.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值