mirror of https://github.com/Icinga/icinga2.git
parent
b92a139a4c
commit
58cdce8d7c
|
@ -48,6 +48,9 @@ ContextTrace::ContextTrace(void)
|
||||||
|
|
||||||
void ContextTrace::Print(std::ostream& fp) const
|
void ContextTrace::Print(std::ostream& fp) const
|
||||||
{
|
{
|
||||||
|
if (m_Frames.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
fp << std::endl;
|
fp << std::endl;
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
|
@ -62,7 +62,7 @@ void icinga::ShowCodeLocation(std::ostream& out, const DebugInfo& di, bool verbo
|
||||||
if (di.Path.IsEmpty())
|
if (di.Path.IsEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
out << "Location: " << di << "\n";
|
out << "Location: " << di;
|
||||||
|
|
||||||
std::ifstream ifs;
|
std::ifstream ifs;
|
||||||
ifs.open(di.Path.CStr(), std::ifstream::in);
|
ifs.open(di.Path.CStr(), std::ifstream::in);
|
||||||
|
@ -71,6 +71,9 @@ void icinga::ShowCodeLocation(std::ostream& out, const DebugInfo& di, bool verbo
|
||||||
char line[1024];
|
char line[1024];
|
||||||
|
|
||||||
while (ifs.good() && lineno <= di.LastLine + EXTRA_LINES) {
|
while (ifs.good() && lineno <= di.LastLine + EXTRA_LINES) {
|
||||||
|
if (lineno == 0)
|
||||||
|
out << "\n";
|
||||||
|
|
||||||
lineno++;
|
lineno++;
|
||||||
|
|
||||||
ifs.getline(line, sizeof(line));
|
ifs.getline(line, sizeof(line));
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
EventQueue::EventQueue(void)
|
EventQueue::EventQueue(const String& name)
|
||||||
: m_Filter(NULL)
|
: m_Name(name), m_Filter(NULL)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
EventQueue::~EventQueue(void)
|
EventQueue::~EventQueue(void)
|
||||||
|
@ -44,8 +44,14 @@ void EventQueue::ProcessEvent(const Dictionary::Ptr& event)
|
||||||
ScriptFrame frame;
|
ScriptFrame frame;
|
||||||
frame.Sandboxed = true;
|
frame.Sandboxed = true;
|
||||||
|
|
||||||
if (!FilterUtility::EvaluateFilter(frame, m_Filter, event, "event"))
|
try {
|
||||||
|
if (!FilterUtility::EvaluateFilter(frame, m_Filter, event, "event"))
|
||||||
|
return;
|
||||||
|
} catch (const std::exception& ex) {
|
||||||
|
Log(LogWarning, "EventQueue")
|
||||||
|
<< "Error occurred while evaluating event filter for queue '" << m_Name << "': " << DiagnosticInformation(ex);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_Mutex);
|
boost::mutex::scoped_lock lock(m_Mutex);
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ class I2_REMOTE_API EventQueue : public Object
|
||||||
public:
|
public:
|
||||||
DECLARE_PTR_TYPEDEFS(EventQueue);
|
DECLARE_PTR_TYPEDEFS(EventQueue);
|
||||||
|
|
||||||
EventQueue(void);
|
EventQueue(const String& name);
|
||||||
~EventQueue(void);
|
~EventQueue(void);
|
||||||
|
|
||||||
bool CanProcessEvent(const String& type) const;
|
bool CanProcessEvent(const String& type) const;
|
||||||
|
@ -59,6 +59,8 @@ public:
|
||||||
static void Unregister(const String& name);
|
static void Unregister(const String& name);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
String m_Name;
|
||||||
|
|
||||||
mutable boost::mutex m_Mutex;
|
mutable boost::mutex m_Mutex;
|
||||||
boost::condition_variable m_CV;
|
boost::condition_variable m_CV;
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ bool EventsHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& request
|
||||||
EventQueue::Ptr queue = EventQueue::GetByName(queueName);
|
EventQueue::Ptr queue = EventQueue::GetByName(queueName);
|
||||||
|
|
||||||
if (!queue) {
|
if (!queue) {
|
||||||
queue = new EventQueue();
|
queue = new EventQueue(queueName);
|
||||||
EventQueue::Register(queueName, queue);
|
EventQueue::Register(queueName, queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue