» Interpretation Methods for Normal Datapoints

Data source collectors collect data, some of which can be used directly (e.g. the responseTime of the web page collector) but others require further interpretation.

The Post Processor method informs LogicMonitor how to treat the raw measurements to extract the desired value.

The following methods are supported (although not all methods apply to all collectors).

You specify the Interpretation Method when defining or editing the datapoint (by clicking Add Normal Datapoint or the pencil icon next to an existing datapoint.)

None

Use the raw measurement value as the datapoint value. Typically SNMP datasources use this method - the numeric output of the OID is the data that should be stored.

Namevalue

Treats a multi-line string raw measurement as a set of name-value pairs separated by an equal sign or colon.  e.g.

Buffers=11023
BuffersAvailable=333
heapSize=245MB

You can extract the number of BuffersAvailable from the above output by specifying:

 

For JDBC datasources, namevalue postprocessor expects a column name as the post-processor parameter, and returns the value of the first row for that column.

Regex

If a raw measurement string can't be treated as a set of name-value pairs, you can use regular expressions to extract data. The contents of the first capture group - i.e. text in parenthesis - in the regex will be assigned to the datapoint. For example, the Apache datasources uses a regular expression to extract counters from the server-status page. The raw output of the webpage collector looks like:

Total Accesses: 8798099
Total kBytes: 328766882
CPULoad: 1.66756
Uptime: 80462

To extract the Total Accesses, define the datapoint as:

 

 

Textmatch

Textmatch tests whether a string is present within the raw measurement.  If the string exists, textmatch returns 1, otherwise 0.

For example, to check if Tomcat is running on a host, you may have a script datasource that executes 'ps -ef | grep java' periodically. The output from the pipeline should contain "org.apache.catalina.startup.Bootstrap start" if Tomcat is running.

 

The datapoint above checks if the raw measurement output contains  the string "org.apache.catalina.startup.Bootstrap start". If yes, the datapoint will be 1 indicating Tomcat is running, otherwise the datapoint value will be 0.

CSV/TSV

If the raw measurement is a CSV/TSV array, you can use CSV/TSV method to extract values.

There are three forms of parameters the CSV/TSV post processor will accept:

  • a simple integer N - this will extract the Nth element of the first line of input (elements start at zero)
  • index=Nx,Ny - extract the Nxth element of the Nyth line of the input
  • line=regex index=Nx - extract the Nxth element of the first line which matches the given regex

For example, a script datasource executes 'iostat | grep 'sda' | head -1' to get the statistics of hard disk sda. The output is:

sda              33.75         3.92       719.33    9145719 1679687042

which is a TSV array. The fourth column (719.33) is blocks written per second. To extract this value into a datapoint writtenBlks using TSV method, select "TSVString" as the method to interpret the output, and 3 as the index.

 

Hexexpr

Hexexpr method is applied to TCP/UDP payload returned by TCP/UDP collector. The payload is treated as a byte array. You specify an offset and a length that could be 1, 2, 4, or 8 (corresponding to data type byte, short, int, or long, respectively) in the format of offset:length in the post-processor parameter. Hexexpr will return the value of the byte (short, int, or long) starting at offset of the array. The method is very useful to return the value of a field in binary packets such as DNS.

JSON

Some collectors generate a JSON literal string as the value of one of the raw datapoints. For example, you can create a webpage datasource sending a HTTP request "/api/overview" to RabbitMQ server to collect its performance information. RabbitMQ returns a JSON literal string like:

{
  "management_version":"2.5.1",
  "statistics_level":"fine",
  "message_stats":[],
  "queue_totals":{
    "messages":0,
    "messages_ready":0,
    "messages_unacknowledged":0
  },
  "node":"rabbit@labpnginx01",
  "statistics_db_node":"rabbit@labpnginx01",
  "listeners":[
    {
      "node":"rabbit@labpnginx01",
      "protocol":"amqp",
      "host":"labpnginx01",
      "ip_address":"::",
      "port":5672
    }
  ]
}

You can create a datapoint (using JSON post-processor) to extract number of messages in the queue.

 

Members can be retrieved using dot or subscript operators. LogicMonitor uses the same syntax  used in JavaScript code to identify objects. For example, "listeners[0].port" will return 5672 from the above raw data.

XPath

XPath can be used to navigate through elements and attributes in an XML document.

<Order xmlns="http://www.example.com/myschema.xml">
<Customer>
 <Name>Bill Buckram</Name>
 <Cardnum>234 234 234 234</Cardnum>
</Customer>
<Manifest>
 <Item>
  <ID>209</ID>
  <Title>Duke: A Biography of the Java Evangelist</Title>
  <Quantity>1</Quantity>
  <UnitPrice>$10.75</UnitPrice>
 </Item>
 <Item>
  <ID>204</ID>
  <Title>
  Making the Transition from C++ to the Java(tm) Language
  </Title>
  <Quantity>1</Quantity>
  <UnitPrice>$10.75</UnitPrice>
 </Item>
</Manifest>
</Order>

e.g. you could extract the order ID for the book "Making the Transition from C++ to Java" from the XML page above with this datapoint configuration: