简体   繁体   English

如何使用OMD用户监控Docker容器

[英]How to monitoring Docker Container using OMD User

OMD User OMD用户

# omd create docker-user
# su - docker-user
  1. How to monitor docker container? 如何监控Docker容器?
  2. Micro services memory usage inside the docker container? docker容器内的微服务内存使用情况?
  3. How to configer docker container as check_mk agent? 如何将Docker容器配置为check_mk代理?

Iam using Check_mk for monitoring my servers and know want to monitor for docker as well? 我使用Check_mk来监视我的服务器,并且还想监视Docker吗?

Here are two options: 这里有两个选择:

  1. when you deploy your container add the check_mk_agent at/during provisioning and using the Check_MK Web-API, add your host, do discovery, etc. 部署容器时,请在配置过程中/在配置过程中使用Check_MK Web-API添加check_mk_agent,添加主机,进行发现等。

  2. you can use the following plugin to monitor docker containers. 您可以使用以下插件监视Docker容器。

Alternatively if you are using the enterprise version you can use the current innovation release (1.5.x) which has native Docker support. 另外,如果您使用的是企业版,则可以使用具有本地Docker支持的最新创新版本(1.5.x)。

This is a late answer but since this came on top of my Google search results, I will take some time to add up to Marius Pana's answer. 这是一个较晚的答案,但是由于这是我的Google搜索结果之上的问题,因此我将花一些时间来总结Marius Pana的答案。 As of now, the raw version of Check_MK also supports natively dockers. 截至目前,Check_MK的原始版本还支持本地docker。 However, if you want dedicated checks inside your docker, you will need to actually install a Check_MK agent inside the docker. 但是,如果要在Docker内部进行专用检查,则需要在docker内部实际安装Check_MK代理。 To do that, you need to start some sort of shell (generally sh or bash) inside the docker with docker exec -it <id> sh . 为此,您需要使用docker exec -it <id> sh在docker内部启动某种外壳(通常为sh或bash)。 You can get your docker ID with docker ps . 您可以使用docker ps获取您的docker ID。

Now that's the easy part. 现在,这很容易。 The hard part is to figure out which package manager you are dealing with inside the docker (if any) and how to install inetd/xinetd or your preferred way of communication for your agent (unless it's already installed). 困难的部分是弄清您正在docker内部处理哪个软件包管理器(如果有),以及如何安装inetd / xinetd或您的代理首选的通信方式(除非已安装)。 If it's a Ubuntu-based image, you will generally need to start with a apt update , apt-get install xinetd and then you can install your packaged Check_MK agent or install it manually if you prefer. 如果它是基于Ubuntu的映像,则通常需要从apt update开始, apt-get install xinetd ,然后可以安装打包的Check_MK代理,也可以根据需要手动安装。 If it's a CentOS-based image, you will instead use yum . 如果它是基于CentOS的映像,您将改为使用yum If the image is based on Arch Linux, you will probably want to use pacman . 如果该映像基于Arch Linux,则可能需要使用pacman

Once you managed to install everything in your docker, you can test by adding your docker IP to Check_MK as a host. 一旦成功在docker中安装了所有内容,就可以通过将docker IP作为主机添加到Check_MK进行测试。 Please note that if your docker is using the host IP, you will need to forward port 6556 from your docker to another port on your host since I assume you're already monitoring the host through port 6556. 请注意,如果您的码头工人正在使用主机IP,则您需要将端口6556从您的码头工人转发到主机上的另一个端口,因为我假设您已经在通过端口6556监视主机。

After you've checked everything is working, 2 more things. 检查完所有功能后,再进行2件事。 If you stop there, a simple restart of your docker will cancel every change you've made, so you need to do a docker commit to save your changes to your container image. 如果在此停靠,只需重新启动Docker即可取消所做的所有更改,因此您需要执行docker commit来将更改保存到容器映像中。 And lastly, you will want to plan container updates ahead: you can do reinstall the agent every time a new version of the container is pulled (you could even script this), or you could add instructions to your cont-init.d which would be executed every time you launch your docker. 最后,您将需要提前计划容器更新:您可以在每次拉出容器的新版本时重新安装代理程序(甚至可以编写脚本),也可以在cont-init.d添加说明。每次启动docker时都会执行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM