libmoost
log4cxx::NscaAppender Class Reference

An appender that sends alerts to nagios via an nsca client. More...

#include <nsca_appender.hpp>

Collaboration diagram for log4cxx::NscaAppender:

List of all members.

Public Member Functions

 NscaAppender ()
 NscaAppender (std::string const &this_host, moost::nagios::nsca_config const &cfg)
 Construct an appender.
 NscaAppender (std::string const &this_host, std::string const &nsca_svr_host)
 Construct an appender.
 NscaAppender (std::string const &this_host, std::string const &this_host_desc, moost::nagios::nsca_config const &cfg)
 Construct an appender.
 NscaAppender (std::string const &this_host, std::string const &this_host_desc, std::string const &nsca_svr_host)
 Construct an appender.
 NscaAppender (LayoutPtr &layout)
 Construct an appender.
 NscaAppender (LayoutPtr &layout, std::string const &this_host, moost::nagios::nsca_config const &cfg)
 Construct an appender.
 NscaAppender (LayoutPtr &layout, std::string const &this_host, std::string const &nsca_svr_host)
 Construct an appender.
 NscaAppender (LayoutPtr &layout, std::string const &this_host, std::string const &this_host_desc, moost::nagios::nsca_config const &cfg)
 Construct an appender.
 NscaAppender (LayoutPtr &layout, std::string const &this_host, std::string const &this_host_desc, std::string const &nsca_svr_host)
 Construct an appender.
void setNscaHost (std::string const &host)
 Set the nsca server host name.
void setNscaPort (std::string const &port)
 Set the nsca server port.
void setRecvTimeoutMs (boost::uint16_t timeout)
 Set the socket receive timeout in ms.
void setSendTimeoutMs (boost::uint16_t timeout)
 Set the socket send timeout in ms.
void setEncType (std::string const &enctype)
 Set the encryption type.
void setEncPass (std::string const &encpass)
 Set the encryption password if needed.
void setThisHost (std::string const &host)
 Set the host name of the client.
void setThisHostDesc (std::string const &desc)
 Set a description for the client.
void setOption (const LogString &option, const LogString &value)
 Set an option value by name.
bool requiresLayout () const
 Returns a bool to indicate if a layout is required.
void activateOptions ()
 Activates options once they have been set.
void activateOptions (log4cxx::helpers::Pool &p)
 Activates options set via the logging config file.
void close ()
 Closes down the appender.
void append (spi::LoggingEventPtr const &event, helpers::Pool &p)
 Called by doAppend() to perform the actual appending.

Static Public Member Functions

static int get_level (int const level)

Private Attributes

std::string this_host_
std::string this_host_desc_
moost::nagios::nsca_config nsca_config_
boost::shared_ptr
< moost::nagios::nsca_client
nsca_client_
moost::logging::pseudo_ostreamout_

Detailed Description

An appender that sends alerts to nagios via an nsca client.

Definition at line 75 of file nsca_appender.hpp.


Constructor & Destructor Documentation

Definition at line 63 of file nsca_appender.cpp.

Here is the call graph for this function:

log4cxx::NscaAppender::NscaAppender ( std::string const &  this_host,
moost::nagios::nsca_config const &  cfg 
)

Construct an appender.

Parameters:
this_host: host name of the client
cfg: configuration structure

Definition at line 70 of file nsca_appender.cpp.

Here is the call graph for this function:

log4cxx::NscaAppender::NscaAppender ( std::string const &  this_host,
std::string const &  nsca_svr_host 
)

Construct an appender.

Parameters:
this_host: host name of the client
nsca_svr_host: host name of the nsca server

Definition at line 83 of file nsca_appender.cpp.

Here is the call graph for this function:

log4cxx::NscaAppender::NscaAppender ( std::string const &  this_host,
std::string const &  this_host_desc,
moost::nagios::nsca_config const &  cfg 
)

Construct an appender.

Parameters:
this_host: host name of the client
this_host_desc: short descript of the client
cfg: configuration structure

Definition at line 96 of file nsca_appender.cpp.

Here is the call graph for this function:

log4cxx::NscaAppender::NscaAppender ( std::string const &  this_host,
std::string const &  this_host_desc,
std::string const &  nsca_svr_host 
)

Construct an appender.

Parameters:
this_host: host name of the client
this_host_desc: short descript of the client
nsca_svr_host: host name of the nsca server

Definition at line 110 of file nsca_appender.cpp.

log4cxx::NscaAppender::NscaAppender ( LayoutPtr &  layout)

Construct an appender.

Parameters:
layout: A pointer to a layout pattern

Definition at line 123 of file nsca_appender.cpp.

Here is the call graph for this function:

log4cxx::NscaAppender::NscaAppender ( LayoutPtr &  layout,
std::string const &  this_host,
moost::nagios::nsca_config const &  cfg 
)

Construct an appender.

Parameters:
layout: A pointer to a layout pattern
this_host: host name of the client
cfg: configuration structure

Definition at line 130 of file nsca_appender.cpp.

Here is the call graph for this function:

log4cxx::NscaAppender::NscaAppender ( LayoutPtr &  layout,
std::string const &  this_host,
std::string const &  nsca_svr_host 
)

Construct an appender.

Parameters:
layout: A pointer to a layout pattern
this_host: host name of the client
nsca_svr_host: host name of the nsca server

Definition at line 144 of file nsca_appender.cpp.

Here is the call graph for this function:

log4cxx::NscaAppender::NscaAppender ( LayoutPtr &  layout,
std::string const &  this_host,
std::string const &  this_host_desc,
moost::nagios::nsca_config const &  cfg 
)

Construct an appender.

Parameters:
layout: A pointer to a layout pattern
this_host: host name of the client
this_host_desc: short descript of the client
cfg: configuration structure

Definition at line 158 of file nsca_appender.cpp.

Here is the call graph for this function:

log4cxx::NscaAppender::NscaAppender ( LayoutPtr &  layout,
std::string const &  this_host,
std::string const &  this_host_desc,
std::string const &  nsca_svr_host 
)

Construct an appender.

Parameters:
layout: A pointer to a layout pattern
this_host: host name of the client
this_host_desc: short descript of the client
nsca_svr_host: host name of the nsca server

Definition at line 173 of file nsca_appender.cpp.

Here is the call graph for this function:


Member Function Documentation

Activates options once they have been set.

Once options have been configured, calling this activates them.

Note:
This method MUST be called after changing any options to activate them. The reason for this is because it would be too expensive to re-activate them on the fly as they are modified.

Definition at line 293 of file nsca_appender.cpp.

Here is the caller graph for this function:

void log4cxx::NscaAppender::activateOptions ( log4cxx::helpers::Pool &  p)

Activates options set via the logging config file.

This method is automatically called by the log4cxx framework when assigning settings from a logging configuration file.

Parameters:
p: this is an internal parameter to log4cxx
void log4cxx::NscaAppender::append ( spi::LoggingEventPtr const &  event,
helpers::Pool &  p 
)

Called by doAppend() to perform the actual appending.

The doAppend() method in AppenderSkeleton will have already determined if this appender is of an appropriate threshold to perform any appending so there is no specific logic applied here other than to send the event to the nagios server.

Parameters:
event: the event being logged
p: an internal parameter to log4cxx

Definition at line 319 of file nsca_appender.cpp.

Here is the call graph for this function:

Closes down the appender.

Once this is called the nsca client will be disconnected. To re-establish the connection you should call activateOptions().

Definition at line 308 of file nsca_appender.cpp.

Here is the call graph for this function:

int log4cxx::NscaAppender::get_level ( int const  level) [static]

Definition at line 423 of file nsca_appender.cpp.

Here is the caller graph for this function:

Returns a bool to indicate if a layout is required.

The nsca appender will use the standard basic layout if none is provided. This should be good enough for nearly all occasions.

Returns:
: always false since a layout is not actually required

Definition at line 314 of file nsca_appender.cpp.

void log4cxx::NscaAppender::setEncPass ( std::string const &  encpass)

Set the encryption password if needed.

Parameters:
encpass: the password to use

Definition at line 218 of file nsca_appender.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void log4cxx::NscaAppender::setEncType ( std::string const &  enctype)

Set the encryption type.

Parameters:
enctype: the encryption type to use

Definition at line 212 of file nsca_appender.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void log4cxx::NscaAppender::setNscaHost ( std::string const &  host)

Set the nsca server host name.

Parameters:
host: the hostname to use

Definition at line 188 of file nsca_appender.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void log4cxx::NscaAppender::setNscaPort ( std::string const &  port)

Set the nsca server port.

Parameters:
port: the port to use

Definition at line 194 of file nsca_appender.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void log4cxx::NscaAppender::setOption ( const LogString &  option,
const LogString &  value 
)

Set an option value by name.

This is used by the log4cxx framework to allow the dynamic setting of options from a logging configuration file.

Parameters:
option: the option name
value: the value to set the option to

Definition at line 236 of file nsca_appender.cpp.

Here is the call graph for this function:

void log4cxx::NscaAppender::setRecvTimeoutMs ( boost::uint16_t  timeout)

Set the socket receive timeout in ms.

Parameters:
timeout: the timeout to use

Definition at line 200 of file nsca_appender.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void log4cxx::NscaAppender::setSendTimeoutMs ( boost::uint16_t  timeout)

Set the socket send timeout in ms.

Parameters:
timeout: the timeout to use

Definition at line 206 of file nsca_appender.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void log4cxx::NscaAppender::setThisHost ( std::string const &  host)

Set the host name of the client.

Parameters:
host: the hostname to use

Definition at line 224 of file nsca_appender.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void log4cxx::NscaAppender::setThisHostDesc ( std::string const &  desc)

Set a description for the client.

Parameters:
desc: the clients description

Definition at line 230 of file nsca_appender.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 326 of file nsca_appender.hpp.

std::string log4cxx::NscaAppender::this_host_ [private]

Definition at line 323 of file nsca_appender.hpp.

Definition at line 324 of file nsca_appender.hpp.


The documentation for this class was generated from the following files: