Opm Java MonitorThe Output Parser Monitor (Opm) bundled with boom allows you to create a monitor based on the output produced by system tools or other executables. Opm is a Java based Monitor that is able to parse and summarize result text lines containing numeric data. Most of the standard system tools like "top", "df" or "ps" are delivering results with useful numeric values for multiple objects. These values can be used for the system or process monitoring.
Started from version 2.00 the Opm Monitor supports Java based actions that can generate output for parsing: Let's take an example of processing the 'df' output of a Unix system. We will use the 'df -Pkl' call to have a similar output from most of the Unix systems: File System 1024-blocks Used Available Capacity Mounted on /dev/vg00/lvol5 24456 8472 15984 35% /home /dev/dsk/c0t0d0 3235348 3235348 0 100% /iuxcdrom0 /dev/vg00/lvol6 5235064 4167056 1068008 80% /opt /dev/vg00/lvol4 715400 8632 706768 2% /tmp /dev/vg00/u01 7693337 213287 7480050 3% /u01 /dev/vg00/lvol7 3289800 2853656 436144 87% /usr /dev/vg00/lvol8 6118216 1811520 4306696 30% /var /dev/vg00/lvol1 309928 130312 179616 43% /stand /dev/vg00/lvol3 409016 327264 81752 81% / 174116 0 174116 0% /dev/shm Most of these lines are showing really important values for monitoring. But every line provides information for a different mounted partition. So, to be able to monitor mounted partitions, a monitor must submit a separate value for each object. Let's assume we want to monitor the percentage of used space on each volume. We need to create a new Java Monitor with the MAXTHRESHOLD type based on the com.blixx.agent.monitors.Opm class.
In this example we are using the following pattern: (/dev.*)\s+(\d+)\s+(\d+)\s+(\d+)\s+([0-9\.]+)%\s+(.*)
This pattern defines 6 capturing groups that provide us 6 variables for every matched line:
In the Opm Monitor all defined variables can be accessed as DOUBLE or STRING.
Every matched line in our example is a potential monitor value. To submit multiple
monitor values we need the Object attribute. So the line: An Opm Java Monitor expects the following lines of parameters:
Line Description L1: Java class name
L3: "LineByLine" or "TableSummary"
L4: This pattern is responsible for matching and parsing strings in the output of the executable. Please note: There is only one global pattern for the TableSummary type. LineByLine requires a separate pattern for every following object line!
L5: Object line.
Object Line SyntaxAll elements must be separated by space. The first position is the object name. The object name can be defined as a constant string or if the LineByLine type is defined the svarN can be used. The svarN variables can also be combined with prefix or suffix. i.e. Err_svar1 Please note that svarN variables are not used by the TableSummary processing. The second position - takes summarization function:
* - The COUNT function requires one capture group in the pattern and returns number of matched lines in the output. The DELTA function has to be used only for counters. The rest of the line is the calculation string based on parsed double values. The calculation part can contain simple arithmetic operations, double constants and variables of double types (varN).
Syntax of Calculation... X1 'operand1' X2 'operand2' X3 'operand3' X4 ...Where Xn - double value or varN, operand - one of '+', '-', '/' ,'*' (trivial arithmetical operations) and one special: '\' Operand '\' - means a division of Xi/Xi-1. i.e. RES = var2 \ var3 => var3/var2 For the following examples we assume that the filtered string is parsed into variables: var1 - /dev/vg00/lvol5 var2 - 24456 var3 - 8472 var4 - 15984 var5 - 35 var6 - /home.
|