mirror of https://github.com/Icinga/icinga2.git
parent
820f290b75
commit
3d4e48aa12
|
@ -146,8 +146,8 @@ Dictionary::Ptr LivestatusLogUtility::GetAttributes(const String& text)
|
||||||
boost::algorithm::split(tokens, options, boost::is_any_of(";"));
|
boost::algorithm::split(tokens, options, boost::is_any_of(";"));
|
||||||
|
|
||||||
/* set default values */
|
/* set default values */
|
||||||
bag->Set("log_class", LogEntryClassInfo);
|
bag->Set("class", LogEntryClassInfo);
|
||||||
bag->Set("log_type", 0);
|
bag->Set("type", 0);
|
||||||
bag->Set("state", 0);
|
bag->Set("state", 0);
|
||||||
bag->Set("attempt", 0);
|
bag->Set("attempt", 0);
|
||||||
bag->Set("message", text); /* used as 'message' in log table, and 'log_output' in statehist table */
|
bag->Set("message", text); /* used as 'message' in log table, and 'log_output' in statehist table */
|
||||||
|
@ -165,16 +165,16 @@ Dictionary::Ptr LivestatusLogUtility::GetAttributes(const String& text)
|
||||||
bag->Set("plugin_output", tokens[4]);
|
bag->Set("plugin_output", tokens[4]);
|
||||||
|
|
||||||
if (type.Contains("INITIAL HOST STATE")) {
|
if (type.Contains("INITIAL HOST STATE")) {
|
||||||
bag->Set("log_class", LogEntryClassState);
|
bag->Set("class", LogEntryClassState);
|
||||||
bag->Set("log_type", LogEntryTypeHostInitialState);
|
bag->Set("type", LogEntryTypeHostInitialState);
|
||||||
}
|
}
|
||||||
else if (type.Contains("CURRENT HOST STATE")) {
|
else if (type.Contains("CURRENT HOST STATE")) {
|
||||||
bag->Set("log_class", LogEntryClassState);
|
bag->Set("class", LogEntryClassState);
|
||||||
bag->Set("log_type", LogEntryTypeHostCurrentState);
|
bag->Set("type", LogEntryTypeHostCurrentState);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bag->Set("log_class", LogEntryClassAlert);
|
bag->Set("class", LogEntryClassAlert);
|
||||||
bag->Set("log_type", LogEntryTypeHostAlert);
|
bag->Set("type", LogEntryTypeHostAlert);
|
||||||
}
|
}
|
||||||
|
|
||||||
return bag;
|
return bag;
|
||||||
|
@ -188,11 +188,11 @@ Dictionary::Ptr LivestatusLogUtility::GetAttributes(const String& text)
|
||||||
bag->Set("comment", tokens[2]);
|
bag->Set("comment", tokens[2]);
|
||||||
|
|
||||||
if (type.Contains("HOST FLAPPING ALERT")) {
|
if (type.Contains("HOST FLAPPING ALERT")) {
|
||||||
bag->Set("log_class", LogEntryClassAlert);
|
bag->Set("class", LogEntryClassAlert);
|
||||||
bag->Set("log_type", LogEntryTypeHostFlapping);
|
bag->Set("type", LogEntryTypeHostFlapping);
|
||||||
} else {
|
} else {
|
||||||
bag->Set("log_class", LogEntryClassAlert);
|
bag->Set("class", LogEntryClassAlert);
|
||||||
bag->Set("log_type", LogEntryTypeHostDowntimeAlert);
|
bag->Set("type", LogEntryTypeHostDowntimeAlert);
|
||||||
}
|
}
|
||||||
|
|
||||||
return bag;
|
return bag;
|
||||||
|
@ -210,16 +210,16 @@ Dictionary::Ptr LivestatusLogUtility::GetAttributes(const String& text)
|
||||||
bag->Set("plugin_output", tokens[5]);
|
bag->Set("plugin_output", tokens[5]);
|
||||||
|
|
||||||
if (type.Contains("INITIAL SERVICE STATE")) {
|
if (type.Contains("INITIAL SERVICE STATE")) {
|
||||||
bag->Set("log_class", LogEntryClassState);
|
bag->Set("class", LogEntryClassState);
|
||||||
bag->Set("log_type", LogEntryTypeServiceInitialState);
|
bag->Set("type", LogEntryTypeServiceInitialState);
|
||||||
}
|
}
|
||||||
else if (type.Contains("CURRENT SERVICE STATE")) {
|
else if (type.Contains("CURRENT SERVICE STATE")) {
|
||||||
bag->Set("log_class", LogEntryClassState);
|
bag->Set("class", LogEntryClassState);
|
||||||
bag->Set("log_type", LogEntryTypeServiceCurrentState);
|
bag->Set("type", LogEntryTypeServiceCurrentState);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bag->Set("log_class", LogEntryClassAlert);
|
bag->Set("class", LogEntryClassAlert);
|
||||||
bag->Set("log_type", LogEntryTypeServiceAlert);
|
bag->Set("type", LogEntryTypeServiceAlert);
|
||||||
}
|
}
|
||||||
|
|
||||||
return bag;
|
return bag;
|
||||||
|
@ -234,11 +234,11 @@ Dictionary::Ptr LivestatusLogUtility::GetAttributes(const String& text)
|
||||||
bag->Set("comment", tokens[3]);
|
bag->Set("comment", tokens[3]);
|
||||||
|
|
||||||
if (type.Contains("SERVICE FLAPPING ALERT")) {
|
if (type.Contains("SERVICE FLAPPING ALERT")) {
|
||||||
bag->Set("log_class", LogEntryClassAlert);
|
bag->Set("class", LogEntryClassAlert);
|
||||||
bag->Set("log_type", LogEntryTypeServiceFlapping);
|
bag->Set("type", LogEntryTypeServiceFlapping);
|
||||||
} else {
|
} else {
|
||||||
bag->Set("log_class", LogEntryClassAlert);
|
bag->Set("class", LogEntryClassAlert);
|
||||||
bag->Set("log_type", LogEntryTypeServiceDowntimeAlert);
|
bag->Set("type", LogEntryTypeServiceDowntimeAlert);
|
||||||
}
|
}
|
||||||
|
|
||||||
return bag;
|
return bag;
|
||||||
|
@ -246,8 +246,8 @@ Dictionary::Ptr LivestatusLogUtility::GetAttributes(const String& text)
|
||||||
if (tokens.size() < 4)
|
if (tokens.size() < 4)
|
||||||
return bag;
|
return bag;
|
||||||
|
|
||||||
bag->Set("log_class", LogEntryClassState);
|
bag->Set("class", LogEntryClassState);
|
||||||
bag->Set("log_type", LogEntryTypeTimeperiodTransition);
|
bag->Set("type", LogEntryTypeTimeperiodTransition);
|
||||||
|
|
||||||
bag->Set("host_name", tokens[0]);
|
bag->Set("host_name", tokens[0]);
|
||||||
bag->Set("service_description", tokens[1]);
|
bag->Set("service_description", tokens[1]);
|
||||||
|
@ -264,8 +264,8 @@ Dictionary::Ptr LivestatusLogUtility::GetAttributes(const String& text)
|
||||||
bag->Set("command_name", tokens[4]);
|
bag->Set("command_name", tokens[4]);
|
||||||
bag->Set("plugin_output", tokens[5]);
|
bag->Set("plugin_output", tokens[5]);
|
||||||
|
|
||||||
bag->Set("log_class", LogEntryClassNotification);
|
bag->Set("class", LogEntryClassNotification);
|
||||||
bag->Set("log_type", LogEntryTypeHostNotification);
|
bag->Set("type", LogEntryTypeHostNotification);
|
||||||
|
|
||||||
return bag;
|
return bag;
|
||||||
} else if (type.Contains("SERVICE NOTIFICATION")) {
|
} else if (type.Contains("SERVICE NOTIFICATION")) {
|
||||||
|
@ -280,8 +280,8 @@ Dictionary::Ptr LivestatusLogUtility::GetAttributes(const String& text)
|
||||||
bag->Set("command_name", tokens[5]);
|
bag->Set("command_name", tokens[5]);
|
||||||
bag->Set("plugin_output", tokens[6]);
|
bag->Set("plugin_output", tokens[6]);
|
||||||
|
|
||||||
bag->Set("log_class", LogEntryClassNotification);
|
bag->Set("class", LogEntryClassNotification);
|
||||||
bag->Set("log_type", LogEntryTypeServiceNotification);
|
bag->Set("type", LogEntryTypeServiceNotification);
|
||||||
|
|
||||||
return bag;
|
return bag;
|
||||||
} else if (type.Contains("PASSIVE HOST CHECK")) {
|
} else if (type.Contains("PASSIVE HOST CHECK")) {
|
||||||
|
@ -292,7 +292,7 @@ Dictionary::Ptr LivestatusLogUtility::GetAttributes(const String& text)
|
||||||
bag->Set("state", Host::StateFromString(tokens[1]));
|
bag->Set("state", Host::StateFromString(tokens[1]));
|
||||||
bag->Set("plugin_output", tokens[2]);
|
bag->Set("plugin_output", tokens[2]);
|
||||||
|
|
||||||
bag->Set("log_class", LogEntryClassPassive);
|
bag->Set("class", LogEntryClassPassive);
|
||||||
|
|
||||||
return bag;
|
return bag;
|
||||||
} else if (type.Contains("PASSIVE SERVICE CHECK")) {
|
} else if (type.Contains("PASSIVE SERVICE CHECK")) {
|
||||||
|
@ -304,27 +304,27 @@ Dictionary::Ptr LivestatusLogUtility::GetAttributes(const String& text)
|
||||||
bag->Set("state", Host::StateFromString(tokens[2]));
|
bag->Set("state", Host::StateFromString(tokens[2]));
|
||||||
bag->Set("plugin_output", tokens[3]);
|
bag->Set("plugin_output", tokens[3]);
|
||||||
|
|
||||||
bag->Set("log_class", LogEntryClassPassive);
|
bag->Set("class", LogEntryClassPassive);
|
||||||
|
|
||||||
return bag;
|
return bag;
|
||||||
} else if (type.Contains("EXTERNAL COMMAND")) {
|
} else if (type.Contains("EXTERNAL COMMAND")) {
|
||||||
bag->Set("log_class", LogEntryClassCommand);
|
bag->Set("class", LogEntryClassCommand);
|
||||||
/* string processing not implemented in 1.x */
|
/* string processing not implemented in 1.x */
|
||||||
|
|
||||||
return bag;
|
return bag;
|
||||||
} else if (type.Contains("LOG VERSION")) {
|
} else if (type.Contains("LOG VERSION")) {
|
||||||
bag->Set("log_class", LogEntryClassProgram);
|
bag->Set("class", LogEntryClassProgram);
|
||||||
bag->Set("log_type", LogEntryTypeVersion);
|
bag->Set("type", LogEntryTypeVersion);
|
||||||
|
|
||||||
return bag;
|
return bag;
|
||||||
} else if (type.Contains("logging initial states")) {
|
} else if (type.Contains("logging initial states")) {
|
||||||
bag->Set("log_class", LogEntryClassProgram);
|
bag->Set("class", LogEntryClassProgram);
|
||||||
bag->Set("log_type", LogEntryTypeInitialStates);
|
bag->Set("type", LogEntryTypeInitialStates);
|
||||||
|
|
||||||
return bag;
|
return bag;
|
||||||
} else if (type.Contains("starting... (PID=")) {
|
} else if (type.Contains("starting... (PID=")) {
|
||||||
bag->Set("log_class", LogEntryClassProgram);
|
bag->Set("class", LogEntryClassProgram);
|
||||||
bag->Set("log_type", LogEntryTypeProgramStarting);
|
bag->Set("type", LogEntryTypeProgramStarting);
|
||||||
|
|
||||||
return bag;
|
return bag;
|
||||||
}
|
}
|
||||||
|
@ -334,7 +334,7 @@ Dictionary::Ptr LivestatusLogUtility::GetAttributes(const String& text)
|
||||||
type.Contains("Bailing out") ||
|
type.Contains("Bailing out") ||
|
||||||
type.Contains("active mode...") ||
|
type.Contains("active mode...") ||
|
||||||
type.Contains("standby mode...")) {
|
type.Contains("standby mode...")) {
|
||||||
bag->Set("log_class", LogEntryClassProgram);
|
bag->Set("class", LogEntryClassProgram);
|
||||||
|
|
||||||
return bag;
|
return bag;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
GET log
|
||||||
|
Filter: time >= 1348657741
|
||||||
|
Filter: class = 1
|
||||||
|
ResponseHeader: fixed16
|
||||||
|
|
|
@ -9,6 +9,8 @@ LIVESTATUSQUERIES="./queries"
|
||||||
|
|
||||||
LIVESTATUSTABLE=$1
|
LIVESTATUSTABLE=$1
|
||||||
|
|
||||||
|
echo -e "Querying Livestatus socket: $LIVESTATUSSOCKET"
|
||||||
|
|
||||||
if [ -n "$LIVESTATUSTABLE" ]; then
|
if [ -n "$LIVESTATUSTABLE" ]; then
|
||||||
cat "$LIVESTATUSTABLE"
|
cat "$LIVESTATUSTABLE"
|
||||||
(cat "$LIVESTATUSTABLE"; sleep 1) | $NC -U $LIVESTATUSSOCKET
|
(cat "$LIVESTATUSTABLE"; sleep 1) | $NC -U $LIVESTATUSSOCKET
|
||||||
|
|
Loading…
Reference in New Issue