Skip to content

Create A Synthetic Transaction

Custom polling using third party commands or applications is a common requirement. Metric Manager's synthetic transaction engine provides multiple ways of automated collection and testing of these transactions. This Guide utilizes the synthetic transaction agents paired with custom scripting to accomplish a fairly routine need - DNS checks. This example can be further explored to do almost any service or application check.

Creating a Synthetic Transaction

Synthetic Transactions take advantage of the Generic SOAP Collector agent. This agent operates as a pipeline for incorporating data from external sources into Metric Manager, providing essentially limitless extensibility for metrics polling. For example, it could be used to write metrics based upon the output from a command-line testing utility. To illustrate this capability in this Guide, the Generic SOAP Collector service will be enabled. A script will be created to test DNS response times and invoke the Generic SOAP Agent to transmit the results to Metric Manager. The script will then be invoked as a scheduled job to run every 60 seconds. To conduct this Guide, you will need the "dig" utility installed on your Assure1 Server.

  • Open a terminal as root and execute the command:
yum -y install htdig
  • Enable the Generic SOAP Collector.

    • Under Metric Manager, update the Default Metric SOAP Collector application configuration setting LogLevel to DEBUG.

    • Enable the Generic SOAP Collector service.

  • Create DNS Response Time Script.

    • Create a script to measure DNS response times using the dig utility and invoke the Generic SOAP Agent to write the results as a metric in Metric Manager. Open a terminal as root and create a shell script named DNSCheck.sh with the code in the Sample Code section below.

    • Replace \<YOUR HOST NAME> with the hostname of your Assure1 Server. The response time metrics will show up under that device.

    • This script will execute a DNS query using dig, read the response time, and then call the GenericSOAPAgent to write a response time metric. The command line syntax for the script is:

      DNSCheck.sh <query> <test name>
      
      • \<query> should be an internal hostname if you were testing internal lookups, or an external hostname if external lookup times were desired.

      • \<test name> should be a label for the response time metric that will be populated in Metric Manager.

    • Make the script executable and run it on the command line to verify that it works.

    • Under the Devices navigation pane, select your host server. You should now see a new metric section named Response Times under which there should be a metric instance named after whatever you used for \<test name> when you ran the script.

  • Create the job on the Scheduled Jobs UI:

    1. Set the Server field to the server the stitcher will be running on.

    2. Set the Package Name field to topologyStitcher-app.

    3. Set the Job Name field to DNS Response Times - [TEST FQDN/IP].

    4. Set the Job Program field to the path of the script (relative to the "/opt/assure1/" directory). Update the \<query> and \<test name> values.

    5. Set Job Arguments to "".

    6. Set Job Description to something that useful in your environment.

    7. Set Minutes, Hours, Days, Months and WeekDays to "*" so the script is run every minute.

    8. Set Failover Type to Standalone.

    9. Set Status to Enabled.

  • Validate that the script is executing and the metric is being populated.

Code Sample

#!/bin/bash
QUERY    = $1
TESTNAME = $2
STATUS   = `/usr/bin/dig $QUERY |grep "ANSWER SECTION" >> /dev/null;echo $?`
VALUE    = `/usr/bin/dig $QUERY |grep "Query" |cut -d" " -f4`
if [ $VALUE == 0 ]; then
VALUE=1
fi
if [ $STATUS == 1 ]; then
STATUS=0
else
STATUS=1
fi
/opt/assure1/apps/metricSynTrans/GenericSOAPAgent -s localhost -p 6444 -M 90 -n $TESTNAME -v $VALUE -node <YOUR HOST NAME> -i 60 -status $STATUS      
echo "Queried [$STATUS] - $QUERY for $TESTNAME - Took $VALUE ms"