Setting Up a Probe Project

Setting Up a Probe Project
uimpga-ga
This article explains how to create a probe project using Maven Archetype templates provided in the Probe SDK package, and how to modify probe project properties.
Creating a Project Using Maven Templates
Starting with Probe SDK v2.2.0, the Probe SDK contains several new Maven Archetype Project Templates that let you quickly and easily set up a new probe development project. It is recommended that you base new probe projects on one of the Maven Archetype templates included with the Probe SDK package. For more details about Maven Archetype templates, go to http://maven.apache.org/guides/introduction/introduction-to-archetypes.html.
To use a Maven template to create a probe project, open a command prompt in the directory where you wish to create a new probe project and issue the following command:
mvn archetype:generate -DarchetypeCatalog=local
This command starts an interactive session that prompts you to provide the following project properties:
  • archetype :
    Select the Maven Archetype template corresponding to the type of probe you want to create. 
  • groupId :
    Typically, you enter an organization domain name, for example 'com.ca'. This value is used in two places: it is set in the pom.xml as the groupId, and it is used as the default vendor name for the probe.
  • artifactId:
    This value is used as the probe name and the artifactId. Probe names are comprised of lower case alphabetic characters, can have underscores for spaces, and typically do not include the word probe or special characters. For example, wasp, spooler, service_host.
  • version:
    Enter a version number for the probe, such as 1.0. The default version is 1.0-SNAPSHOT.
  • package:
    Enter the name of the Java package where you want your Probe Java code to reside.
After you enter the probe project properties, issue the following command to compile and build a skeleton probe based on the select Maven Archetype template:
mvn install
When a new probe project is created, it has the following characteristics:
  • A complete probe project skeleton ready for you to add your custom logic.
  • src/main/resources
    • probe_schema.xml:
      • This is the primary configuration file for a probe, where the probes inventory and metrics are declared, as well as bulk configuration settings. When the project is initially created you will find probe_schema.xml defines one element named 'ExampleElement', which contains one metric 'ExampleMetric'.  You may use this as a starting point for defining your Elements and Metrics, or you choose you may delete the ExampleElement and start from scratch.
      • When you use the remote-probe-pobc-archetype template, an example of a very simple template-generation section for bulk configuration is included in the ExampleElement.
  • src/main/java
    • ProbeMain.java
      • This is the primary java class for the probe and it will be in the package specified when the project was created from the Archetype.  
      • It already contains all the plumbing to get started up as a probe and register with UIM. The job of the probe developer is to refine the implementation of the following 3 methods:
        • addDefaultProbeConfigurationToGraph()
        • testResource()
        • getUpdatedInventory()
Changing a Probe Name
You can change a probe's name after the probe project is created. Update the name in all of the following locations:
  • ProbeMain.java
  • probe_schema.xml
  • .pkg file
  • pom.xml
Changing a Probe Vendor Name
By default the probe vendor name is set to the 'groupId' provided when you created the probe project To change this name, modify the PROBE_VENDOR variable in the ProbeMain.java class.
Changing a Probe Category
By default, a probe created with any of the archetype templates is assigned a category of 'application' and is installed in the probes/application directory on a robot. If you want to use a different category and install directory, modify the category and install directory in the following locations:
  • probe.pkg
    • Look for 'group =', you will find 5 places where this must be updated.
    • Look for directory paths throughout the file. There will be approximately 10-12 paths to update.
  • pom.xml
    • update probe.category property
Changing a Probe Description
This is in the probe.pkg file. Search for all instances of 'description'. There should be 5 places where you need to change the description.