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

pinghandler.h File Reference


Detailed Description

The pinghandler will attempt to "ping" a specified host (send ICMP packet). This is useful to poll servers to see if they are up, and if up what is the estimated round trip time for a packet.

Wire keywords (standard handler keywords documented in Wire )

Example:

// monitor interface on database machine
set noconnect create event { name: "noconnect"  priority: 1 }

create handler ping { 
 hostname: dbserver1.mydomain.net
 noconnect: $noconnect
 timeout: 5
 cycletime: 60
}
NOTE: This handler has to run SUID to ROOT to access the ICMP socket. Events generated:
Event NameTypeDescription
connect AW_EVENT_TYPE_STRING Was able to connect, send string of "host"
noconnect AW_EVENT_TYPE_STRING Was NOT able to connect, send string of "host"
triptime AW_EVENT_TYPE_INT32 Estimated round trip time in usec
packets AW_EVENT_TYPE_STRING String of the form: <number of successful packets>:<number of tries>
Credit: "ping" code taken from ping.c by Mike Muuss for ICMP handling in iputil package

#include "sysnet.h"
#include "monitor.h"
#include "wire.h"

Go to the source code of this file.

Data Structures

struct  aw_pinghandler_events_t
 Events generated. More...

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

struct  aw_pinghandler_t
 Handler object. More...


Enumerations

enum  aw_pinghandler_state_cd_t { AW_PINGHANDLER_IDLE, AW_PINGHANDLER_WAIT_READ, AW_PINGHANDLER_DONE_READ }
 The state codes for each state on handler. More...


Functions

aw_pinghandler_t * aw_create_pinghandler (const aw_pinghandler_events_t *events, const byte_t *hostname, aw_timestamp_t timeout, u_int32_t maxretries, 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 pinghandler.

void aw_free_pinghandler (aw_pinghandler_t *p)
 Free handler and all associated resources.

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


Enumeration Type Documentation

enum aw_pinghandler_state_cd_t
 

The state codes for each state on handler.

Enumeration values:
AW_PINGHANDLER_IDLE 
AW_PINGHANDLER_WAIT_READ 
AW_PINGHANDLER_DONE_READ 


Function Documentation

aw_pinghandler_t* aw_create_pinghandler (  const aw_pinghandler_events_t *  events,
const byte_t *  hostname,
aw_timestamp_t  timeout,
u_int32_t  maxretries,
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 pinghandler.

aw_create_pinghandler

Parameters:
events Events to generate
hostname Hostname or dotted IP string
timeout Max time to run
maxretries Number of times to try before giving up
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_pinghandler (  aw_pinghandler_t *  p  ) 
 

Free handler and all associated resources.

aw_free_pinghandler

Parameters:
p The handler

aw_handler_t* aw_wire_pinghandler (  aw_wire_mkhandler_args_t *  args  ) 
 

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

aw_wire_pinghandler

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