SNMP collection (Walk) in XML format (SNMP_TO_XML)

introduction

XML is today the preferred format for data description and making it accessible to many environments. With the LUA script programs (SNMP_TO_XML)  from LoriotPro described in this document, you have the tools to collect data via SNMP on your devices and save the result in XML format. We also provide a sample display of the XML data in a web format. Please note these features are only available for owners of an Extended Edition or Broadcast Edition LoriotPro.

The diagram below shows the steps to achieve the creation of a report in a WEB format after a SNMP data collection and a conversion to XML. In this example, we use a VMWARE ESX server defined in the directory of LoriotPro. A 550 Audit Plugin is attached to that server and perform the SNMP data collection (SNMP Walk) on a branch of the VMWARE private MIB.

The concept of SNMP Walk is intimately linked to the SNMP standard and to the GET NEXT request. Having chosen an object in the MIB tree, a SNMP GET NEXT provides the next object in the tree, hence the phrase "Walk the MIB tree".

Remember, the LoriotPro Audit Plugins are applications based on scripts in LUA language and use a pool of threads exploiting the multitasking capabilities of Windows.
Thanks to this module Audit 550, you can generate hundreds of SNMP collections and hundreds of XML reports over hundreds of IP devices in a quick and easy way.

 

SNMP2XML.png

The script program performs the SNMP collection of MIB objects pertaining to a branch of the MIB tree. All objects in the selected branch are successively read with SNMP and converted in a XML tag within the XML file. The name of the XML tag is simply the name of the SNMP object. Two attributes within this XML tag, give the object index and the father object.

Sample XML file generated:

SNMP2XML-file.png

Available programs:

The SNMP_TO_XML collection programs are available in three different modes of launching. We distinguish:

1.       The audit program 550 is launched from an audit plugin and generates the XML file at regular intervals. It only generates an XML file

2.       LP_SNMP WALK_TO_XML_IP_UID.xlua (AJAX) program that returns the result in a XML http response or LP_SNMP-WALK_TO_XML_IP_UID.html program that provides direct rendering in HTML format

3.       SNMPtoXML.LUA program that runs on demand or from the script editor. It only generates an XML file from the Windows GUI LoriotPro.

In addition, the XML files created by the first two versions are viewable from a browser and web via the integrated web server of LoriotPro.

If your version of LoriotPro does not contain these files download them through this link.

We will see below how to use these three operational modes

SNMP to XML with the Audit Plugin 550

The use of an Audit allow you to generate the SNMP Walk at regular intervals and thus to have a regular refresh of your XML file.

Before setting up and using the Audit 550, the setup of LoriotPro must meet the following conditions:

1.                  To have an Extended Edition of LoriotPro

2.                  To have devices(s) present and operational in the LoriotPro directory (green status, responding SNMP)

3.                  To have in the MIB database, the objects that you want to collect

If these conditions are present, we can check beforehand that the SNMP Walk on the branch of the MIB is working properly. To do this you select the directory where the aimed device for the SNMP Walk is, in our example this is a VMWARE ESX server, then selects the MIB tree branch object to walk from ( WMWARE MIB must be compiled and the SNMP agent started on the ESX) and then called the contextual menu (right click), select the SNMP WALKER option. SNMP WALKER program opens and starts the walk. The current values ​​should be displayed.

WalkSNMPWalker.png

If the verification is successful, you can add the PLUGIN Audit into the LoriotPro directory.

Select the target device and attach an Audit Plugin. Call the contextual menu of the device and select Insert Task then Advanced TCP/Audit Polling.

InsertAudit.png

In the dialog box of the Plugin properties select:

The Polling Type on Audit Process

Enable Process must be checked

Audit Ref must be 550

Parameters must be set with a branch MIB object

 

Audit550Config.png

Quit with OK, the Audit is automatically launched.

If the program runs without error, the Audit Plugin icon must be green.

A single click on the icon open the Audit Plugin status dialog box :

AuditPopup.png

The execution time of the last 100 executions reported in a temporal graph.

The execution of Audit Plugin is under the control of the Audit Process. This is a background process that manages the pool of Windows threads. It must be started before the Audit Plugins are addressed.

To check its operation select from the main menu, the "Configure" and "Audit Process" option

A window appears as shown below and you should see your Audit appear in the logs at each of its executions.

AuditProcessMonitor.png

If there an anomaly in the Audit Program 550, a message is sent to the Syslog window of LoriotPro.

Generation from the WEB server AJAX

The same concept has been extended to obtain an XML file over HTTP from the WEB server of LoriotPro.

In this case the collection is made in the application and the WEB server at regular intervals, so it is the client (web browser) that triggers the execution of the collection by an SNMP MIB Walk on the branch of their choice.

Below is an example of a query on an Ethernet switch for all objects in the MIB-2 branch.

http://127.0.0.1:8010/hlua/LP_SNMP-WALK_TO_XML_IP_UID.xlua?IP=10.1.1.70&OBJ=mib-2

SNMP-WalkToXML_XLUA.png

To have the result as a WEB page and not an XML file, you can use the dedicated GAudit.html page below. This page calls the previous script in AJAX and generates the rendering in HTML with JQUERY.

SNMP2XML_web_Mode.png

The WEB page GAudit.html needs three parameters:

MODE: the XLUA must be specified for a call to LP_SNMP-WALK_TO_XML_IP_UID.xlua with AJAX

IP: The IP address of the device on which the SNMP Walk needs to be done

OBJ: The MIB object, a branch of the tree from which to start the Walk.

Example:

http://127.0.0.1:8010/GAudit.html?MODE=XLUA&IP=10.1.1.70&OBJ=mib-2

 

For an automatic page refresh simply activate the following line in the javascript section of the page Gaudit.html

ti = setTimeout (function () {window.location = location.href}, 10000)

The value represents the time in milliseconds between each refresh.

Manual generation of an SNMP XML report

Manually generating an SNMP Walk from SNMPtoXML.LUA script is possible in several ways

1.                  From the editor or from LUA script

2.                  With the Report Scheduler Plugin

3.                  From an object in Active View

4.                  From the main menu

From the editor, you must first open the editor from the main menu option Tools and Script Editor

In the editor, open the file SNMPtoXML.LUA

Enter in the field lp_host, the IP address of the equipment involved in the SNMP Walk

Enter in the lp_oid field, the name of the object of the branch of the MIB tree

To run it, select the menu option: Compile - Run Script.

A screen is displayed with the trace information of program execution.

Scripteditor.png

Display the XML result in a WEB page

If we used the Audit 550 or the manual mode to generate the XML file, This file can be displayed as a web page.

In the root of the web server LoriotPro, the Gaudit.html file displays the XML created.

The XML files are stored in the /bin/www/tmp of the LoriotPro directory.

The Gaudit.html file expected as parameters the name of the generated XML file and a mode of operation that must be XML (XLUA in the previous section).

The format is tmp/audit_ [MIB object] _ [IP address] .xml

WARNING the file is generated in the /bin/www/tmp of LoriotPro

The example below for the [objet de MIB] = vmwVirtMachine and [adresse IP] = 172.16.8.174

http://127.0.0.1:8010/GAudit.html?MODE=XML&URL=tmp/audit_vmwVirtMachines_172.16.8.174.xml

Synthèse

Le logiciel de supervision LoriotPro peut être utilisé pour la génération de fichiers XML résultant d’une collecte SNMP auprès des équipements les plus divers.

La collecte correspond à un simple WALK dans l’arbre des MIB à partir d’une branche présélectionnée.

Le XML ainsi obtenu peut être exploité par des applications « coté client » en mode WEB.

L’utilisation du module d’Audit 550 vous permet ainsi de générer des centaines de collecte sur des centaines d’équipements de manière simple et rapide.

Summary

Loriotpro monitoring software can be used to generate XML files resulting from SNMP collection from any types and models of devices.

The collection is a simple SNMP WALK in the MIB tree from a pre-selected branch.

The resulting XML can be exploited by WEB user applications.

The use of the Audit Module 550 allows you to generate hundreds of collection over hundreds of devices in a quick and easy way.