如何在Ubuntu 18.04上安装和配置SNMP守护程序和客户端

The author selected the Internet Archive to receive a donation as part of the Write for DOnations program.

作者选择了Internet存档作为“ Write for DOnations”计划的一部分来接受捐赠。

介绍 (Introduction)

A large part of being a system administrator is collecting accurate information about your servers and infrastructure. There are a number of tools and options for gathering and processing this type of information. Many of them are built upon a technology called SNMP.

成为系统管理员的大部分时间是在收集有关服务器和基础结构的准确信息。 有许多工具和选项可用于收集和处理此类信息。 其中许多都是基于称为SNMP的技术构建的。

SNMP stands for simple network management protocol. It is a way that servers can share information about their current state, and also a channel through which an administer can modify pre-defined values. While the protocol itself is lightweight, the structure of programs that implement SNMP can quickly grow in complexity. For more information on the basics of the SNMP protocol, see our An Introduction to SNMP article.

SNMP代表简单的网络管理协议。 服务器可以通过这种方式共享有关其当前状态的信息,也可以通过这种渠道管理员可以修改预定义的值。 尽管协议本身是轻量级的,但实现SNMP的程序的结构却可能很快变得复杂。 有关SNMP协议基础的详细信息,请参阅我们的SNMP简介文章。

In this guide, you will set up the tools to communicate using SNMP. You will be using two Ubuntu 18.04 servers to demonstrate. One will contain the SNMP manager, which will talk to the agent to implement network devices. This will be called the manager server. The other server will have the SNMP agent, which will act on the orders from the manager server. This will be called the agent server. You could choose to install the agent on the manager machine as well, but keeping them separate makes it easier to demonstrate what functionality is provided by each component.

在本指南中,您将设置工具以使用SNMP进行通信。 您将使用两个Ubuntu 18.04服务器进行演示。 其中一个将包含SNMP管理器 ,它将与代理对话以实现网络设备。 这将称为管理器服务器 。 另一台服务器将具有SNMP代理 ,它将根据管理器服务器的订单进行操作。 这将称为代理服务器 。 您也可以选择将代理程序安装在管理器计算机上,但是将它们分开放置可以更轻松地演示每个组件提供的功能。

先决条件 (Prerequisites)

To follow this tutorial, you will need:

要遵循本教程,您将需要:

第1步-安装SNMP守护程序和实用程序 (Step 1 — Installing the SNMP Daemon and Utilities)

You can begin to explore how SNMP can be implemented on a system by installing the daemon and tools on your Ubuntu servers.

您可以开始研究如何通过在Ubuntu服务器上安装守护程序和工具在系统上实现SNMP。

From your local machine, log into the manager server as your non-root user:

在您的本地计算机上,以您的非root用户身份登录到Manager服务器

  • ssh your_username@manager_server_ip_address

    ssh your_username @ manager_server_ip_address

Update the package index for the APT package manager:

更新APT软件包管理器的软件包索引:

  • sudo apt update

    sudo apt更新

Next, install the SNMP software:

接下来,安装SNMP软件:

  • sudo apt install snmp snmp-mibs-downloader

    sudo apt安装snmp snmp-mibs-downloader

The snmp package provides a collection of command line tools for issuing SNMP requests to agents. The snmp-mibs-downloader package will help to install and manage Management Information Base (MIB) files, which keep track of network objects.

snmp软件包提供了一些命令行工具集合,用于向代理发出SNMP请求。 snmp-mibs-downloader软件包将帮助安装和管理管理信息库(MIB)文件,该文件可跟踪网络对象。

Then, open up a new terminal on your local machine and log into the agent server:

然后,在本地计算机上打开一个新终端,并登录到代理服务器

  • ssh your_username@agent_server_ip_address

    ssh your_username @ agent_server_ip_address

On the agent server, update the package index:

代理服务器上 ,更新程序包索引:

  • sudo apt update

    sudo apt更新

Then, install the SNMP daemon

然后,安装SNMP守护程序

  • sudo apt install snmpd

    sudo apt安装snmpd

Note that you do not need the snmp-mibs-downloader package, since the agent server will not be managing MIB files.

请注意,您不需要snmp-mibs-downloader软件包,因为代理服务器将不会管理MIB文件。

Now that you have installed these components, you will configure your manager server.

现在,您已经安装了这些组件,您将配置经理服务器

步骤2 —配置SNMP管理器服务器 (Step 2 — Configuring the SNMP Manager Server)

As mentioned before, most of the bulk of the work happens in the agent server, so your configuration on the manager server will be less involved. You just need to modify one file to make sure that SNMP tools can use the extra MIB data you installed.

如前所述,大部分工作都在代理服务器中进行 ,因此您在管理器服务器上的配置将减少。 您只需

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值