libmoost
|
An appender that sends alerts to nagios via an nsca client. More...
#include <nsca_appender.hpp>
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_ostream & | out_ |
An appender that sends alerts to nagios via an nsca client.
Definition at line 75 of file nsca_appender.hpp.
log4cxx::NscaAppender::NscaAppender | ( | std::string const & | this_host, |
moost::nagios::nsca_config const & | cfg | ||
) |
Construct an appender.
this_host | : host name of the client |
cfg | : configuration structure |
Definition at line 70 of file nsca_appender.cpp.
log4cxx::NscaAppender::NscaAppender | ( | std::string const & | this_host, |
std::string const & | nsca_svr_host | ||
) |
Construct an appender.
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.
log4cxx::NscaAppender::NscaAppender | ( | std::string const & | this_host, |
std::string const & | this_host_desc, | ||
moost::nagios::nsca_config const & | cfg | ||
) |
Construct an appender.
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.
log4cxx::NscaAppender::NscaAppender | ( | std::string const & | this_host, |
std::string const & | this_host_desc, | ||
std::string const & | nsca_svr_host | ||
) |
Construct an appender.
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.
layout | : A pointer to a layout pattern |
Definition at line 123 of file nsca_appender.cpp.
log4cxx::NscaAppender::NscaAppender | ( | LayoutPtr & | layout, |
std::string const & | this_host, | ||
moost::nagios::nsca_config const & | cfg | ||
) |
Construct an appender.
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.
log4cxx::NscaAppender::NscaAppender | ( | LayoutPtr & | layout, |
std::string const & | this_host, | ||
std::string const & | nsca_svr_host | ||
) |
Construct an appender.
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.
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.
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.
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.
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.
Activates options once they have been set.
Once options have been configured, calling this activates them.
Definition at line 293 of file nsca_appender.cpp.
void log4cxx::NscaAppender::activateOptions | ( | log4cxx::helpers::Pool & | p | ) |
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.
event | : the event being logged |
p | : an internal parameter to log4cxx |
Definition at line 319 of file nsca_appender.cpp.
void log4cxx::NscaAppender::close | ( | ) |
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.
int log4cxx::NscaAppender::get_level | ( | int const | level | ) | [static] |
bool log4cxx::NscaAppender::requiresLayout | ( | ) | const |
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.
Definition at line 314 of file nsca_appender.cpp.
void log4cxx::NscaAppender::setEncPass | ( | std::string const & | encpass | ) |
Set the encryption password if needed.
encpass | : the password to use |
Definition at line 218 of file nsca_appender.cpp.
void log4cxx::NscaAppender::setEncType | ( | std::string const & | enctype | ) |
Set the encryption type.
enctype | : the encryption type to use |
Definition at line 212 of file nsca_appender.cpp.
void log4cxx::NscaAppender::setNscaHost | ( | std::string const & | host | ) |
Set the nsca server host name.
host | : the hostname to use |
Definition at line 188 of file nsca_appender.cpp.
void log4cxx::NscaAppender::setNscaPort | ( | std::string const & | port | ) |
Set the nsca server port.
port | : the port to use |
Definition at line 194 of file nsca_appender.cpp.
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.
option | : the option name |
value | : the value to set the option to |
Definition at line 236 of file nsca_appender.cpp.
void log4cxx::NscaAppender::setRecvTimeoutMs | ( | boost::uint16_t | timeout | ) |
Set the socket receive timeout in ms.
timeout | : the timeout to use |
Definition at line 200 of file nsca_appender.cpp.
void log4cxx::NscaAppender::setSendTimeoutMs | ( | boost::uint16_t | timeout | ) |
Set the socket send timeout in ms.
timeout | : the timeout to use |
Definition at line 206 of file nsca_appender.cpp.
void log4cxx::NscaAppender::setThisHost | ( | std::string const & | host | ) |
Set the host name of the client.
host | : the hostname to use |
Definition at line 224 of file nsca_appender.cpp.
void log4cxx::NscaAppender::setThisHostDesc | ( | std::string const & | desc | ) |
Set a description for the client.
desc | : the clients description |
Definition at line 230 of file nsca_appender.cpp.
boost::shared_ptr<moost::nagios::nsca_client> log4cxx::NscaAppender::nsca_client_ [private] |
Definition at line 326 of file nsca_appender.hpp.
Definition at line 325 of file nsca_appender.hpp.
Definition at line 327 of file nsca_appender.hpp.
std::string log4cxx::NscaAppender::this_host_ [private] |
Definition at line 323 of file nsca_appender.hpp.
std::string log4cxx::NscaAppender::this_host_desc_ [private] |
Definition at line 324 of file nsca_appender.hpp.