Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

rfilterhandler.h File Reference


Detailed Description

This handler acts as a numerical range filter. Those events that are received with a numerical value within supplied ([min,max]) of the range filter will be copied and sent to the associated copy address. You may have variable numbers of range filters which allow you to filter an event stream into channels of events based on value. This handler is useful as a theshold filter (e.g., if free memory is between 0,5M then copy event, sending to a notification handler).

The priority: option changes the range check from evaluating the event's value to evaluating the event's priority, thus allowing you to break an event stream into channels of events based on priority.

Wire keywords (standard handler keywords documented in Wire )

You my have multiple filter: lines. Matches are applied in the order they are declared.

Value filter example:

// assume $memused is bound to events generated // by memprobe which relays the used memory in the system // and you want to be notified if it gets higher than 90% set highmem create event { name: "low mem" priority: 100 }

// filter create handler rfilter { filter: $highmem 90.0 100 regevent: $memused }

// alert create handler execp { cmd: "mail -s \"Alert: $n\" sysadmin" input: "Alert:\n \$n \$v\n\n" regevent: $highmem }

Priority filter example:

// Assume that $allevents is bound to all defined // events and further assume you carefully assign priorities to // all events and that you only want to be alerted on // the "high" priority events.

set alert create event { name: "alert" }

// filter create handler rfilter { priority: filter $alert 50 100 regevent: $allevents }

// alert create handler execp { cmd: "mail -s \"Alert: $n\" sysadmin" input: "Alert:\n \$n \$v\n\n" regevent: $alert }

Events accepted when filtering value:
TypeDescription
AW_EVENT_TYPE_INT32 |
AW_EVENT_TYPE_INT64 |
AW_EVENT_TYPE_FLOAT32 |
AW_EVENT_TYPE_FLOAT64 |
AW_EVENT_TYPE_TIMESTAMP
Apply range test to event, if value in range then generate a copy

Events generated when filtering value:
Event NameTypeDescription
copy AW_EVENT_TYPE_INT32 |
AW_EVENT_TYPE_INT64 |
AW_EVENT_TYPE_FLOAT32 |
AW_EVENT_TYPE_FLOAT64 |
AW_EVENT_TYPE_TIMESTAMP
copy of original event that passed the filter

Events accepted when filtering priority:
TypeDescription
any Apply range test to event, if priority in range then generate a copy

Events generated when filtering priority:
Event NameTypeDescription
copy any copy of original event that passed the filter

#include <stdio.h>
#include "monitor.h"
#include "wire.h"

Go to the source code of this file.

Data Structures

struct  aw_rfilter_range_filter_t
 Event to generate w/range match. More...

struct  aw_rfilterhandler_t
 Rfilter handler object. More...


Functions

aw_rfilterhandler_t * aw_create_rfilterhandler (u_int32_t nfilters, aw_rfilter_range_filter_t *filters, u_int32_t priority, int32_t(*regevent)(aw_handler_t *h, aw_address_t *eventid, u_int32_t index), int32_t(*regmaskevent)(aw_handler_t *h, aw_address_t *eventid, u_int32_t index), const aw_alarm_sched_t *sched, aw_logger_t *logger)
 Create a range filter handler.

void aw_free_rfilterhandler (aw_rfilterhandler_t *h)
 Free handler and all associated resources.

aw_handler_t * aw_wire_rfilterhandler (aw_wire_mkhandler_args_t *args)
 Create a rfilterhandler using "wire". See header doc for keyword documentation.


Function Documentation

aw_rfilterhandler_t* aw_create_rfilterhandler (  u_int32_t  nfilters,
aw_rfilter_range_filter_t *  filters,
u_int32_t  priority,
int32_t(*  regevent)(aw_handler_t *h, aw_address_t *eventid, u_int32_t index),
int32_t(*  regmaskevent)(aw_handler_t *h, aw_address_t *eventid, u_int32_t index),
const aw_alarm_sched_t *  sched,
aw_logger_t *  logger
) 
 

Create a range filter handler.

aw_create_rfilterhandler

Parameters:
nfilters How many filters
filters Event filters, if range match is true, generate event
priority If non-zero indicates you want to filter on priority rather than value
regevent Function pointer for event registration
regmaskevent Function pointer for event mask registration
sched Run schedule
logger Logger object
Returns:
Handler object

void aw_free_rfilterhandler (  aw_rfilterhandler_t *  h  ) 
 

Free handler and all associated resources.

aw_free_rfilterhandler

Parameters:
h The handler

aw_handler_t* aw_wire_rfilterhandler (  aw_wire_mkhandler_args_t *  args  ) 
 

Create a rfilterhandler using "wire". See header doc for keyword documentation.

aw_wire_rfilterhandler

Aware 0.11.1 Copyright (C) 1998-2005 Russell Leighton (russ@elegant-software.com)