Overview

SNMP stands for Simple Network Management Protocol, a protocol used to manage the devices in the network. ZStack Cloud provides the SNMP Management service. After you enable and configure this feature, you can obtain monitoring data of ZStack Cloud resources on a 3rd-party platform (such as an SNMP monitoring platform like ZABBIX) and receive alarms pushed by ZStack Cloud.

This document explains how to enable and configure the SNMP Management feature.

Quick Start Guide

Obtain Monitoring Data via SNMP

  1. Prepare an SNMP monitoring platform and MIB browser.
  2. Log in to ZStack Cloud, enable SNMP Management and configure required parameters.
  3. Download and view the ZStack Cloud MIB file.
  4. Log in to the SNMP monitoring platform, connect to ZStack Cloud and add monitoring items based on the MIB file.
  5. View monitoring data of ZStack Cloud resources on the SNMP monitoring platform.

Receive Alarm Messages via SNMP

  1. Prepare an SNMP monitoring platform and configure its Trap service.
  2. Log in to ZStack Cloud, enable SNMP Management and add an SNMP Trap receiver.
  3. Create an alarm endpoint of the SNMP Trap receiver type.
  4. Create an alarm and attach the SNMP Trap receiver endpoint to the alarm.
  5. Log in to the SNMP monitoring platform and connect to ZStack Cloud.
  6. When an ​​alarm is triggered​​, the SNMP monitoring platform can receive alarm messages pushed by ZStack Cloud.

Typical Scenarios

View Monitoring Data of the Cloud Resources via SNMP Platform

About this task

With the SNMP protocol, you can view monitoring data of ZStack Cloud resources on a 3rd-party platform and receive alarm messages pushed by ZStack Cloud. This chapter mainly explains how to obtain monitoring data of ZStack Cloud resources on a 3rd-party platform via SMNP.

Currently, you can obtain monitoring data for these resources via SNMP: hosts, primary storage, image storage, VM instances, and VPC vRouters.

This scenario takes the ZABBIX platform as an example. You can also use other SNMP platforms.

Configuration Information

The following table lists the basic configurations in this scenario.
ZStack Cloud Information ZABBIX Platform Information SNMP Protocol Information
Management Node IP: 172.26.51.91 Server IP: 172.26.51.240 Protocol Version: v2c
SNMP Agent Port: 1161 Community: v2c-test
The practical procedure is as follows:
  1. Prepare the ZABBIX platform and MIB Browser.
  2. Log in to ZStack Cloud and enable SNMP Management.
  3. Download the ZStack Cloud MIB file and view OIDs of resource monitoring items.
  4. Log in to the ZABBIX platform and connect to ZStack Cloud.
  5. Add monitoring items on the ZABBIX platform.
  6. View monitoring data of ZStack Cloud resources on the ZABBIX platform.

Procedure

  1. Prepare the ZABBIX platform and MIB browser.
    1. Prepare an SNMP monitoring platform that gets monitoring data from the Cloud resources through SNMP. This scenario uses ZABBIX.
    2. Prepare an MIB browser tool to view the ZStack Cloud MIB file. Click here to download the tool.
  2. Log in to ZStack Cloud and enable SNMP Management.
    On the main menu of ZStack Cloud, choose Settings > Platform Setting > SNMP Management. Then, the SNMP Management page is displayed. On the SNMP Management page, click Enable. The Enable SNMP Management page is displayed.
    Set the following parameters on the displayed page:
    • SNMP Agent Port: Set the port on the management node for receiving and responding to requests from ZABBIX. Default: 1161.
    • Protocol Version: Select v2c or v3. In this scenario, use v2c.
    • Community: Set a community for authentication between ZABBIX and the Cloud. In this scenario, use v2c-test.
    • SNMP Trap Receiver: Optional. Add a 3rd-party server to receive alarm messages pushed by the Cloud. You can add the receiver during or after enabling SNMP Management. Leave the SNMP Trap receiver unconfigured for this scenario.
    Figure 1. Enable SNMP Management


  3. Download the ZStack Cloud MIB file and view OIDs for resource monitoring items.
    1. On ZStack Cloud, click Download MIB in the upper-right corner of the SNMP Management page.
      Figure 2. Download MIB File


    2. Open MIB Browser. On the main menu, click Advanced... and configure SNMP Agent by setting the following parameters:
      • Address: Enter the IP address of the ZStack Cloud management node.
      • Port: Enter the SNMP Agent port of ZStack Cloud. In this scenario, enter 1161.
      • Read Community: Enter the community set in ZStack Cloud. In this scenario, enter v2c-test.
      • Write Community: Optional. Leave blank in this scenario.
      • SNMP Version: Select the SNMP version set in ZStack Cloud. In this scenario, select v2.
      Figure 3. Configure SNMP Agent Information in MIB Browser


    3. On the main menu of MIB Browser, click File > Load MIBs. Open the MIB file downloaded from ZStack Cloud.
      The MIB file contains monitoring items for five resource types: Host (kvmHost), Primary Storage (primaryStorage), Image Storage (backupStorage), VM instance (vm), VPC vRouter (vRouter).
    4. Expand the resource category folders to view OIDs for resource monitoring:
      Resource monitoring OIDs consist of two parts: the OID prefix and resource Index Value.
      • OID Prefix: The OID prefix identifies a monitoring item. In an expanded MIB directory, you can click any monitoring item to view its OID prefix.
      • Resource Index Value: Resource Index Value identifies the monitored resource. Right-click a resource Table (for example: kvmHostTable) and choose Table View. Then you can view Index Values for resources in the Index Value column.
      • Example:
        • The OID prefix for Host free memory percentage (memoryFreeInPercent): .1.3.6.1.4.1.60687.1.1.101.101.1.25
        • The Index Value for Host A (UUID: bf6c3abe4fff41f5b6212d9a64fe2480): 49004.15038.20479.16885.46625.11674.25854.9344
        • The Index Value for Host B (UUID: d23cf9c3839c47a9af056fd3f0829f7f): 53820.63939.33692.18345.44805.28627.61570.40831
        • Complete OID for monitoring Host A free memory: .1.3.6.1.4.1.60687.1.1.101.101.1.25.49004.15038.20479.16885.4
        • Complete OID for monitoring Host B free memory: .1.3.6.1.4.1.60687.1.1.101.101.1.25.53820.63939.33692.18345.44805.28627.61570.40831
      Figure 4. OID Prefix for Monitoring Items


      Figure 5. Resource Index Value


      Figure 6. Complete OID


  4. Log in to the ZABBIX platform and connect to ZStack Cloud.
    On the ZABBIX main menu, choose Configuration > Hosts. The Hosts page is displayed. On this page, click Create Host. The New Host page is displayed. Add ZStack Cloud as a host to ZABBIX.
    Set the following parameters on the displayed page:
    • Host Name: Enter a host name. In this scenario, enter Cloud.
    • Group: Select a group for the host.
    • Interface: Click Add > SNMP. Set the following parameters:
      • IP address: Enter the IP address of the ZStack Cloud management node.
      • Connect to: Select Connect to IP.
      • Port: Enter the SNMP Agent port set in ZStack Cloud. In this scenario, enter 1161.
      • SNMP version: Select the SNMP version. The version need to match the configuration in ZStack Cloud. In this scenario, select SNMPv2.
      • SNMP community: Enter the community set in ZStack Cloud. In this scenario, use v2c-test.
      • Set other parameters as needed.
    Figure 7. Connect ZStack Cloud to ZABBIX


    The connected ZStack Cloud appears in the ZABBIX Hosts list. Wait a few minutes. Check the Availability column. Green status indicates successful connection.
    Figure 8. Successful Connection to ZStack Cloud


  5. Add monitoring items on the ZABBIX platform.
    Three methods are available to connect ZStack Cloud monitoring items to ZABBIX: Connect single resource monitoring items, Connect batch resource monitoring items, Import full-set resource monitoring items. Using batch connection or full-set import is recommended.
    • Connect single resource monitoring items:

      On the ZABBIX main menu, choose Configuration > Hosts. The Hosts page is displayed. Select the newly added host. Click the Items column. The Items page is displayed. Click Create Item to add a monitoring item.

      This method adds monitoring items for only one specific metric of a single resource. Example: Obtain free memory percentage for Host A by setting these parameters:
      • Name: Set the monitoring item name. Example: Host A free memory percentage.
      • Type: Select SNMP agent.
      • Key: Enter the corresponding monitoring item. Example: memoryFreeInPercent-HostA.
      • Type of Information: Select Character.
      • Host Interface: Select the newly added host IP address and port.
      • SNMP OID: Enter the complete OID including both the OID prefix identifying the monitoring items and the resource Index Value identifying the specific resource. Example: OID for Host A free memory: 1.3.6.1.4.1.60687.1.1.101.101.1.25.49004.15038.20479.16885.46625.11674.25854.9344
      • Update Interval: Set the monitoring data collection interval. ZABBIX periodically gets new monitoring data from ZStack Cloud.
      • Set other parameters as needed.
      Figure 9. Connect Single Resource Monitoring Item


    • Connect batch resource monitoring items:

      Through batch connection, ZABBIX can obtain monitoring data for one or multiple types of resources on ZStack Cloud. Example: Acquire monitoring data for hosts:

      1. Add Template:

        On the ZABBIX main menu, click Configuration > Templates. On the Template page, click Create template to create a template. In this scenario, set the template name as For-Cloud.

      2. Add Discovery Rule:
        In the Template main list, select the created For-Cloud template. On the template details page menu, choose Discovery rules > Create discovery rule. Add a discovery rule. ZABBIX can use this rule to actively discover resources on ZStack Cloud. Set the following parameters on the displayed page:
        • Name: Enter a discovery rule name. For example, discover-host. This rule discovers host resources.
        • Type: Select SNMP agent.
        • Key: Enter a discovery rule key. For example, cloud.if.discovery.
        • SNMP OID: Enter an easily identifiable resource field OID. ZABBIX discovers and tags resources using this field. In this scenario, use resource UUID to discover and tag hosts. Enter: discovery[{#UUID},.1.3.6.1.4.1.60687.1.1.101.101.1.0]. Here, .1.3.6.1.4.1.60687.1.1.101.101.1.0 is the OID prefix for host UUID.
        • Update Interval: Set the discovery interval for ZABBIX to automatically discover ZStack Cloud resources.
        • Other parameters can be configured as needed.
        Figure 10. Add Discovery Rule


        A single template can add multiple discovery rules to discover different types of resources on ZStack Cloud and obtain monitoring data for multiple resource categories.

      3. Add Item Prototypes:

        In the Template main list, select the previously created discovery rule discover host within the For-Cloud template. Then, the discovery rule details page is displayed. Choose Item prototypes > Create item prototype to add item prototypes to the discovery rule. Based on the discovery rule and item prototypes, ZABBIX can automatically generate monitoring items in batches for resources on ZStack Cloud.

        Example: Batch-generate monitoring items for host memory free percentage by setting the following parameters:
        • Name: Set the monitoring item name template. For example, Host Memory Free Percentage-{#UUID}. ZABBIX automatically fills {#UUID} with the discovered resource ID.
        • Type: Select SNMP agent.
        • Key: Set the monitoring item key template. For example, HostMemoryFreeInPercent-[{#UUID}]. ZABBIX automatically fills in {#UUID}.
        • Type of Information: Select Character.
        • SNMP OID: Set the OID template for resource monitoring using this format: OID. prefix.{#SNMPINDEX}. The OID prefix identifies a specific monitoring item. ZABBIX automatically fills {#SNMPINDEX} with the Index Value of the discovered resource. For example, obtain the host memory free percentage by filling .1.3.6.1.4.1.60687.1.1.101.101.1.25.{#SNMPINDEX} here.
        • Update Interval: Set the monitoring data refresh interval. ZABBIX can periodically obtain new metrics from ZStack Cloud.
        • Configure other parameters as needed.
        Figure 11. Add Item Prototype


        A single template can add multiple monitoring items to obtain various monitoring data. This scenario adds monitoring items for host memory free percentage, host memory free amount, host memory used percentage, and host memory used amount.
        Figure 12. Add Multiple Item Prototypes for Discovery Rule


      4. Link the template to hosts:
        On the ZABBIX main menu, choose Configuration > Host. On the Host page, click the host corresponding to ZStack Cloud. Then, the editing page is displayed. On the displayed page, select the newly created For-Cloud template for the host.
        Figure 13. Link Template to Host


        After linking, on the ZABBIX main menu, choose Configuration > Hosts. On the Hosts page, select the host corresponding to ZStack Cloud and check its Items column. You can see that, based on the template discovery rules and item prototypes, the system has automatically generated 4 monitoring items for each host on ZStack Cloud.

        Figure 14. Batch-generate Monitoring Items Automatically


      5. Optional. Export the configured template.

        On the ZABBIX main menu, choose Configuration > Templates. On the Template page, select the created For-Cloud template, then click Export at the bottom to export the configured template as an offline file.

        You can import this file into other ZABBIX platforms to quickly create identical templates and simplify manual configuration.

    • Import Full-set Monitoring Items for ZStack Cloud.
      1. Contact ZStack Cloud official technical support for the full-set SNMP monitoring items file. This file contains all SNMP monitoring items for ZStack Cloud. You can import the file directly into ZABBIX without manual templates or monitoring item prototypes configuration.
        Note: The provided full-set monitoring items file currently only supports ZABBIX 6.0.
      2. On the main menu of ZABBIX, choose Configurations > Templates. On the Templates page, click Import to import the obtained full-set SNMP monitoring items file.
      3. On the ZABBIX main menu, choose Configuration > Host. On the Host page, click the host corresponding to ZStack Cloud. Then the editing page is displayed. On the displayed page, select the newly imported template named Cloud interfaces discovery all for the host.
      4. Return to the Host page, select the host corresponding to ZStack Cloud, and click Items. You can see that, based on the imported template, the system has generated full-set monitoring items for the host.
        Figure 15. Generate Full-set Monitoring Items


  6. View monitoring data of ZStack Cloud resources on the ZABBIX platform.
    On the ZABBIX main menu, choose Monitoring > Hosts. On the Host page, select the host corresponding to ZStack Cloud and click Latest Data to view the latest data for each monitoring item.
    Figure 16. View Latest Data of Monitoring Items




    Click the History column next to a monitoring item to view its history data.
    Figure 17. View Historical Data of Monitoring Items




What to do next

You have now successfully viewed the monitoring data of ZStack Cloud resources on the ZABBIX platform. For more information about using the ZABBIX platform, you can refer to the ZABBIX Official Documentation.

Receive Cloud Platform Alarm Messages via SNMP Platform

About this task

ZStack Cloud supports actively pushing alarm messages to 3rd-party platforms through the SNMP protocol. This chapter mainly explains how to receive ZStack Cloud alarm messages via SNMP.

This scenario takes the ZABBIX platform as an example. You can also use other SNMP platforms.

Configuration Information

The following table lists the basic configurations in this scenario.
ZStack Cloud Information ZABBIX Platform Information SNMP Protocol Information
Management Node IP: 172.26.51.205 Server IP: 172.26.51.240 Protocol Version: v2c
SNMP Agent Port: 1161 SNMP Trap Port: 162 Community: v2c-test
The practical procedure is as follows:
  1. Prepare the ZABBIX platform.
  2. Log in to ZStack Cloud, enable SNMP Management and add a SNMP Trap receiver.
  3. Download the ZStack Cloud MIB file.
  4. Configure the ZABBIX server.
  5. Log in to ZStack Cloud, create an alarm and set the SNMP Trap receiver as the endpoint.
  6. Add an SNMP trap receiver as an endpoint and attach it to an alarm.
  7. Log in to the ZABBIX platform and connect to ZStack Cloud.
  8. Add SNMP Trap monitoring items on the ZABBIX platform.
  9. View alarm messages.

Procedure

  1. Prepare the ZABBIX platform.
    Prepare an SNMP monitoring platform to receive alarm messages pushed as Traps from ZStack Cloud. This scenario takes ZABBIX platform as an example. You can also use other SNMP platforms.
  2. Log in to ZStack Cloud and enable SNMP Management.
    On the main menu of ZStack Cloud, choose Settings > Platform Setting > SNMP Management. Then, the SNMP Management page is displayed. On the SNMP Management page, click Enable. The Enable SNMP Management page is displayed.
    Set the following parameters on the displayed page:
    • SNMP Agent Port: Set the port on the management node for receiving and responding to requests from ZABBIX. Default: 1161.
    • SNMP Protocol Version: Select SNMP version. Supported protocol versions: v2c and v3. In this scenario, use v2c.
    • Community: Set a community for authentication between ZABBIX and the Cloud. In this scenario, use v2c-test.
    • SNMP Trap Receiver: Add the ZABBIX platform as an SNMP Trap receiver to receive alarm messages from ZStack Cloud. Set the following parameters:
      • Name: Set the SNMP Trap receiver name. In this scenario, use SNMP Trap Receiver.
      • IP Address: Enter the ZABBIX server IP address.
      • Port: Enter the Trap message receiving port on ZABBIX server. Default: 162
    Figure 18. Enable SNMP Management and Add SNMP Trap Receiver


  3. Download the ZStack Cloud MIB file.
    On ZStack Cloud, click Download MIB in the upper-right corner of the SNMP Management page.
    Figure 19. Download MIB File


  4. Configure the ZABBIX server.
    1. Log in to the ZABBIX server and run the following commands to download the Trap receiver script:
      [root@appliance~]# yum install -y net-snmp-utils net-snmp-perl net-snmp    # Install Trap component package
      [root@appliance~]# sudo yum install wget    # Install wget command-line tool
      [root@appliance~]# wget https://cdn.zabbix.com/zabbix/sources/stable/6.0/zabbix-6.0.31.tar.gz    # Download ZABBIX Sources files (ensure version matches current platform)
      [root@appliance~]# sudo yum install tar    # Install tar command-line tool
      [root@appliance~]# tar zxvf zabbix-6.0.31.tar.gz    # Extract ZABBIX Sources files
      [root@appliance~]# cp /root/zabbix-6.0.31/misc/snmptrap/zabbix_trap_receiver.pl /usr/bin/zabbix_trap_receiver.pl    # Copy Trap receiver script to /usr/bin
      [root@appliance~]# chmod +x /usr/bin/zabbix_trap_receiver.pl    # Grant execute permissions to the Trap receiver script
    2. Edit the snmptrapd configuration file by setting the following parameters:
      [root@appliance~]# vi /etc/snmp/snmptrapd.conf    # Enter editing mode for snmptrapd.conf and add this configuration:
      -----------------------------------------------------------------------------------------------------------------------
      # Modify at XXXXXXXX
      disableAuthorization yes
      perl do "/usr/bin/zabbix_trap_receiver.pl"
    3. Edit the ZABBIX Server configuration file by setting the following parameters:
      [root@appliance~]# vi /etc/zabbix/zabbix_server.conf    # Enter editing mode for snmptrapd.conf
      -------------------------------------------------------------------------------------------------------------------
      Set these two parameters in the configuration file:
      StartSNMPTrapper=1    # Enable SNMP Trap service
      SNMPTrapperFile=/tmp/zabbix_traps.tmp    # Ensure the path entered here matches the SNMPTrapperFile parameter in zabbix_trap_receiver.pl
    4. Store the ZStack Cloud MIB file in the ZABBIX server's /usr/share/snmp/mibs directory. You can download it directly using the following commands:
      [root@appliance~]# wget -P /usr/share/snmp/mibs http://172.26.51.205:5000/public/ZSTACK-CLOUD-MIB.mib
      # 172.26.51.205:5000 is the ZStack Cloud UI access address for this scenario. Please replace it according to your actual environment.
      [root@appliance~]# vi /etc/snmp/snmp.conf    # Create the snmp.conf file and add this configuration:
      -----------------------------------------------------------------------------------------------------------------------
      mibs +ALL
    5. Run the following commands to restart ZABBIX Server and activate the configuration:
      [root@appliance~]# systemctl restart snmptrapd.service
      [root@appliance~]# systemctl restart zabbix-server
  5. Log in to ZStack Cloud, create a new alarm and set SNMP Trap receiver as the endpoint.
    On the main menu of ZStack Cloud, choose Platform O&M > Cloud Monitoring > Endpoint. The Endpoint page is displayed. On this page, click Create Endpoint. The Create Endpoint page is displayed.
    Set the following parameters on the displayed page:
    • Name: Set an endpoint name. In this scenario, enter SNMP Trap.
    • Type: Select a SNMP Trap Receiver.
    • SNMP Trap Receiver: Select the previously added SNMP Trap receiver.
    Click Send Test Message. Upon success, you can add the endpoint.
    Figure 20. Add SNMP Trap Receiver Endpoint


  6. Add an SNMP trap receiver as an endpoint and attach it to an alarm.
    This scenario demonstrates creating a resource alarm that triggers when the VM Instance's CPU Idle Rate exceeds 80% for 30 seconds. Adjust these configurations according to your actual business requirements.
    On the main menu of ZStack Cloud, choose Platform O&M > Cloud Monitoring > Alarm > Resource Alarm. The Resource Alarm page is displayed. On this page, click Create Resource Alarm. The Create Resource Alarm page is displayed. On this page, create the resource alarm as mentioned above, making sure to select the created SNMP Trap receiver for the endpoint.
    Figure 21. Create Alarm and Attach SNMP Trap Receiver as the Endpoint


  7. Log in to the ZABBIX platform and connect to ZStack Cloud.
    On the ZABBIX main menu, choose Configuration > Hosts. The Hosts page is displayed. On this page, click Create Host. The New Host page is displayed. Add ZStack Cloud as a host to ZABBIX.
    Set the following parameters on the displayed page:
    • Host Name: Enter a host name. In this scenario, enter the Cloud.
    • Group: Select a group for the host.
    • Interface: Click Add > SNMP. Set the following parameters:
      • IP address: Enter the IP address of ZStack Cloud management node.
      • Connect to: Select Connect to IP.
      • Port: Enter the SNMP Agent port set in ZStack Cloud. In this scenario, enter 1161.
      • SNMP version: Select the SNMP version. The version needs to match the configuration in ZStack Cloud. In this scenario, select SNMPv2.
      • SNMP community: Enter the community set in ZStack Cloud. In this scenario, enter v2c-test.
      • Set other parameters as needed.
    Figure 22. Connect ZStack Cloud to ZABBIX


    The connected ZStack Cloud appears in the ZABBIX Hosts list. Wait a few minutes. Check the Availability column. Green status indicates successful connection. ZABBIX can now communicate with ZStack Cloud.
    Figure 23. Successful Connection to ZStack Cloud


  8. Add SNMP Trap monitoring items.
    On the ZABBIX main menu, choose Configuration > Hosts. Select the newly created Cloud host. Click Items. The Items page is displayed. On this page, click Create. The Create Item page is displayed.
    Set the following parameters on the displayed page:
    • Name: Set an monitoring item name. In this scenario, enter Cloud_SNMP_Trap.
    • Type: Select SNMP trap.
    • Key: Select snmp.fallback.
    • Type of information: Select Log.
    • Host interface: Select the IP interface of the newly created Cloud host.
    • History storage period: Set the retention period of history data.
    Set other parameters as needed.
    Figure 24. Add SNMP Trap Monitoring Items


  9. View alarm messages.
    On the ZABBIX main menu, choose Monitoring > Latest data. The Latest Data page is displayed. Find the newly created SNMP trap monitoring items. Click History to view alarm messages pushed by ZStack Cloud.
    Figure 25. View Alarm Messages




What to do next

You have successfully configured ZABBIX platform to receive alarm messages from ZStack Cloud. For more information about using ZABBIX platform, refer to the ZABBIX Official Documentation.
SNMP Management Tutorial | 5.5.30 | ZStack Cloud · ZCF | ZStack Resource Center