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

filestathandler.h File Reference


Detailed Description

The filestathandler will poll a file for information about its attributes, presence and absence. This is useful to poll for core files, watch for files getting modified (security), testing for files exceeding allowable size, and watching for important files getting deleted.

Wire keywords (standard handler keywords documented in Wire )

Example:

// watch password file, send events on mtime or deleted set passwdchange create event { name: "passwd changed" } create handler filestat { filename: /etc/passwd file-created: $passwdchange file-deleted: $passwdchange file-mtime-change: $passwdchange cycletime: 300 }

Events generated:
Event NameTypeDescription
file_exists AW_EVENT_TYPE_STRING File exists at handler start, send filename
file_notexists AW_EVENT_TYPE_STRING File does not exist at handler start, send filename
file_created AW_EVENT_TYPE_STRING New file, send filename
file_deleted AW_EVENT_TYPE_STRING File deleted, send filename
file_size AW_EVENT_TYPE_INT32 Size of file (bytes)
file_size_change AW_EVENT_TYPE_INT32 Size of file change since last poll (bytes)
file_mtime AW_EVENT_TYPE_INT32 Last modified time (time_t)
file_mtime_change AW_EVENT_TYPE_INT32 Last modified time changed since last poll (seconds)

Events accepted:
TypeDescription
Any Generate an event of type requested

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

Go to the source code of this file.

Data Structures

struct  aw_filestathandler_events_t
 Events generated. More...

struct  aw_filestathandler_state_t
 State of handler during probing. More...

struct  aw_filestathandler_t
 Handler object. More...


Functions

aw_filestathandler_t * aw_create_filestathandler (const aw_filestathandler_events_t *events, const char *filename, int32_t dont_log_file_not_found, 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 filestat handler.

void aw_free_filestathandler (aw_filestathandler_t *p)
 Free handler and all associated resources.

aw_handler_t * aw_wire_filestathandler (aw_wire_mkhandler_args_t *args)
 Create a filestat handler using "wire". See header doc for keyword documentation.


Function Documentation

aw_filestathandler_t* aw_create_filestathandler (  const aw_filestathandler_events_t *  events,
const char *  filename,
int32_t  dont_log_file_not_found,
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 filestat handler.

aw_create_filestathandler

Parameters:
events Events to generate
filename Name of file to stat
dont_log_file_not_found Non zero if you don't want file not found logged (e.g., watching for a core file)
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_filestathandler (  aw_filestathandler_t *  p  ) 
 

Free handler and all associated resources.

aw_free_filestathandler

Parameters:
p The handler

aw_handler_t* aw_wire_filestathandler (  aw_wire_mkhandler_args_t *  args  ) 
 

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

aw_wire_filestathandler

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