cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3492
Views
0
Helpful
0
Comments

Introduction

In cloud automation it is important that the life-cycle and state of the virtual machine should be monitored. Cisco Cloud Portal or any other portal for that matter should have knowledge of the actual state of the VM. Even if cloud user show down or power on VM directly from the VNC or through RDP.

This can be achieved by using SNMP. SNMP trap is a powerful mechanisn to track not only the state of the VM but also any other object within vCenter. And this is true for any element manager that supports SNMP traps.

CPO (Cisco Process Orchestrator) can trigger workflow based on the SNMP trap it recieves and can informa Cisco Cloud Portal (CCP) via API. Lets assume a user doesn't use portal but goes directly in the VM via RDP and power it off. Now vCenter trap will be sent to CPO and CPO will send the status back to CCP. CCP will then update the VM property and show that VM is actually powered-off on the Portal. This way portal user will always get the real-time stats from the VM.

This could be valid for other scenarios as well for example if a VM get deleted, you want to have a trap received in CPO and then run some scripts accordingly to delete DHCP reservation or clean up other database table.

Prerequisite

Make sure UDP ports 161 and 162 are open for SNMP trap to receive by the orchestrator.

VMware Configuration Steps

Global SNMP Configuration

snmp_vcenter_1.JPG

172.21.54.228 is the IP address for the CPO (Cisco Process Orchestrator) server. It will receive SNMP traps based on the alter criteria that we will see in the later section.

Up to 5 SNMP receiver system can be defined in vCenter

vCenter Alarm Setting To Generate SNMP trap

Alarms can be configured and defined at various objects in vCenter. It is the responsibility of vCenter admin to define these alarm condition. It will depend on what trap vCenter admin wants to send to CPO server and on the use case.

  • Alarm should be carefully configured for all the objects in the vCenter otherwise a wrong configuration might create SNMP traffic storm on the network
  • Alarm definition must be very specific and not too generic

We will look at the example of defining an alarm so that we can trap Power ON and Power Off state of a VM.

Step#1

In vCenter go to the folder object that would contain the VM that you want to monitor. And create a new alarm

snmp_vcenter_3.JPG

Step#2

step2.GIF

Step#3

step3.GIF

Step#4

step4.GIF

Step#5

This new alarm will now show under the folder-object as shown below

step5.GIF

Following screen shot is take from CPO server for a power-on event. CPO will receive the trigger and based on the trigger CPO workflow will be started

step5.1.GIF

step5.2.GIF

CPO configuration will be shown in the following sections.

Repeat Steps for PowerOff

repeatpoweroff.GIF

repeatpoweroff2.GIF

repeatpoweroff3.GIF

repeatpoweroff4.GIF

Similarly you can create the SNMP alerts for many actions available in vCenter Alarm configuration section.

Process Orcehstrator Workflow Development

Create Target

createtarget.GIF

In the following screen shot notice that community string must match the string that was configured on the vCenter SNMP properties.

createtarget2.GIF

createtarget3.GIF

Create Workflow

First part of the workflow will read the SNMP trap. Save it in XML format. Read table from XML and put it in a local table. It will then run SQL query to find the state of the VM.

createworkflow.GIF

In the second part it will collect the name of the VM and other properties.

Inthesecondpartitwillcollectthenameofvm.GIF

Workflow SNMP Trigger

The workflow will be triggered based on a specific OID (1.3.6.1.4.1.6876.4.3.0.203 ) in the trap that it receives from vCenter

Theworkflowwillbetriggeredbasedonaspecificoid.GIF

Lets take a look at the properties and logic to build this workflow

Breakdown of Various Activities and Their Properties

Step#1

CPO automatically captures the SNMP trap data in XML. We will save it in a local variable for further processing.

step1cpoautomaticallycapturessnmptrapdatainxml.GIF

Step#2

Now select the "Row" XML element from the saved value and put them in a table format.

step2nowselecttherowxmlelementfromthesavedvalue.GIF

Step#3

Select for the OID (1.3.6.1.4.1.6876.4.3.306.0) value. This would have information if the event was for a VM Power ON or VM Power OFF.

step3selectfrotheoidvalue.GIF

Step#4

Now use the condition branch to check the value and set the variables accordingly

step4nowusetheconditionbranchtocheckthevalue.GIF

Step#5

Now select a different OID ('1.3.6.1.4.1.6876.4.3.307.0') to pick the name of VM and its associated properties.

step5nowselectadifferentoid.GIF

Workflow Execution

Workflow will be executed based on the SNMP trigger automatically.

workflowwillbeexecutedbasedonthetrigger.GIF

SNMP Trap XML

<DocumentElement>

  <Row>

    <OID>1.3.6.1.4.1.6876.4.3.308.0</OID>

    <Value>3</Value>

  </Row>

  <Row>

    <OID>1.3.6.1.4.1.6876.4.3.304.0</OID>

    <Value>Gray</Value>

  </Row>

  <Row>

    <OID>1.3.6.1.4.1.6876.4.3.305.0</OID>

    <Value>Yellow</Value>

  </Row>

  <Row>

    <OID>1.3.6.1.4.1.6876.4.3.306.0</OID>

    <Value>Power State - State = Powered on</Value>

  </Row>

  <Row>

    <OID>1.3.6.1.4.1.6876.4.3.307.0</OID>

    <Value>Tidal-N1KV-PRI</Value>

  </Row>

  <Row>

    <OID>1.3.6.1.6.3.1.1.4.1.0</OID>

    <Value>1.3.6.1.4.1.6876.4.3.0.203</Value>

  </Row>

</DocumentElement>

Output Saved In Table

outputsavedintable.GIF

outputsavedintable2.GIF

outputsavedintable3.GIF

outputsavedintable4.GIF

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking for a $25 gift card