DX Unified Infrastructure Management

 View Only
Expand all | Collapse all

how to develop a gateway probe?

  • 1.  how to develop a gateway probe?

    Posted Jul 03, 2019 10:08 AM
    Hi Guys,

    We have development a custom portal that collects QoS and Alarms from UIM, the collectors we develop search the information by query in the UIM Database and insert in the Portal Database.

    Today our customer has the requirement to see this information practically real time, and the way the collectors work today does not meet this requirement, the idea I had was to collect QoS and alarms directly from the UIM Message Bus, but I can not configure a queue in the hub to send the messages to an external MQ, so I thought it would be the case to develop an analysis that had this functionality, such as the gateway probes sdgtw, apmgtw, and spectrumgtw.

    If our collector works this way, I believe that QoS and alarms would arrive faster on our portal, and the customer could see it closer to the real time.

    I did not find in the SDK an example of how to develop a gateway probe, just local and remote probe.

    I wonder if anyone in the community has created a probe of this type, or if have any idea how to do it and, if possible, share some examples so that I can provide more information to our developers.

    Thanks


  • 2.  RE: how to develop a gateway probe?
    Best Answer

    Broadcom Employee
    Posted Jul 03, 2019 12:54 PM
    There is nothing currently available from Support or development to provide you insight on how to build this.
    You might want to engage your service team for this.

    You could look at:
    http://support.nimsoft.com/Files/Archive/00057/code_wizard-1_70.zip
    Deploy this to a windows hub and the run it, you can select the types of functions you want to see such as reading from a queue for the language you are using.

    How you take that data and get it to your final location we will not have an example of:
    Sample JAVA code for all options in the wizard:

    //#################################################################
    //# CodeWizard: Java
    //# This code was generated with the Nimsoft CodeWizard version 1.70
    //# Date: Wednesday, July 3, 2019
    //
    package example;
    import java.io.IOException;
    import com.nimsoft.nimbus.*;
    import com.nimsoft.nimbus.ci.ConfigurationItem;

    public class example_probe {
    static NimLog logger = NimLog.getLogger(example_probe.class);
    static int interval = 300;

    public static void main(String[] args) {
    try {
    example_probe exampleprobe = new example_probe();
    exampleprobe.doit(args);
    }catch(Exception e) {
    e.printStackTrace();
    }
    }

    public void doit(String[] args) throws Exception {
    NimProbe probe = null;

    // Loop to handle restart (_restart) command
    // Stop (_stop) command terminates the loop
    do {

    // Construct the probe
    probe = new NimProbe("example_probe","1.00","My company",args);

    NimConfig config = NimConfig.getInstance();
    int key2 = config.getValueAsInt("/config/java","key2",0);
    int log_level = config.getValueAsInt("/setup","loglevel",NimLog.WARN);
    interval = config.getValueAsInt("/setup","interval",interval);

    logger.log(0," - ---STARTING - ----");
    logger.setLogLevel(log_level);

    // Subscribe to message from the hub, register the "hubpost" callback method
    probe.setSubscribeSubject("alarm");
    probe.registerHubpostCallback(this,"hubpostCallback");

    // Subscribe to the command test1 with no parameters
    probe.registerCallback(this,"test1","callbackTest1");
    // Subscribe to the command test2 with two parameters
    probe.registerCallback(this,"test2","callbackTest2",new String[]{"id","text"});

    // Register timer callbacks called on timer and executes in the main thread
    probe.registerCallbackOnTimer(this,"callbackOnTimer_one",interval*1000,false);
    // Register timer callbacks called on timer and executes in a separate thread (not the main thread)
    probe.registerCallbackOnTimer(this,"callbackOnTimer_two",interval*1000,true);

    NimRequest request = new NimRequest("controller","gethub");
    PDS pdsout = request.send();

    String hubaddress =
    "/" + pdsout.getString("hubdomain") +
    "/" + pdsout.getString("hubname") +
    "/" + pdsout.getString("hubrobotname") +
    "/hub";

    request = new NimRequest(hubaddress,"getrobots");
    pdsout = request.send();

    PDS[] pdss = pdsout.getTablePDSs("robotlist");
    for (int entry=0;entry<pdss.length;entry++) {
    // This example only prints all the PDSs content to the console
    System.out.println(NimUtility.displayPDS(pdss[entry],true));
    }

    // Create a PDS using the PDS class.
    // Add two strings and a number to the PDS.
    // Post (send) it
    PDS pds = new PDS();
    pds.put("name","Donald Duck");
    pds.put("phone","123-123-123");
    pds.put("age",60);
    NimPost post = new NimPost("YOUR_SUBJECT",pds);
    post.send();

    // Run until a stop signal is received from the manager.
    // Restart initiates re-creation of the probe.
    // The doForever() method returns true or false
    // true - a restart command (_restart) is received
    // false - a stop command (_stop) is received
    } while (probe.doForever());

    logger.log(NimLog.WARN," - ---STOPPING - ----");
    }

    /**
    * The "hubpost" callback that receives a PDS with some userdata
    * @param session The callback session
    * @param pdsuserdata The PDS user data
    */
    public static void hubpostCallback(NimSession session, PDS pdsuserdata) throws NimException {
    session.sendReply(NimException.OK,null); // OK return
    }

    /**
    * The "test1" callback command that has no parameters
    * The method returns a text string
    * @param session The callback session
    */
    static public void callbackTest1 (NimSession session) throws NimException {
    String ts = "abcdefghijklmnopqrstuvwxyzeøå ABCDEFGHIJKLMNOPQRSTUVWXYZÆØÅ 1234567890";
    PDS pds = new PDS();
    pds.put("ret_para",ts);
    session.sendReply(0,pds);
    }

    /**
    * The "test2" callback command that has two parameters, an id and some text
    * The method returns the received parameters + an additional "full alpabeth" text string
    * @param session The callback session
    * @param id An id
    * @param text Some text
    */
    static public void callbackTest2(NimSession session, int id, String text) throws NimException {
    String ts = "abcdefghijklmnopqrstuvwxyzeøå ABCDEFGHIJKLMNOPQRSTUVWXYZÆØÅ 1234567890";
    PDS pds = new PDS();
    pds.put("ret_id",id);
    pds.put("ret_text",text);
    pds.put("ret_para",ts);
    session.sendReply(0,pds);
    }

    /**
    * This method is called as defined in the register method
    */
    public static void callbackOnTimer_one() throws NimException {
    // Do something, like testing an sending alarm, Qos,...
    // Define and send a warning alarm
    try {
    ConfigurationItem ConfItem = new ConfigurationItem("citype", "ciname","Hostname");
    NimAlarm alarm = new NimAlarm(NimAlarm.NIML_WARNING, "Alarm generated from Java","2","JAVA","JAVA",ConfItem,"ciMetricId");
    alarm.send();
    alarm.disconnect();
    } catch (IOException e) {
    e.printStackTrace();
    }
    }

    /**
    * This method is called as defined in the register method
    */
    public static void callbackOnTimer_two() throws NimException {
    // Do something else
    try {
    // Create a QoS object
    // Set an optional defintion
    // Set some values
    // Send
    String target = "codewizard";
    int samplevalue = 12345;
    ConfigurationItem ConfItem = new ConfigurationItem("citype", "ciname","Hostname");
    NimQoS qos = new NimQoS(ConfItem,"metricId","QOS_TEST",false);
    qos.setDefinition("QOS_APPLICATION","My application response","milliseconds","ms"); // Optional
    qos.setSampleRate(interval);
    qos.setTarget("codewizard");
    qos.setValue(12345);
    qos.send(); // The definition, if defined will be sent first, but only once

    for (int i=0;i<20;i++) {
    qos.setValue(((i % 3)==0) ? 0 : i);
    qos.send();
    }
    qos.close();
    } catch (Exception e) {
    e.printStackTrace();
    }
    }

    }


    ------------------------------
    Gene Howard
    Principal Support Engineer
    Broadcom
    ------------------------------



  • 3.  RE: how to develop a gateway probe?

    Posted Jul 03, 2019 03:48 PM
    Thank you very much @Gene Howard,

    I'm going to refer you to our development team, it will help us a lot. ​


  • 4.  RE: how to develop a gateway probe?

    Posted Aug 05, 2019 03:17 PM
    Hello Gene,

    We are evolving with the SDK, but the classes we need to use are not documented in javadoc;

    Class -> NimProbe

    Would you have any documentation about her?


  • 5.  RE: how to develop a gateway probe?

    Broadcom Employee
    Posted Aug 05, 2019 03:29 PM
    Check the pdf attached in this section.
    see if this is what you are looking for:
    https://docops.ca.com/bookshelves/ca-unified-infrastructure-management?help-doc.html#CAUnifiedInfrastructureManagement-ProbeFrameworkDeveloperKit(PF-SDK)

    ------------------------------
    Gene Howard
    Principal Support Engineer
    Broadcom
    ------------------------------



  • 6.  RE: how to develop a gateway probe?

    Posted Aug 07, 2019 10:59 AM
    Sorry for delay to answer, the last days is hard here.

    Yes, this document very help us.

    Thank you again Gene


  • 7.  RE: how to develop a gateway probe?

    Posted Aug 23, 2019 08:42 AM
    Hi Gene,

    We are evolving with our custom probe, we can already get the messages from our ATTACH queue, but it's queuing, I believe that the method we are using collects 1 message at a time, would you tell us how to use the "Bulk Size" and parameterize in our * .cfg file?


       data_engine probe

    Thank you.



  • 8.  RE: how to develop a gateway probe?

    Broadcom Employee
    Posted Aug 23, 2019 11:40 AM
    You might be having a problem where you are open and closing your connection to the hub for each message.
    this would be very slow.
    make sure you open the connection and then use the same connection to get the next message.
    This should not cause a bottleneck.

    I do not have a good working example but I believe you will need to use the below functions:

    subscribeForQueue

    public void subscribeForQueue(String queuename,
    Object object,
    String methodname,
    int bulk_size)
    throws NimException

    Subscribe for messages on the given queue.

    Parameters:
    queuename - the name of the queue
    object - the Object to be called when a message or batch of messages is received
    methodname - the name of the method to be invoked when a message or batch of messages is received
    bulk_size - the number of messages to deliver in a single batch
    Throws:
    NimException - if the subscription could not be successfully established


    I found this in the java docs as part of the java SDK.


    ------------------------------
    Gene Howard
    Principal Support Engineer
    Broadcom
    ------------------------------



  • 9.  RE: how to develop a gateway probe?

    Posted Aug 26, 2019 10:15 AM
    Hello Gene,

    Today we are collecting the messages as follows;


    ProbeMain probe = new ProbeMain ();
    probe.doProbe (args);
     
    NimProbe probe = null;
      of {
                 probe = new NimProbe ("collector", "1.00", "Eleeva Avaya", args);
                 probe.setHubQueueName ("collector_eleeva");

                 probe.registerHubpostCallback (this, "processMessage");
               
             } while (probe.doForever ());
     
    void processMessage (NimSession session, PDS pdsdata, PDS pdsuserdata) throws NimException

    We haven't figured out how to use the subscribeForQueue() method yet, we don't found a doForever() for it.

    Thank you.


  • 10.  RE: how to develop a gateway probe?

    Broadcom Employee
    Posted Aug 26, 2019 11:19 AM
    so yes I would think this would be a very slow method as each time you are having to establish the connection which is a slow process do to authentication.
    I will have to see if I can find any further examples.
    You may need to engage a partner or service to help further with this custom code unless someone else has an example they will share.

    ------------------------------
    Gene Howard
    Principal Support Engineer
    Broadcom
    ------------------------------