Skip to main content

此版本的 GitHub Enterprise 已停止服务 2022-10-12. 即使针对重大安全问题,也不会发布补丁。 为了获得更好的性能、更高的安全性和新功能,请升级到最新版本的 GitHub Enterprise。 如需升级帮助,请联系 GitHub Enterprise 支持

Monitoring using SNMP

GitHub Enterprise provides data on disk usage, CPU utilization, memory usage, and more over SNMP.

SNMP is a common standard for monitoring devices over a network. We strongly recommend enabling SNMP so you can monitor the health of your GitHub Enterprise Server instance and know when to add more memory, storage, or processor power to the host machine.

GitHub Enterprise has a standard SNMP installation, so you can take advantage of the many plugins available for Nagios or for any other monitoring system.

Configuring SNMP v2c

  1. 从 GitHub Enterprise Server 上的管理帐户任意页面的右上角,单击

    用于访问站点管理员设置的火箭图� �的屏幕截图

  2. 如果� 尚未在“站点管理员”页上,请在左上角单击“站点管理员”。

    “站点管理员”链接的屏幕截图

  3. 在左侧边� �中,单击“管理控制台”。 左侧边� �中的 管理控制台 选项卡

  4. 在左侧边� �中,单击“监视”。 “监视”选项卡

  5. 在“监视”下,选择“启用 SNMP”。 启用 SNMP 的按钮

  6. In the Community string field, enter a new community string. If left blank, this defaults to public. Field to add the community string

  7. 在左侧边� �下,单击“保存设置”。

    管理控制台 中的“保存设置”按钮的屏幕截图

    注意:保存 管理控制台 中的设置会重启系统服务,这可能会导致用户可察觉的停机时间。

  8. 等待配置运行完毕。

    配置实例

  9. Test your SNMP configuration by running the following command on a separate workstation with SNMP support in your network:

    # community-string is your community string
    # hostname is the IP or domain of your Enterprise instance
    $ snmpget -v 2c -c COMMUNITY-STRING -O e HOSTNAME hrSystemDate.0

This should return the system time on your GitHub Enterprise Server instance host.

User-based security

If you enable SNMP v3, you can take advantage of increased user based security through the User Security Model (USM). For each unique user, you can specify a security level:

  • noAuthNoPriv: This security level provides no authentication and no privacy.
  • authNoPriv: This security level provides authentication but no privacy. To query the appliance you'll need a username and password (that must be at least eight characters long). Information is sent without encryption, similar to SNMPv2. The authentication protocol can be either MD5 or SHA and defaults to SHA.
  • authPriv: This security level provides authentication with privacy. Authentication, including a minimum eight-character authentication password, is required and responses are encrypted. A privacy password is not required, but if provided it must be at least eight characters long. If a privacy password isn't provided, the authentication password is used. The privacy protocol can be either DES or AES and defaults to AES.

Configuring users for SNMP v3

  1. 从 GitHub Enterprise Server 上的管理帐户任意页面的右上角,单击

    用于访问站点管理员设置的火箭图� �的屏幕截图

  2. 如果� 尚未在“站点管理员”页上,请在左上角单击“站点管理员”。

    “站点管理员”链接的屏幕截图

  3. 在左侧边� �中,单击“管理控制台”。 左侧边� �中的 管理控制台 选项卡

  4. 在左侧边� �中,单击“监视”。 “监视”选项卡

  5. 在“监视”下,选择“启用 SNMP”。 启用 SNMP 的按钮

  6. Select SNMP v3. Button to enable SNMP v3

  7. In "Username", type the unique username of your SNMP v3 user. Field to type the SNMP v3 username

  8. In the Security Level dropdown menu, click the security level for your SNMP v3 user. Dropdown menu for the SNMP v3 user's security level

  9. For SNMP v3 users with the authnopriv security level: Settings for the authnopriv security level

    • 在“Authentication password(身份验证密� �)”中,键入身份验证密� �。
    • 在“身份验证密� �”右侧的“协议”下拉菜单中,单击要使用的身份验证协议。
  10. For SNMP v3 users with the authpriv security level: Settings for the authpriv security level

    • 在“Authentication password(身份验证密� �)”中,键入身份验证密� �。
    • 在“身份验证密� �”右侧的“协议”下拉菜单中,单击要使用的身份验证协议。
    • Optionally, in "Privacy password", type the privacy password.
    • On the right side of "Privacy password", in the Protocol dropdown menu, click the privacy protocol method you want to use.
  11. Click Add user. Button to add SNMP v3 user

  12. 在左侧边� �下,单击“保存设置”。

    管理控制台 中的“保存设置”按钮的屏幕截图

    注意:保存 管理控制台 中的设置会重启系统服务,这可能会导致用户可察觉的停机时间。

  13. 等待配置运行完毕。

    配置实例

Querying SNMP data

Both hardware and software-level information about your appliance is available with SNMP v3. Due to the lack of encryption and privacy for the noAuthNoPriv and authNoPriv security levels, we exclude the hrSWRun table (1.3.6.1.2.1.25.4) from the resulting SNMP reports. We include this table if you're using the authPriv security level. For more information, see the "OID reference documentation."

With SNMP v2c, only hardware-level information about your appliance is available. The applications and services within GitHub Enterprise do not have OIDs configured to report metrics. Several MIBs are available, which you can see by running snmpwalk on a separate workstation with SNMP support in your network:

# community-string is your community string
# hostname is the IP or domain of your Enterprise instance
$ snmpwalk -v 2c -c COMMUNITY-STRING -O e HOSTNAME

Of the available MIBs for SNMP, the most useful is HOST-RESOURCES-MIB (1.3.6.1.2.1.25). See the table below for some important objects in this MIB:

NameOIDDescription
hrSystemDate.21.3.6.1.2.1.25.1.2The hosts notion of the local date and time of day.
hrSystemUptime.01.3.6.1.2.1.25.1.1.0How long it's been since the host was last initialized.
hrMemorySize.01.3.6.1.2.1.25.2.2.0The amount of RAM on the host.
hrSystemProcesses.01.3.6.1.2.1.25.1.6.0The number of process contexts currently loaded or running on the host.
hrStorageUsed.11.3.6.1.2.1.25.2.3.1.6.1The amount of storage space consumed on the host, in hrStorageAllocationUnits.
hrStorageAllocationUnits.11.3.6.1.2.1.25.2.3.1.4.1The size, in bytes, of an hrStorageAllocationUnit

For example, to query for hrMemorySize with SNMP v3, run the following command on a separate workstation with SNMP support in your network:

# username is the unique username of your SNMP v3 user
# auth password is the authentication password
# privacy password is the privacy password
# hostname is the IP or domain of your Enterprise instance
$ snmpget -v 3 -u USERNAME -l authPriv \
  -A "AUTH PASSWORD" -a SHA \
  -X "PRIVACY PASSWORD" -x AES \
  -O e HOSTNAME HOST-RESOURCES-MIB::hrMemorySize.0

With SNMP v2c, to query for hrMemorySize, run the following command on a separate workstation with SNMP support in your network:

# community-string is your community string
# hostname is the IP or domain of your Enterprise instance
snmpget -v 2c -c COMMUNITY-STRING HOSTNAME HOST-RESOURCES-MIB::hrMemorySize.0

Note: To prevent leaking information about services running on your appliance, we exclude the hrSWRun table (1.3.6.1.2.1.25.4) from the resulting SNMP reports unless you're using the authPriv security level with SNMP v3. If you're using the authPriv security level, we include the hrSWRun table.

For more information on OID mappings for common system attributes in SNMP, see "Linux SNMP OID’s for CPU, Memory and Disk Statistics".