Skip to content

Detailed Description

dbraga edited this page Nov 11, 2014 · 2 revisions

WikiDetailed Description

Thoth Monitor

Thoth Monitor is the module responsible of monitoring metrics.
Prior to this module, Solr requests are collected and indexed inside the Thoth Index. All the data that resides inside Thoth is a valuable source that can be used to fuel a monitoring and alerting system.
For more information on the data collection : Thoth data Collection
For more information on the Thoth Index: Thoth Index
Thoth Monitor module is responsible for :

  • Monitor defined metrics
  • Alert if necessary

Default Monitors

Thoth monitor comes with a couple of already implemented monitors. Additional monitors can be easily implemented and included in a local version of Thoth Monitor.
Contribution back to this repository is highly recommended if the custom monitor could fit public usage.

  • com.trulia.thoth.monitor.QTimeMonitor : Monitor that observe query time of a search server and it compares it with historical information and similar servers in the same pool.
  • com.trulia.thoth.monitor.ZeroHitsMonitor : Monitor that observe number of Solr queries with "zero hits" of a search server and it compares it with historical information.

Complete list of available types of Thoth monitors is here

Load monitors in Thoth Monitor

Thoth Monitor will try to load all the monitors specified in the monitors configuration file.
Location of the configuration file can be specified in the application.properties file :

# snippet from application.properties
thoth.monitor.configuration.file=/tmp/monitors.xml

The content should look something like this

<?xml version="1.0" encoding="UTF-8"?>
<Monitors>
    <Monitor>
        <name>QTime Monitor</name>
        <className>com.trulia.thoth.monitor.QTimeMonitor</className>
    </Monitor>
    <Monitor>
        <name>Zero hits Monitor</name>
        <className>com.trulia.thoth.monitor.ZeroHitsMonitor</className>
    </Monitor>

</Monitors>

For a complete example look here

Create a custom Thoth monitor

First create a new Monitor class :

  • Extend com.trulia.thoth.monitor.Monitor
  • Implement the public void alert(String body) and the public MonitorResult call() methods

Add the newly created jar in the classpath and be sure to add the new monitor to the monitors configuration file.