KB 031 – Creating a custom extractor

Creating a custom extractor (Development Guidelines)

Creating new extractor

Notes: usually the an extractor is used to collect metric into one internal table. If there is more than
one structure/ internal table that you need to collect, event sub group or multiple extractors may be
required.

  1. Go to SE80 for /BNWVS/VSAP Package
  2. Expand package and copy class /BNWVS/CL_EXT_STANDARD
  3. Name class Z_CL_EXT_<dataset event group name>
  4. Use custom package and create a transport request
  5. Update the description of the class
  6. Go into the code of the method PERFORM_METRIC_CALCULATION
  7. “Aim is to get metric data into a table called LT_DATA – change type of LT_DATA to suit information
    being requested.

  8. Decide the structure of LT_DATA. You can use existing standard structure or create a
    new one.
  9. Please check Naming Convention document to check reserved field name.
  10. If you create a new structure, please set the enhancement category of the structure to
    “”Cannot be enhanced””. This is to avoid warning message when the structure is
    being imported to customer’s system.
  11. Check if there is any suitable table type for the structure in data dictionary. If there is
    no suitable table type, create a new table type in data dictionary.
  12. Table type needs to be defined in data dictionary because metric is stored as XML
    data in table /BNWVS/MTR and it needs to be constructed as internal table for
    displaying the data in application log or uploading the metric to Splunk in JSON
    format.
  13. Once you have the data defined, call the method STORE_METRIC( it_rundatetime =
    it_rundatetime it_data = lt_data ).
  14. To specify Event Subgroup, please populate parameter I_SUBGROUP. Event
    Subgroup can be used to upload multiple internal tables / structures.

Guiling Principals

  • “All of the metric must have timestamp on it.
  • By default, PowerConnect for Splunk framework uses the date & time when the metric
    was collected as timestamp (/BNWVS/MTR-TIMESTAMP).
  • If the data requires different timestamp, e.g. STAD, ST03 Time Profile,
    • please convert the date and time to UTC timestamp.
    • Store the timestamp in column called TIMESTAMP.
    • please specify TIMESTAMP column as the first column
    • This is needed because Splunk requires the column to set the event/metric timeline properly
      otherwise metric collection date & time will be used”

If the data has terminal ID, user ID and timestamp,

Get IP address of the corresponding data by calling FM ‘/BNWVS/GET_USER_IP’ and save it in the
data set, in Splunk, the IP address is useful to develop map of where the users are located etc.”
Some attributes/methods that you should use for developing the extractor:

  • it_lastrun – Last time the extractor run
  • it_rundatetime – current date and time
  • get_testonlyflag() – indicate whether this is test mode or not

Please note that the extractor can be run in test mode by using program /BNWVS/BC_TEST_METRIC.
You may not want the extractor to update any data / configuration when you run it in test mode.

  • get_parameters() / set_parameters() – to retrieve extractor specific parameters
    e.g. SM59 extractor performs connection test to every RFC available, users can exclude some RFC
    entries by putting them in the list”

Ensure any exceptions are handled and raised appropriately.

If your extractor goes through the list of application server, please put error handling for each iteration and store the error as application log. Make sure the extractor can continue to process the next application server.

To create an application log entry, you can use one of the method in class /BNWVS/CL_MTR_ENGINE

  • ADD_APP_LOG
  • ADD_APP_LOG_WITH_MSG
  • ADD_APP_LOG_WITH_EXC
  • ADD_APP_LOG_WITH_TASK”

Activate the Class

Setup Group definition
Goto transaction /BNWVS/MAIN -> Administrator-> Setup Group Def
Add a new entry

  • Interval – maximum interval how often the extractor should run (in seconds).
  • Err retry – future use
  • Max Interval – Earliest data that should be collected. For example, if you set to 3600 seconds (1
    hour), when the extractor runs, IT_LASTRUN is populated with timestamp from 1 hour ago.
    This is useful to limit the amount of metric being collected if the extractor failed to run for sometime
    and it needs to collect metric from the last time it ran.
  • Tick Active to start collecting

Test Harness

Do NOT tick Active if you need to test the extractor. You can test the extractor using program /BNWVS/BC_TEST_METRIC and activate it once it’s ready.”
Setup Task Group
Goto transaction /BNWVS/MAIN -> Administrator-> Setup Task Group
Add a new entry
Specify the new group definition
Leave sequence as blank
If the extractor needs to run under specific condition, for example, only DB Name = HDB if it should run only if the database is HANA.
Specify the new class under Object Type Name”
Test your extractor with program /BNWVS/BC_TEST_METRIC

Download PDF version here