The author selected the Open Internet/Free Speech Fund to receive a donation as part of the Write for DOnations program.

作者选择了“ 开放互联网/言论自由基金会”作为“ Write for DOnations”计划的一部分来接受捐赠。

介绍 (Introduction)

As a systems administrator, it’s a best practice to know the current state of your infrastructure and services. Ideally, you want to notice failing disks or application downtimes before your users do. Monitoring tools like Checkmk can help administrators detect these issues and maintain healthy servers.

作为系统管理员,最佳实践是了解基础结构和服务的当前状态。 理想情况下,您希望在用户之前注意到磁盘故障或应用程序停机。 诸如Checkmk的监视工具可以帮助管理员检测这些问题并维护服务器健康。

Generally, monitoring software can track your servers’ hardware, uptime, and service statuses, and it can raise alerts when something goes wrong. In a very basic scenario, a monitoring system would alert you if any services go down. In a more robust one, the notifications would come shortly after any suspicious signs arose, such as increased memory usage or an abnormal amount of TCP connections.

通常,监视软件可以跟踪服务器的硬件,正常运行时间和服务状态,并且在出现问题时可以发出警报。 在非常基本的情况下,监视系统会在任何服务出现故障时提醒您。 更可靠的是,在出现任何可疑迹象(例如内存使用增加或TCP连接数量异常)之后不久,便会发出通知。

There are many monitoring solutions available offering varying degrees of complexity and feature sets, both free and commercial. In many cases, the installation, configuration, and management of these tools is difficult and time-consuming.

有许多可用的监视解决方案,它们提供了不同程度的复杂性和功能集,包括免费的和商业的。 在许多情况下,这些工具的安装,配置和管理非常困难且耗时。

Checkmk, however, is a monitoring solution that is both robust and simpler to install. It is a self-contained software bundle that combines Nagios (a popular and open-source alerting service) with add-ons for gathering, monitoring, and graphing data. It also comes with Checkmk’s web interface — a comprehensive tool that addresses many of Nagios’s shortcomings. It offers a user-friendly dashboard, a full-featured notification system, and a repository of easy-to-install monitoring agents for many Linux distributions. If it weren’t for Checkmk’s web interface, we would have to use different views for different tasks and it wouldn’t be possible to configure all these features without resorting to extensive file modifications.

但是Checkmk是一种监视解决方案,它既健壮又易于安装。 它是一个独立的软件包,将Nagios(流行的开源警报服务)与用于收集,监视和图形化数据的附加组件结合在一起。 它还带有Checkmk的Web界面-一个综合的工具,可以解决Nagios的许多缺点。 它提供了一个用户友好的仪表板,一个功能齐全的通知系统以及许多Linux发行版的易于安装的监视代理程序存储库。 如果不是Checkmk的Web界面,我们将不得不对不同的任务使用不同的视图,并且在不依靠大量文件修改的情况下就不可能配置所有这些功能。

In this guide we will set up Checkmk on an Ubuntu 18.04 server and monitor two separate hosts. We will monitor the Ubuntu server itself as well as a separate CentOS 7 server, but we could use the same approach to add any number of additional hosts to our monitoring configuration.

在本指南中,我们将在Ubuntu 18.04服务器上设置Checkmk并监视两个单独的主机。 我们将监视Ubuntu服务器本身以及单独的CentOS 7服务器,但是我们可以使用相同的方法向监视配置中添加任意数量的其他主机。

先决条件 (Prerequisites)

  • One Ubuntu 18.04 server with a regular, non-root user with sudo privileges. You can learn how to prepare your server by following this initial server setup tutorial.

    一台Ubuntu 18.04服务器,具有具有sudo特权的常规非root用户。 您可以通过遵循此初始服务器设置教程来学习如何准备服务器。

  • One CentOS 7 server with a regular, non-root user with sudo privileges. To prepare this server you can follow this initial server setup tutorial.

    一台具有sudo特权的常规非root用户的CentOS 7服务器。 要准备此服务器,您可以遵循此初始服务器设置教程 。

第1步-在Ubuntu上安装Checkmk (Step 1 — Installing Checkmk on Ubuntu)

In order to use our monitoring site, we first must install Checkmk on the Ubuntu server. This will give us all the tools we need. Checkmk provides official ready-to-use Ubuntu package files that we can use to install the software bundle.

为了使用我们的监视站点,我们首先必须在Ubuntu服务器上安装Checkmk。 这将为我们提供所需的所有工具。 Checkmk提供了官方的即用型Ubuntu软件包文件,我们可以使用它们来安装软件包。

First, let’s update the packages list so that we have the most recent version of the repository listings:

首先,让我们更新软件包列表,以便获得最新版本的存储库列表:

  • sudo apt update sudo apt更新

To browse the packages we can go to the package listing site. Ubuntu 18.04, among others, can be selected in the page menu.

要浏览软件包,我们可以转到软件包清单站点 。 可以在页面菜单中选择Ubuntu 18.04。

Now download the package:

现在下载软件包:

  • wget https://checkmk.com/support/1.6.0p8/check-mk-raw-1.6.0p8_0.bionic_amd64.deb wget https://checkmk.com/support/1.6.0p8/check-mk-raw-1.6.0p8_0.bionic_amd64.deb

Then install the newly downloaded package:

然后安装新下载的软件包:

  • sudo apt install -y ./check-mk-raw-1.6.0p8_0.bionic_amd64.deb 须藤apt install -y ./check-mk-raw-1.6.0p8_0.bionic_amd64.deb

This command will install the Checkmk package along with all necessary dependencies, including the Apache web server that is used to provide web access to the monitoring interface.

此命令将安装Checkmk软件包以及所有必要的依赖项,包括用于提供对监视界面的Web访问的Apache Web服务器。

After the installation completes, we now can access the omd command. Try it out:

安装完成后,我们现在可以访问omd命令。 试试看:

  • sudo omd 苏多

This omd command will output the following:

omd命令将输出以下内容:

Output
Usage (called as root):omd help                        Show general help. . .General Options:-V <version>                    set specific version, useful in combination with update/createomd COMMAND -h, --help          show available options of COMMAND

The omd command can manage all Checkmk instances on our server. It can start and stop all the monitoring services at once, and we will use it to create our Checkmk instance. First, however, we have to update our firewall settings to allow outside access to the default web ports.

omd命令可以管理我们服务器上的所有Checkmk实例。 它可以立即启动和停止所有监视服务,我们将使用它来创建Checkmk实例。 但是,首先,我们必须更新防火墙设置,以允许外部访问默认Web端口。

步骤2 —调整防火墙设置 (Step 2 — Adjusting the Firewall Settings)

Before we’ll be able to work with Checkmk, it’s necessary to allow outside access to the web server in the firewall configuration. Assuming that you followed the firewall configuration steps in the prerequisites, you’ll have a UFW firewall set up to restrict access to your server.

在我们可以使用Checkmk之前,必须允许防火墙配置允许外部访问Web服务器。 假设您已按照先决条件中的防火墙配置步骤进行操作,则将设置UFW防火墙以限制对服务器的访问。

During installation, Apache registers itself with UFW to provide an easy way to enable or disable access to Apache through the firewall.

在安装过程中,Apache向UFW注册,以提供一种简便的方法来启用或禁用通过防火墙对Apache的访问。

To allow access to Apache, use the following command:

要允许访问Apache,请使用以下命令:

  • sudo ufw allow Apache sudo ufw允许Apache

Now verify the changes:

现在验证更改:

  • sudo ufw status sudo ufw状态

You’ll see that Apache is listed among the allowed services:

您会看到Apache列在允许的服务中:

Output
Status: activeTo                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere
Apache                     ALLOW       Anywhere
OpenSSH (v6)               ALLOW       Anywhere (v6)
Apache (v6)                ALLOW       Anywhere (v6)

This will allow us to access the Checkmk web interface.

这将使我们能够访问Checkmk Web界面。

In the next step, we’ll create the first Checkmk monitoring instance.

在下一步中,我们将创建第一个Checkmk监视实例。

步骤3 —创建一个Checkmk监视实例 (Step 3 — Creating a Checkmk Monitoring Instance)

Checkmk uses the concept of instances, or individual installations, to isolate multiple Checkmk copies on a server. In most cases, only one copy of Checkmk is enough and that’s how we will configure the software in this guide.

Checkmk使用实例或单个安装的概念来隔离服务器上的多个Checkmk副本。 在大多数情况下,仅一份Checkmk副本就足够了,这就是我们在本指南中配置软件的方式。

First we must give our new instance a name, and we will use monitoring throughout this text. To create the instance, type:

首先,我们必须给新实例起一个名字,我们将在整个文本中使用monitoring 。 要创建实例,请键入:

  • sudo omd create monitoring sudo omd创建监视

The omd tool will set up everything for us automatically. The command output will look similar to the following:

omd工具将自动为我们设置所有内容。 命令输出将类似于以下内容:

Output
Adding /opt/omd/sites/monitoring/tmp to /etc/fstab.
Creating temporary filesystem /omd/sites/monitoring/tmp...OK
Restarting Apache...OK
Created new site monitoring with version 1.6.0p8.cre.The site can be started with omd start monitoring.The default web UI is available at http://your_ubuntu_server/monitoring/The admin user for the web applications is cmkadmin with password: your-default-password(It can be changed with 'htpasswd -m ~/etc/htpasswd cmkadmin' as site user.)Please do a su - monitoring for administration of this site.

In this output the URL address, default username, and password for accessing our monitoring interface are highlighted. The instance is now created, but it still needs to be started. To start the instance, type:

在此输出中,突出显示了用于访问我们的监视界面的URL地址,默认用户名和密码。 现在已创建实例,但仍需要启动它。 要启动实例,请输入:

  • sudo omd start monitoringsudo omd开始监视

Now all the necessary tools and services will be started at once. At the end we we’ll see an output verifying that all our services have started successfully:

现在,所有必要的工具和服务将立即启动。 最后,我们将看到一个输出,验证我们的所有服务已成功启动:

Output
Starting mkeventd...OK
Starting rrdcached...OK
Starting npcd...OK
Starting nagios...OK
Starting apache...OK
Initializing Crontab...OK

The instance is up and running.

该实例已启动并正在运行。

To access the Checkmk instance, open http://your_ubuntu_server_ip/monitoring/ in the web browser. You will be prompted for a password. Use the default credentials printed beforehand on the screen; we will change these defaults later on.

要访问Checkmk实例,请在Web浏览器中打开http:// your_ubuntu_server_ip /monitoring/ 。 系统将提示您输入密码。 使用屏幕上预先打印的默认凭据; 我们将在以后更改这些默认设置。

The Checkmk screen opens with a dashboard, which shows all our services and server statuses in lists, and it uses practical graphs resembling the Earth. Straight after installation these are empty, but we will shortly make it display statuses for our services and systems.

Checkmk屏幕随即打开,其中包含一个仪表板,该仪表板以列表形式显示了我们的所有服务和服务器状态,并且使用了类似于地球的实用图形。 安装后,这些内容立即为空,但是我们很快将使其显示我们的服务和系统的状态。

In the next step, we will change the default password to secure the site using this interface.

下一步,我们将使用此界面更改默认密码以保护网站。

步骤4 —更改您的管理密码 (Step 4 — Changing Your Administrative Password)

During installation, Checkmk generates a random password for the cmkadmin administrative user. This password is meant to be changed upon installation, and as such it is often short and not very secure. We can change this via the web interface.

在安装过程中,Checkmk会为cmkadmin管理用户生成一个随机密码。 此密码是在安装时更改的,因此通常很短且不太安全。 我们可以通过Web界面更改此设置。

First, open the Users page from the WATO - Configuration menu on the left. The list will show all users that currently have access to the Checkmk site. On a fresh installation it will list only two users. The first one, automation, is intended for use with automated tools; the second is the cmkadmin user we used to log in to the site.

首先,从左侧的WATO-配置菜单打开“ 用户”页面。 该列表将显示当前有权访问Checkmk站点的所有用户。 在全新安装中,它将仅列出两个用户。 第一个是automation ,旨在与自动化工具一起使用。 第二个是我们用来登录站点的cmkadmin用户。

Click on the pencil icon next to the cmkadmin user to change its details, including the password.

单击cmkadmin用户旁边的铅笔图标以更改其详细信息,包括密码。

Update the password, add an admin email, and make any other desired changes.

更新密码,添加管理员电子邮件,然后进行其他所需的更改。

After saving the changes we will be asked to log in again using our new credentials. Do so and return to the dashboard, where there is one more thing we must do to fully apply our new configuration.

保存更改后,将要求我们使用新凭据再次登录。 这样做,然后返回到仪表板,在该仪表板上,我们还必须做一件事才能完全应用我们的新配置。

Once again open the Users page from the WATO - Configuration menu on the left. The orange button in the top left corner labeled as 1 Change tells us that we have made some changes to the configuration of Checkmk, and that we need to save and activate them. This will happen every time we change the configuration of our monitoring system, not only after editing a user’s credentials. To save and activate pending changes we have to click on this button and agree to activate the listed changes using the Activate affected option on the following screen.

再次从左侧的WATO-配置菜单中打开“ 用户”页面。 左上角标记为1 Change的橙色按钮告诉我们我们对Checkmk的配置进行了一些更改,我们需要保存并激活它们。 每当我们更改监视系统的配置时,不仅在编辑用户凭据后,这种情况都会发生。 要保存和激活悬而未决的更改,我们必须单击此按钮并同意使用以下屏幕上的“ 激活受影响的”选项来激活列出的更改。

After activating the changes the new user’s data is written to the configuration files and it will be used by all the system’s components. Checkmk automatically takes care of notifying individual monitoring system components, reloading them when necessary, and managing all the needed configuration files.

激活更改后,新用户的数据将被写入配置文件,并将由所有系统组件使用。 Checkmk自动负责通知各个监视系统组件,在必要时重新加载它们以及管理所有需要的配置文件。

The Checkmk installation is now ready for use. In the next step, we will add the first host to our monitoring system.

Checkmk安装现在可以使用了。 在下一步中,我们将第一台主机添加到我们的监视系统中。

步骤5 —监视第一台主机 (Step 5 — Monitoring the First Host)

We are now ready to monitor the first host. To accomplish this, we will first install check-mk-agent on the Ubuntu server. Then, we’ll restrict access to the monitoring data using xinetd.

现在,我们准备监视第一台主机。 为此,我们将首先在Ubuntu服务器上安装check-mk-agent 。 然后,我们将使用xinetd限制对监视数据的访问。

The components installed with Checkmk are responsible for receiving, storing, and presenting monitoring information. They do not provide the information itself.

Checkmk随附的组件负责接收,存储和显示监视信息。 他们不提供信息本身。

To gather the actual data, we will use Checkmk agent. Designed specifically for the job, Checkmk agent is capable of monitoring all vital system components at once and reporting that information back to the Checkmk instance.

为了收集实际数据,我们将使用Checkmk代理 。 Checkmk代理专为这项工作而设计,能够立即监视所有重要的系统组件,并将该信息报告给Checkmk实例。

安装代理 (Installing the agent)

The first host we will monitor will be your_ubuntu_server—the server on which we have installed the Checkmk instance itself.

我们将监视的第一台主机是your_ubuntu_server ,即我们自己安装Checkmk实例的服务器。

To begin, we must install the Checkmk agent. Packages for all major distributions, including Ubuntu, are available directly from the web interface. Open the Monitoring Agents page from the WATO - Configuration menu on the left. You will see the available agent downloads with the most popular packages under the first section labeled Packaged agents.

首先,我们必须安装Checkmk代理。 可从Web界面直接获得所有主要发行版(包括Ubuntu)的软件包。 从左侧的“ WATO-配置”菜单中打开“ 监视代理”页面。 在标为“ 打包的代理”的第一部分下,您将看到带有最受欢迎软件包的可用代理下载。

The package check-mk-agent_1.6.0p8-1_all.deb is the one suited for Debian based distributions, including Ubuntu. Copy the download link for that package from the web browser and use that address to download the package.

软件包check-mk-agent_1.6.0p8-1_all. deb check-mk-agent_1.6.0p8-1_all. deb是适合基于Debian的发行版(包括Ubuntu)的一种。 从网络浏览器复制该软件包的下载链接,然后使用该地址下载该软件包。

  • wget http://your_ubuntu_server_ip/monitoring/check_mk/agents/check-mk-agent_1.6.0p8-1_all.deb

    wget http:// your_ubuntu_server_ip /monitoring/check_mk/agents/check-mk-agent_1.6.0p8-1_all.deb

After downloading, install the package:

下载后,安装软件包:

  • apt install -y ./check-mk-agent_1.6.0p8-1_all.deb apt install -y ./check-mk-agent_1.6.0p8-1_all.deb

Now verify that the agent has been successfully installed:

现在,验证代理已成功安装:

  • check_mk_agent check_mk_agent

The command will output a very long text that looks like gibberish but combines all vital information about the system in one place.

该命令将输出一个很长的文本,看起来像乱七八糟的东西,但是将有关系统的所有重要信息都集中在一个地方。

Output
<<<check_mk>>>
Version: 1.6.0p8
AgentOS: linux
. . .
["monitoring"]
<<<job>>>
<<<local>>>

It is the output from this command that Checkmk uses to gather status data from monitored hosts. Now, we’ll restrict access to the monitoring data with xinetd.

Checkmk使用此命令的输出来从受监视的主机收集状态数据。 现在,我们将使用xinetd限制对监视数据的访问。

使用xinetd限制对监视数据的访问 (Restricting Access to Monitoring Data Using xinetd)

By default, the data from check_mk_agent is served using xinetd, a mechanism that outputs data on a certain network port upon accessing it. This means that we can access the check_mk_agent by using telnet to port 6556 (the default port for Checkmk) from any other computer on the internet unless our firewall configuration disallows it.

默认情况下,使用xinetd为来自check_mk_agent的数据提供服务,该机制是在访问某个网络端口时将其输出数据的机制。 这意味着,我们可以访问check_mk_agent通过使用telnet端口6556 ,除非我们的防火墙配置不允许从任何其它计算机(对于Checkmk默认端口)在互联网上。

It is not a good security policy to publish vital information about servers to anyone on the internet. We should allow only hosts that run Checkmk and are under our supervision to access this data, so that only our monitoring system can gather it.

将有关服务器的重要信息发布给Internet上的任何人不是一个好的安全策略。 我们应该只允许运行Checkmk并在我们监督下的主机访问此数据,以便只有我们的监视系统才能收集它。

If you have followed the initial server setup tutorial including the steps about setting up a firewall, then access to Checkmk agent is by default blocked. It is, however, a good practice to enforce these access restrictions directly in the service configuration and not rely only on the firewall to guard it.

如果您已遵循初始服务器设置指南(包括有关设置防火墙的步骤),则默认情况下将阻止访问Checkmk代理。 但是,最好在服务配置中直接实施这些访问限制,而不仅仅是依靠防火墙来保护它。

To restrict access to the agent data, we have to edit the configuration file at /etc/xinetd.d/check_mk. Open the configuration file in your favorite editor. To use nano, type:

为了限制对代理数据的访问,我们必须在/etc/xinetd.d/check_mk上编辑配置文件。 在您喜欢的编辑器中打开配置文件。 要使用nano,请键入:

  • sudo nano /etc/xinetd.d/check_mk 须藤nano /etc/xinetd.d/check_mk

Locate this section:

找到此部分:

/etc/xinetd.d/check_mk
/etc/xinetd.d/check_mk
. . .
# configure the IP address(es) of your Nagios server here:
#only_from      = 127.0.0.1 10.0.20.1 10.0.20.2
. . .

The only_from setting is responsible for restricting access to certain IP addresses. Because we are now working on monitoring the same server that Checkmk is running on, it is ok to allow only localhost to connect. Uncomment and update the configuration setting to:

only_from设置负责限制对某些IP地址的访问。 因为我们现在正在监视Checkmk所运行的同一服务器,所以只允许localhost连接是可以的。 取消注释并将配置设置更新为:

/etc/xinetd.d/check_mk
/etc/xinetd.d/check_mk
. . .
# configure the IP address(es) of your Nagios server here:
only_from      = 127.0.0.1
. . .

Save and exit the file.

保存并退出文件。

The xinetd daemon has to be restarted for changes to take place. Do so now:

必须重新启动xinetd守护程序才能进行更改。 现在就这样做:

  • sudo systemctl restart xinetd sudo systemctl重新启动xinetd

Now our agent is up and running and restricted to accept only local connections. We can proceed to configure monitoring for that host using Checkmk.

现在,我们的代理已启动并正在运行,并且仅接受本地连接。 我们可以继续使用Checkmk为该主机配置监视。

在Checkmk Web界面中配置主机 (Configuring Host in Checkmk Web Interface)

First, to add a new host to monitor we have to go to the Hosts menu in the WATO - Configuration menu on the left. From here click Create new host. We will be asked for some information about the host.

首先,要添加新的主机进行监视,我们必须转到左侧“ WATO-配置”菜单中的“ 主机”菜单。 从此处单击“ 创建新主机” 。 我们将被要求提供有关主机的一些信息。

The Hostname is the familiar name that Checkmk will use for the monitoring. It may be a fully-qualified domain name, but it is not necessary. In this example, we will name the host monitoring, just like the name of the Checkmk instance itself. Because monitoring is not resolvable to our IP address, we also have to provide the IP address of our server. And since we are monitoring the local host, the IP will simply be 127.0.0.1. Check the IPv4 Address box to enable the manual IP input and enter the value in the text field.

主机名是Checkmk将用于监视的熟悉名称。 它可能是完全合格的域名,但这不是必需的。 在此示例中,我们将为主机monitoring命名,就像Checkmk实例本身的名称一样。 由于monitoring无法解析为我们的IP地址,因此我们还必须提供服务器的IP地址。 并且由于我们正在监视本地主机,因此IP仅为127.0.0.1 。 选中“ IPv4地址”框以启用手动IP输入,然后在文本字段中输入值。

The default configuration of the Data Sources section relies on Checkmk agent to provide monitoring data, which is fine. The Networking Segment setting is used to denote hosts on remote networks, which are characterized by a higher expected latency that is not a sign of malfunction. Since this is a local host, the default setting is fine as well.

数据源部分的默认配置依靠Checkmk代理来提供监视数据,这很好。 “ 网络段”设置用于表示远程网络上的主机,这些主机的特点是预期的等待时间较长,这并不是故障的征兆。 由于这是本地主机,因此默认设置也很好。

To save the host and configure which services will be monitored, click the Save & go to services button.

要保存主机并配置要监视的服务,请单击“ 保存并转到服务”按钮。

Checkmk will do an automatic inventory. That means it will gather the output from the agent and decipher it to know what kinds of services it can monitor. All available services for monitoring will be on the list, including CPU load, memory usage, and free space on disks.

Checkmk会自动进行盘点。 这意味着它将收集来自代理的输出并对其进行解密,以了解它可以监视哪些服务。 所有可用的监视服务都将列在列表中,包括CPU负载,内存使用率和磁盘上的可用空间。

To enable monitoring of all discovered services, we have to click the Monitor button under the Undecided services (currently not monitored) section. This will refresh the page, but now all services will be listed under the Monitored services section, informing us that they are indeed being monitored.

要启用对所有发现的服务的监视,我们必须单击“ 未确定的服务(当前未监视)”部分下的“ 监视”按钮。 这将刷新页面,但是现在所有服务都将在“ 监视的服务”部分下列出,通知我们确实受到监视。

As was the case when changing our user password, these new changes must be saved and activated before they go live. Press the 2 changes button and accept the changes using the Activate affected button. After that, the host monitoring will be up and running.

与更改我们的用户密码一样,这些新更改必须保存并激活,然后才能生效。 按2个更改按钮,然后使用“ 激活受影响的按钮”接受更改。 之后,主机监视将启动并运行。

Now you are ready to work with your server data. Take a look at the main dashboard using the Overview/Main Overview menu item on the left.

现在,您可以使用服务器数据了。 使用左侧的Overview / Main Overview菜单项查看主仪表板。

使用监控数据 (Working with Monitoring Data)

Now let’s take a look at the main dashboard using the Overview/Main Overview menu item on the left:

现在,让我们使用左侧的Overview / Main Overview菜单项查看主仪表板:

The Earth sphere is now fully green and the table says that one host is up with no problems. We can see the full host list, which now consists of a single host, in the Hosts/All hosts view (using the menu on the left).

现在地球球体已完全绿色,桌子上显示一台主机正常运行。 我们可以在“ 主机/所有主机”视图(使用左侧菜单)中看到完整的主机列表,该列表现在由一个主机组成。

There we will see how many services are in good health (shown in green), how many are failing, and how many are pending to be checked. After clicking on the hostname we will be able to see the list of all services with their full statuses and their Perf-O-Meters. Perf-O-Meter shows the performance of a single service relative to what Checkmk considers to be good health.

在那里,我们将看到有多少服务状况良好(以绿色显示),有多少服务失败以及有多少服务待检查。 单击主机名后,我们将能够看到所有服务及其完整状态及其Perf-O-Meters的列表Perf-O-Meter相对于Checkmk认为良好的状况显示了一项服务的性能。

All services that return graphable data display a graph icon next to their name. We can use that icon to get access to graphs associated with the service. Since the host monitoring is fresh, there is almost nothing on the graphs—but after some time the graphs will provide valuable information on how our service performance changes over time.

所有返回可图形化数据的服务在其名称旁边都会显示一个图形图标。 我们可以使用该图标来访问与服务关联的图形。 由于主机监视是最新的,所以图表上几乎没有任何内容-但是一段时间后,图表将提供有关我们的服务性能如何随时间变化的有价值的信息。

When any of these services fails or recovers, the information will be shown on the dashboard. For failing services a red error will be shown, and the problem will also be visible on the Earth graph.

当这些服务中的任何一个失败或恢复时,该信息将显示在仪表板上。 对于失败的服务,将显示红色错误,并且该问题也将在“地球”图上可见。

After recovery, everything will be shown in green as working properly, but the event log on the right will contain information about past failures.

恢复后,一切将以绿色显示为正常工作,但是右侧的事件日志将包含有关过去故障的信息。

Now that we have explored the dashboard a little, let’s add a second host to our monitoring instance.

现在,我们已经对仪表板进行了一些探索,让我们向监视实例添加第二个主机。

步骤6 —监视第二个CentOS主机 (Step 6 — Monitoring a Second CentOS Host)

Monitoring gets really useful when you have multiple hosts. We will now add a second server to our Checkmk instance, this time running CentOS 7.

当您有多个主机时,监视将变得非常有用。 现在,我们将第二台服务器添加到我们的Checkmk实例,这次运行CentOS 7。

As with our Ubuntu server, installing Checkmk agent is necessary to gather monitoring data on CentOS. This time, however, we will need an rpm package from the Monitoring Agents page in the web interface, called check-mk-agent-1.6.0p8-1.noarch.rpm.

与我们的Ubuntu服务器一样,必须安装Checkmk代理才能在CentOS上收集监视数据。 但是,这一次,我们需要从Web界面的“ 监视代理程序”页面中获得一个名为check-mk-agent-1.6.0p8-1.noarch. rpmrpm软件包check-mk-agent-1.6.0p8-1.noarch. rpm check-mk-agent-1.6.0p8-1.noarch. rpm

First, however, we must install xinetd, which by default is not available on the CentOS installation. Xinetd, we will remember, is a daemon that is responsible for making the monitoring data provided by check_mk_agent available over the network.

但是,首先,我们必须安装xinetd ,默认情况下在CentOS安装中不可用。 Xinetd ,我们会记住,是一个守护进程,负责制作提供的监测数据check_mk_agent可在网络上。

On your CentOS server, first install xinetd:

在您的CentOS服务器上,首先安装xinetd

  • sudo yum install -y xinetd 须藤yum install -y xinetd

Now we can download and install the monitoring agent package needed for our CentOS server:

现在,我们可以下载并安装CentOS服务器所需的监视代理程序软件包:

  • sudo yum install -y http://your_ubuntu_server_ip/monitoring/check_mk/agents/check-mk-agent-1.6.0p8-1.noarch.rpm

    sudo yum install -y http:// your_ubuntu_server_ip /monitoring/check_mk/agents/check-mk-agent-1.6.0p8-1.noarch.rpm

Just like before, we can verify that the agent is working properly by executing check_mk_agent:

和以前一样,我们可以通过执行check_mk_agent来验证代理是否正常工作:

  • sudo check_mk_agent 须藤check_mk_agent

The output will be similar to that from the Ubuntu server. Now we will restrict access to the agent.

输出将类似于来自Ubuntu服务器的输出。 现在,我们将限制对代理的访问。

限制访问 (Restricting Access)

This time we will not be monitoring a local host, so xinetd must allow connections coming from the Ubuntu server, where Checkmk is installed, to gather the data. To allow that, first open your configuration file:

这次我们将不再监视本地主机,因此xinetd必须允许来自安装Checkmk的Ubuntu服务器的连接收集数据。 为此,请首先打开您的配置文件:

  • sudo vi /etc/xinetd.d/check_mk 须藤vi /etc/xinetd.d/check_mk

Here you will see the configuration for your check_mk service, specifying how Checkmk agent can be accessed through the xinetd daemon. Find the following two commented lines:

在这里,您将看到check_mk服务的配置,指定如何通过xinetd守护程序访问Checkmk代理。 找到以下两条注释行:

/etc/xinetd.d/check_mk
/etc/xinetd.d/check_mk
. . .
# configure the IP address(es) of your Nagios server here:
#only_from      = 127.0.0.1 10.0.20.1 10.0.20.2
. . .

Now uncomment the second line and replace the local IP addresses with your_ubuntu_server_ip:

现在取消注释第二行,并用your_ubuntu_server_ip替换本地IP地址:

/etc/xinetd.d/check_mk
/etc/xinetd.d/check_mk
. . .
# configure the IP address(es) of your Nagios server here:
only_from      = your_ubuntu_server_ip
. . .

Save and exit the file by typing :x and then ENTER. Restart the xinetd service using:

通过输入:x然后ENTER保存并退出文件。 使用以下命令重新启动xinetd服务:

  • sudo systemctl restart xinetd sudo systemctl重新启动xinetd

We can now proceed to configure Checkmk to monitor our CentOS 7 host.

我们现在可以继续配置Checkmk来监视我们的CentOS 7主机。

在Checkmk中配置新主机 (Configuring the New Host in Checkmk)

To add additional hosts to Checkmk, we use the Hosts menu just like before. This time we will name the host centos, configure its IP address, and choose WAN (high-latency) under the Networking Segment select box, since the host is on another network. If we skipped this and left it as local, Checkmk would soon alert us that the host is down, since it would expect it to respond to agent queries much quicker than is possible over the internet.

要将其他主机添加到Checkmk,我们就像以前一样使用“ 主机”菜单。 这次,我们将主机命名为centos ,配置其IP地址,并在Networking Segment选择框下选择WAN(高延迟) ,因为主机位于另一个网络上。 如果我们跳过此操作并将其保留为本地,Checkmk会很快通知我们该主机已关闭,因为它希望它对代理查询的响应比在Internet上更快。

Click Save & go to services, which will show services available for monitoring on the CentOS server. The list will be very similar to the one from the first host. Again, this time we also must click Monitor and then activate the changes using the orange button on the top left corner.

单击“ 保存并转到服务” ,它将显示可用于在CentOS服务器上进行监视的服务。 该列表将与第一台主机的列表非常相似。 同样,这次我们还必须单击Monitor ,然后使用左上角的橙色按钮激活更改。

After activating the changes, we can verify that the host is monitored on the All hosts page. Go there. Two hosts, monitoring and centos, will now be visible.

激活更改后,我们可以在“ 所有主机”页面上验证是否对该主机进行了监视。 去那里。 现在将显示两个主机( monitoringcentos

You are now monitoring an Ubuntu server and a CentOS server with Checkmk. It is possible to monitor even more hosts. In fact, there is no upper limit other than server performance, which should not be a problem until your hosts number in the hundreds. Moreover, the procedure is the same for any other host. Checkmk agents in deb and rpm packages work on Ubuntu, CentOS, and the majority of other Linux distributions.

您现在正在使用Checkmk监视Ubuntu服务器和CentOS服务器。 可以监视更多主机。 实际上,除了服务器性能外,没有其他上限,除非您的主机数量达到数百台,否则这不会成为问题。 此外,该过程对于任何其他主机都是相同的。 debrpm软件包中的Checkmk代理可在Ubuntu,CentOS和大多数其他Linux发行版上运行。

结论 (Conclusion)

In this guide we set up two servers with two different Linux distributions: Ubuntu and CentOS. We then installed and configured Checkmk to monitor both servers, and explored Checkmk’s powerful web interface.

在本指南中,我们设置了两台具有两种不同Linux发行版的服务器:Ubuntu和CentOS。 然后,我们安装并配置了Checkmk来监视这两个服务器,并探索了Checkmk强大的Web界面。

Checkmk allows for the easy setup of a complete and versatile monitoring system, which packs all the hard work of manual configuration into an easy-to-use web interface full of options and features. With these tools it is possible to monitor multiple hosts; set up email, SMS, or push notifications for problems; set up additional checks for more services; monitor accessibility and performance, and so on.

Checkmk允许轻松设置完整而通用的监视系统,该系统将所有手动配置的辛苦工作打包到一个易于使用的Web界面中,其中包含所有选项和功能。 使用这些工具可以监视多个主机。 设置电子邮件,短信或问题推送通知; 设置其他支票以获取更多服务; 监视可访问性和性能,等等。

To learn more about Checkmk, make sure to visit the official documentation.

要了解有关Checkmk的更多信息,请确保访问官方文档 。

翻译自: https://www.digitalocean.com/community/tutorials/how-to-monitor-server-health-with-checkmk-on-ubuntu-18-04

如何在Ubuntu 18.04上使用Checkmk监视服务器运行状况相关推荐

  1. centos8 配置 dns_如何在Ubuntu 18.04上设置DNS名称服务器 | linux资讯

    域名系统(DNS)是网络基础设施的核心部分,提供了将域名转换为IP地址的方法.您可以将DNS视为Internet的电话簿. 连接到Internet的每个设备都由其IP地址唯一标识.当您在浏览器中输入要 ...

  2. ubuntu配置mta_如何在Ubuntu 18.04上使用Apache为您的域配置MTA-STS和TLS报告

    ubuntu配置mta The author selected Electronic Frontier Foundation Inc to receive a donation as part of ...

  3. skype linux 安装,如何在Ubuntu 18.04上安装Skype

    Skype是世界上最流行的通信应用程序之一,它使您可以拨打免费的在线音频和视频电话,以及可负担得起的拨打全球移动电话和固定电话的国际电话. Skype不是开源应用程序,也不包含在Ubuntu存储库中. ...

  4. 如何在Ubuntu 18.04上安装Django

    Django是一个免费的开源高级Python Web框架,旨在帮助开发人员构建安全,可扩展和可维护的Web应用程序. 根据您的需要,有不同的方法来安装Django.它可以使用pip在系统范围内安装或在 ...

  5. 如何在Ubuntu 18.04上创建多节点MySQL集群

    翻译转载:https://www.digitalocean.com/community/tutorials/how-to-create-a-multi-node-mysql-cluster-on-ub ...

  6. webmin安装_如何在Ubuntu 18.04上安装Webmin

    webmin安装 Are you averse to running commands on a terminal and instead prefer managing your Linux sys ...

  7. 如何在Ubuntu 18.04上安装/卸载NodeJS

    NodeJS is a JavaScript framework that allows you to build fast network applications with ease. In th ...

  8. 如何在Ubuntu 18.04上安装Elasticsearch Logstash Kibana(Elastic Stack)

    In this guide, you will learn to install Elastic stack on Ubuntu 18.04. Elastic stack, formerly know ...

  9. 如何在Ubuntu 18.04上安装OpenCV

    本教程介绍了如何在Ubuntu 18.04上安装OpenCV. OpenCV(开源计算机视觉库)是一个开源计算机视觉库,具有C ++,Python和Java的绑定.它的用途非常广泛,包括医学图像分析, ...

最新文章

  1. 科普| 越来越火的图数据库究竟是什么?
  2. MySQL数据库https接口_第三章 mysql 数据库接口程序以及SQL语句操作
  3. [Asp.net]AspNetPager分页组件
  4. 米老鼠想吞并喜羊羊,不是赤裸裸的文化侵略是什么
  5. java 判断天是星期及_java判断日期是星期几的方法总结
  6. datax的工具配置oracle,完全小白级DataX安装配置过程详解
  7. HIVE-分桶表的详解和创建实例
  8. java控制台输出百分比进度条示例
  9. 知识图谱论文阅读(十六)【WWW2019】Knowledge Graph Convolutional Networks for Recommender
  10. 给linux添加新硬盘
  11. www.yaxjf.com+m.php,linux运维架构--PHP开发-零基础学习PHP视频教程
  12. jQuery实现彩色云标签
  13. 添加proc文件,控制sctp的debug输出
  14. 美股-史考特(Scottrade)开户详细说明
  15. eaxsinbx_高等数学导数与微分练习题
  16. 新能源车牌 普通车牌 特殊车牌正则校验
  17. 什么是学习能力?如何提高学习能力?
  18. Dell PowerEdge R640:NVMe直连、NDC网卡、PERC10一览
  19. element ui 的 el-tab 当使用 router-view 时 mounted 执行了多次
  20. 攻读学位研究计划计算机专业,拟攻读博士学位的科学研究计划书模板

热门文章

  1. 操作系统原理学习笔记(二十一)-对换
  2. FreeRTOS记录(六、FreeRTOS消息队列—Enocean模块串口通讯、RAM空间不足问题分析)
  3. 小程序-云存储web字体
  4. 关于数学库Eigen两个常用函数实现(伪逆矩阵和协方差矩阵)
  5. C#object对向转成指定Model对象
  6. MAC地址表泛洪攻击
  7. 使用润乾报表的常见问题
  8. ecahrs全国地图下钻(包括港澳台)
  9. colorbar 分享
  10. java cookie 跨域读取_跨域读写Cookie