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 Unified Assurance Server.

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"