summaryrefslogtreecommitdiffstats
path: root/test/livestatus
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--test/livestatus-fixture.cpp53
-rw-r--r--test/livestatus.cpp107
-rw-r--r--test/livestatus/README12
-rw-r--r--test/livestatus/queries/commands/command4
-rw-r--r--test/livestatus/queries/commands/modattr4
-rw-r--r--test/livestatus/queries/comments/comment3
-rw-r--r--test/livestatus/queries/comments/comment_short4
-rw-r--r--test/livestatus/queries/contacts/contacts3
-rw-r--r--test/livestatus/queries/contacts/group3
-rw-r--r--test/livestatus/queries/contacts/modattr4
-rw-r--r--test/livestatus/queries/custom/scrambled2
-rw-r--r--test/livestatus/queries/custom/thruk_alert_history19
-rw-r--r--test/livestatus/queries/custom/thruk_comments7
-rw-r--r--test/livestatus/queries/downtimes/downtime3
-rw-r--r--test/livestatus/queries/downtimes/downtime_short4
-rw-r--r--test/livestatus/queries/endpoints/endpoints3
-rw-r--r--test/livestatus/queries/hosts/bygroup4
-rw-r--r--test/livestatus/queries/hosts/check4
-rw-r--r--test/livestatus/queries/hosts/command4
-rw-r--r--test/livestatus/queries/hosts/comment4
-rw-r--r--test/livestatus/queries/hosts/contact4
-rw-r--r--test/livestatus/queries/hosts/customvar4
-rw-r--r--test/livestatus/queries/hosts/downtime4
-rw-r--r--test/livestatus/queries/hosts/extra4
-rw-r--r--test/livestatus/queries/hosts/group3
-rw-r--r--test/livestatus/queries/hosts/host4
-rw-r--r--test/livestatus/queries/hosts/host_nagvis6
-rw-r--r--test/livestatus/queries/hosts/legacy4
-rw-r--r--test/livestatus/queries/hosts/modattr4
-rw-r--r--test/livestatus/queries/hosts/notification4
-rw-r--r--test/livestatus/queries/hosts/services4
-rw-r--r--test/livestatus/queries/hosts/state4
-rw-r--r--test/livestatus/queries/hosts/stats_sum5
-rw-r--r--test/livestatus/queries/log/alerts6
-rw-r--r--test/livestatus/queries/log/avail12
-rw-r--r--test/livestatus/queries/log/avail_svc13
-rw-r--r--test/livestatus/queries/log/class5
-rw-r--r--test/livestatus/queries/log/localhost_disk7
-rw-r--r--test/livestatus/queries/log/log4
-rw-r--r--test/livestatus/queries/log/minimal5
-rw-r--r--test/livestatus/queries/log/trend26
-rw-r--r--test/livestatus/queries/services/bygroup4
-rw-r--r--test/livestatus/queries/services/byhostgroup4
-rw-r--r--test/livestatus/queries/services/check4
-rw-r--r--test/livestatus/queries/services/command4
-rw-r--r--test/livestatus/queries/services/comment4
-rw-r--r--test/livestatus/queries/services/contact4
-rw-r--r--test/livestatus/queries/services/customvar4
-rw-r--r--test/livestatus/queries/services/downtime4
-rw-r--r--test/livestatus/queries/services/extra4
-rw-r--r--test/livestatus/queries/services/group3
-rw-r--r--test/livestatus/queries/services/legacy4
-rw-r--r--test/livestatus/queries/services/modattr4
-rw-r--r--test/livestatus/queries/services/notification4
-rw-r--r--test/livestatus/queries/services/services3
-rw-r--r--test/livestatus/queries/services/state4
-rw-r--r--test/livestatus/queries/special/services5
-rw-r--r--test/livestatus/queries/statehist/duration5
-rw-r--r--test/livestatus/queries/statehist/statehist5
-rw-r--r--test/livestatus/queries/statehist/statehist_disk6
-rw-r--r--test/livestatus/queries/statehist/sum9
-rw-r--r--test/livestatus/queries/status/checks4
-rw-r--r--test/livestatus/queries/status/custom4
-rw-r--r--test/livestatus/queries/status/livestatus4
-rw-r--r--test/livestatus/queries/status/program4
-rw-r--r--test/livestatus/queries/status/status3
-rw-r--r--test/livestatus/queries/timeperiods/timeperiod3
-rwxr-xr-xtest/livestatus/run_queries26
68 files changed, 519 insertions, 0 deletions
diff --git a/test/livestatus-fixture.cpp b/test/livestatus-fixture.cpp
new file mode 100644
index 0000000..aaa0e07
--- /dev/null
+++ b/test/livestatus-fixture.cpp
@@ -0,0 +1,53 @@
+/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
+
+#include "config/configcompiler.hpp"
+#include "config/configitem.hpp"
+#include "base/application.hpp"
+#include "base/loader.hpp"
+#include "icingaapplication-fixture.hpp"
+#include <BoostTestTargetConfig.h>
+
+using namespace icinga;
+
+struct LivestatusFixture
+{
+ LivestatusFixture()
+ {
+ // ensure IcingaApplication is initialized before we try to add config
+ IcingaApplicationFixture icinga;
+
+ BOOST_TEST_MESSAGE("Preparing config objects...");
+
+ ConfigItem::RunWithActivationContext(new Function("CreateTestObjects", CreateTestObjects));
+ }
+
+ static void CreateTestObjects()
+ {
+ String config = R"CONFIG(
+object CheckCommand "dummy" {
+ command = "/bin/echo"
+}
+
+object Host "test-01" {
+ address = "127.0.0.1"
+ check_command = "dummy"
+}
+
+object Host "test-02" {
+ address = "127.0.0.2"
+ check_command = "dummy"
+}
+
+apply Service "livestatus" {
+ check_command = "dummy"
+ notes = "test livestatus"
+ assign where match("test-*", host.name)
+}
+)CONFIG";
+
+ std::unique_ptr<Expression> expr = ConfigCompiler::CompileText("<livestatus>", config);
+ expr->Evaluate(*ScriptFrame::GetCurrentFrame());
+ }
+};
+
+BOOST_GLOBAL_FIXTURE(LivestatusFixture);
diff --git a/test/livestatus.cpp b/test/livestatus.cpp
new file mode 100644
index 0000000..6aafa3b
--- /dev/null
+++ b/test/livestatus.cpp
@@ -0,0 +1,107 @@
+/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
+
+#include "livestatus/livestatusquery.hpp"
+#include "base/application.hpp"
+#include "base/stdiostream.hpp"
+#include "base/json.hpp"
+#include <BoostTestTargetConfig.h>
+
+using namespace icinga;
+
+String LivestatusQueryHelper(const std::vector<String>& lines)
+{
+ LivestatusQuery::Ptr query = new LivestatusQuery(lines, "");
+
+ std::stringstream stream;
+ StdioStream::Ptr sstream = new StdioStream(&stream, false);
+
+ query->Execute(sstream);
+
+ String output;
+ String result;
+
+ StreamReadContext src;
+ for (;;) {
+ StreamReadStatus srs = sstream->ReadLine(&result, src);
+
+ if (srs == StatusEof)
+ break;
+
+ if (srs != StatusNewItem)
+ continue;
+
+ if (result.GetLength() > 0)
+ output += result + "\n";
+ else
+ break;
+ }
+
+ BOOST_TEST_MESSAGE("Query Result: " + output);
+
+ return output;
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_SUITE(livestatus)
+
+BOOST_AUTO_TEST_CASE(hosts)
+{
+ BOOST_TEST_MESSAGE( "Querying Livestatus...");
+
+ std::vector<String> lines;
+ lines.emplace_back("GET hosts");
+ lines.emplace_back("Columns: host_name address check_command");
+ lines.emplace_back("OutputFormat: json");
+ lines.emplace_back("\n");
+
+ /* use our query helper */
+ String output = LivestatusQueryHelper(lines);
+
+ Array::Ptr query_result = JsonDecode(output);
+
+ /* the outer elements */
+ BOOST_CHECK(query_result->GetLength() > 1);
+
+ Array::Ptr res1 = query_result->Get(0);
+ Array::Ptr res2 = query_result->Get(1);
+
+ /* results are non-deterministic and not sorted by livestatus */
+ BOOST_CHECK(res1->Contains("test-01") || res2->Contains("test-01"));
+ BOOST_CHECK(res1->Contains("test-02") || res2->Contains("test-02"));
+ BOOST_CHECK(res1->Contains("127.0.0.1") || res2->Contains("127.0.0.1"));
+ BOOST_CHECK(res1->Contains("127.0.0.2") || res2->Contains("127.0.0.2"));
+
+ BOOST_TEST_MESSAGE("Done with testing livestatus hosts...");
+}
+
+BOOST_AUTO_TEST_CASE(services)
+{
+ BOOST_TEST_MESSAGE( "Querying Livestatus...");
+
+ std::vector<String> lines;
+ lines.emplace_back("GET services");
+ lines.emplace_back("Columns: host_name service_description check_command notes");
+ lines.emplace_back("OutputFormat: json");
+ lines.emplace_back("\n");
+
+ /* use our query helper */
+ String output = LivestatusQueryHelper(lines);
+
+ Array::Ptr query_result = JsonDecode(output);
+
+ /* the outer elements */
+ BOOST_CHECK(query_result->GetLength() > 1);
+
+ Array::Ptr res1 = query_result->Get(0);
+ Array::Ptr res2 = query_result->Get(1);
+
+ /* results are non-deterministic and not sorted by livestatus */
+ BOOST_CHECK(res1->Contains("livestatus") || res2->Contains("livestatus")); //service_description
+ BOOST_CHECK(res1->Contains("test livestatus") || res2->Contains("test livestatus")); //notes
+
+ BOOST_TEST_MESSAGE("Done with testing livestatus services...");
+}
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_SUITE_END()
diff --git a/test/livestatus/README b/test/livestatus/README
new file mode 100644
index 0000000..0c839e0
--- /dev/null
+++ b/test/livestatus/README
@@ -0,0 +1,12 @@
+Compat Livestatus Component Query Tests
+=======================================
+
+Collection of queries used for execution
+on the livestatus socket.
+
+
+$ ./run_queries host/services
+
+or
+
+$ ./run_queries
diff --git a/test/livestatus/queries/commands/command b/test/livestatus/queries/commands/command
new file mode 100644
index 0000000..2e87152
--- /dev/null
+++ b/test/livestatus/queries/commands/command
@@ -0,0 +1,4 @@
+GET commands
+Columns: name line custom_variables
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/commands/modattr b/test/livestatus/queries/commands/modattr
new file mode 100644
index 0000000..90aaea7
--- /dev/null
+++ b/test/livestatus/queries/commands/modattr
@@ -0,0 +1,4 @@
+GET commands
+Columns: name modified_attributes modified_attributes_list
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/comments/comment b/test/livestatus/queries/comments/comment
new file mode 100644
index 0000000..18d7db9
--- /dev/null
+++ b/test/livestatus/queries/comments/comment
@@ -0,0 +1,3 @@
+GET comments
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/comments/comment_short b/test/livestatus/queries/comments/comment_short
new file mode 100644
index 0000000..e5c0072
--- /dev/null
+++ b/test/livestatus/queries/comments/comment_short
@@ -0,0 +1,4 @@
+GET comments
+Columns: id type is_service host_name service_description author comment
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/contacts/contacts b/test/livestatus/queries/contacts/contacts
new file mode 100644
index 0000000..a81c463
--- /dev/null
+++ b/test/livestatus/queries/contacts/contacts
@@ -0,0 +1,3 @@
+GET contacts
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/contacts/group b/test/livestatus/queries/contacts/group
new file mode 100644
index 0000000..a15b3a5
--- /dev/null
+++ b/test/livestatus/queries/contacts/group
@@ -0,0 +1,3 @@
+GET contactgroups
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/contacts/modattr b/test/livestatus/queries/contacts/modattr
new file mode 100644
index 0000000..8b520a0
--- /dev/null
+++ b/test/livestatus/queries/contacts/modattr
@@ -0,0 +1,4 @@
+GET contacts
+Columns: name modified_attributes modified_attributes_list
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/custom/scrambled b/test/livestatus/queries/custom/scrambled
new file mode 100644
index 0000000..01fe008
--- /dev/null
+++ b/test/livestatus/queries/custom/scrambled
@@ -0,0 +1,2 @@
+D
+
diff --git a/test/livestatus/queries/custom/thruk_alert_history b/test/livestatus/queries/custom/thruk_alert_history
new file mode 100644
index 0000000..de04c46
--- /dev/null
+++ b/test/livestatus/queries/custom/thruk_alert_history
@@ -0,0 +1,19 @@
+GET log
+Columns: class time type state host_name service_description plugin_output message options state_type contact_name
+Filter: time >= 1383692400
+Filter: time <= 1383778800
+Filter: type = SERVICE ALERT
+And: 1
+Filter: type = HOST ALERT
+And: 1
+Filter: type = SERVICE FLAPPING ALERT
+Filter: type = HOST FLAPPING ALERT
+Filter: type = SERVICE DOWNTIME ALERT
+Filter: type = HOST DOWNTIME ALERT
+Filter: message ~ starting\.\.\.
+Filter: message ~ shutting\ down\.\.\.
+Or: 8
+And: 3
+OutputFormat: json
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/custom/thruk_comments b/test/livestatus/queries/custom/thruk_comments
new file mode 100644
index 0000000..fc454ab
--- /dev/null
+++ b/test/livestatus/queries/custom/thruk_comments
@@ -0,0 +1,7 @@
+GET comments
+Columns: author comment entry_time entry_type expires expire_time host_name id persistent service_description source type
+Filter: host_name = localhost
+Filter: service_description = processes
+OutputFormat: json
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/downtimes/downtime b/test/livestatus/queries/downtimes/downtime
new file mode 100644
index 0000000..263dd51
--- /dev/null
+++ b/test/livestatus/queries/downtimes/downtime
@@ -0,0 +1,3 @@
+GET downtimes
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/downtimes/downtime_short b/test/livestatus/queries/downtimes/downtime_short
new file mode 100644
index 0000000..c2e1cf5
--- /dev/null
+++ b/test/livestatus/queries/downtimes/downtime_short
@@ -0,0 +1,4 @@
+GET downtimes
+Columns: id type is_service host_name service_description author comment start_time end_time
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/endpoints/endpoints b/test/livestatus/queries/endpoints/endpoints
new file mode 100644
index 0000000..3ff4a02
--- /dev/null
+++ b/test/livestatus/queries/endpoints/endpoints
@@ -0,0 +1,3 @@
+GET endpoints
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/hosts/bygroup b/test/livestatus/queries/hosts/bygroup
new file mode 100644
index 0000000..7485efc
--- /dev/null
+++ b/test/livestatus/queries/hosts/bygroup
@@ -0,0 +1,4 @@
+GET hostsbygroup
+Columns: hostgroup_name host_name
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/hosts/check b/test/livestatus/queries/hosts/check
new file mode 100644
index 0000000..bf4c216
--- /dev/null
+++ b/test/livestatus/queries/hosts/check
@@ -0,0 +1,4 @@
+GET hosts
+Columns: name plugin_output check_source
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/hosts/command b/test/livestatus/queries/hosts/command
new file mode 100644
index 0000000..61dfe83
--- /dev/null
+++ b/test/livestatus/queries/hosts/command
@@ -0,0 +1,4 @@
+GET hosts
+Columns: check_command check_command_expanded
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/hosts/comment b/test/livestatus/queries/hosts/comment
new file mode 100644
index 0000000..1ac1e84
--- /dev/null
+++ b/test/livestatus/queries/hosts/comment
@@ -0,0 +1,4 @@
+GET hosts
+Columns: comments comments_with_info comments_with_extra_info
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/hosts/contact b/test/livestatus/queries/hosts/contact
new file mode 100644
index 0000000..9322944
--- /dev/null
+++ b/test/livestatus/queries/hosts/contact
@@ -0,0 +1,4 @@
+GET hosts
+Columns: contacts contact_groups
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/hosts/customvar b/test/livestatus/queries/hosts/customvar
new file mode 100644
index 0000000..57f2e00
--- /dev/null
+++ b/test/livestatus/queries/hosts/customvar
@@ -0,0 +1,4 @@
+GET hosts
+Columns: name custom_variable_names custom_variable_values custom_variables cv_is_json
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/hosts/downtime b/test/livestatus/queries/hosts/downtime
new file mode 100644
index 0000000..db20ae7
--- /dev/null
+++ b/test/livestatus/queries/hosts/downtime
@@ -0,0 +1,4 @@
+GET hosts
+Columns: downtimes downtimes_with_info
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/hosts/extra b/test/livestatus/queries/hosts/extra
new file mode 100644
index 0000000..d6a583a
--- /dev/null
+++ b/test/livestatus/queries/hosts/extra
@@ -0,0 +1,4 @@
+GET hosts
+Columns: name address notes notes_expanded notes_url notes_url_expanded action_url action_url_expanded icon_image icon_image_expanded icon_image_alt x_2d y_2d
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/hosts/group b/test/livestatus/queries/hosts/group
new file mode 100644
index 0000000..cc60032
--- /dev/null
+++ b/test/livestatus/queries/hosts/group
@@ -0,0 +1,3 @@
+GET hostgroups
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/hosts/host b/test/livestatus/queries/hosts/host
new file mode 100644
index 0000000..4390fa9
--- /dev/null
+++ b/test/livestatus/queries/hosts/host
@@ -0,0 +1,4 @@
+GET hosts
+Columns: name parents childs
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/hosts/host_nagvis b/test/livestatus/queries/hosts/host_nagvis
new file mode 100644
index 0000000..a09d013
--- /dev/null
+++ b/test/livestatus/queries/hosts/host_nagvis
@@ -0,0 +1,6 @@
+GET hosts
+Columns: name alias host_name
+OutputFormat:json
+KeepAlive: on
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/hosts/legacy b/test/livestatus/queries/hosts/legacy
new file mode 100644
index 0000000..7a94932
--- /dev/null
+++ b/test/livestatus/queries/hosts/legacy
@@ -0,0 +1,4 @@
+GET hosts
+Columns: name notes notes_url action_url icon_image icon_image_alt
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/hosts/modattr b/test/livestatus/queries/hosts/modattr
new file mode 100644
index 0000000..b34e828
--- /dev/null
+++ b/test/livestatus/queries/hosts/modattr
@@ -0,0 +1,4 @@
+GET hosts
+Columns: name modified_attributes modified_attributes_list original_attributes
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/hosts/notification b/test/livestatus/queries/hosts/notification
new file mode 100644
index 0000000..27600ce
--- /dev/null
+++ b/test/livestatus/queries/hosts/notification
@@ -0,0 +1,4 @@
+GET hosts
+Columns: name current_notification_number notification_period notification_interval notifications_enabled no_more_notifications last_notification next_notification
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/hosts/services b/test/livestatus/queries/hosts/services
new file mode 100644
index 0000000..a6e10ba
--- /dev/null
+++ b/test/livestatus/queries/hosts/services
@@ -0,0 +1,4 @@
+GET hosts
+Columns: name num_services worst_service_state num_services_ok num_services_warn num_services_crit num_services_unknown num_services_pending worst_service_hard_state num_services_hard_ok num_services_hard_warn num_services_hard_crit num_services_hard_unknown services services_with_state services_with_info
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/hosts/state b/test/livestatus/queries/hosts/state
new file mode 100644
index 0000000..ba59c9e
--- /dev/null
+++ b/test/livestatus/queries/hosts/state
@@ -0,0 +1,4 @@
+GET hosts
+Columns: name last_state_change last_hard_state_change last_time_up last_time_down last_time_unreachable staleness is_reachable
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/hosts/stats_sum b/test/livestatus/queries/hosts/stats_sum
new file mode 100644
index 0000000..8a44ff4
--- /dev/null
+++ b/test/livestatus/queries/hosts/stats_sum
@@ -0,0 +1,5 @@
+GET hosts
+ResponseHeader: fixed16
+Stats: latency = 3
+Stats: sum latency
+
diff --git a/test/livestatus/queries/log/alerts b/test/livestatus/queries/log/alerts
new file mode 100644
index 0000000..8c4740a
--- /dev/null
+++ b/test/livestatus/queries/log/alerts
@@ -0,0 +1,6 @@
+GET log
+Columns: host_name service_description time lineno class type options plugin_output state state_type comment contact_name command_name
+Filter: time >= 1348657741
+Filter: message ~ ALERT
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/log/avail b/test/livestatus/queries/log/avail
new file mode 100644
index 0000000..b37162c
--- /dev/null
+++ b/test/livestatus/queries/log/avail
@@ -0,0 +1,12 @@
+GET log
+Columns: time type message class
+Filter: type = HOST ALERT
+Filter: state_type = HARD
+Filter: type = INITIAL HOST STATE
+Filter: state_type = HARD
+Filter: type = CURRENT HOST STATE
+Filter: state_type = HARD
+Filter: type = HOST DOWNTIME ALERT
+Or: 7
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/log/avail_svc b/test/livestatus/queries/log/avail_svc
new file mode 100644
index 0000000..9e3712b
--- /dev/null
+++ b/test/livestatus/queries/log/avail_svc
@@ -0,0 +1,13 @@
+GET log
+Columns: time type message class
+Filter: type = HOST DOWNTIME ALERT
+Filter: type = SERVICE ALERT
+Filter: state_type = HARD
+Filter: type = INITIAL SERVICE STATE
+Filter: state_type = HARD
+Filter: type = CURRENT SERVICE STATE
+Filter: state_type = HARD
+Filter: type = SERVICE DOWNTIME ALERT
+Or: 8
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/log/class b/test/livestatus/queries/log/class
new file mode 100644
index 0000000..c534980
--- /dev/null
+++ b/test/livestatus/queries/log/class
@@ -0,0 +1,5 @@
+GET log
+Filter: time >= 1348657741
+Filter: class = 1
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/log/localhost_disk b/test/livestatus/queries/log/localhost_disk
new file mode 100644
index 0000000..834047f
--- /dev/null
+++ b/test/livestatus/queries/log/localhost_disk
@@ -0,0 +1,7 @@
+GET log
+Columns: host_name service_description time lineno class type options plugin_output state state_type comment contact_name command_name
+Filter: time >= 1348657741
+Filter: host_name = localhost
+Filter: service_description = disk
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/log/log b/test/livestatus/queries/log/log
new file mode 100644
index 0000000..f69f2f4
--- /dev/null
+++ b/test/livestatus/queries/log/log
@@ -0,0 +1,4 @@
+GET log
+Filter: time >= 1348657741
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/log/minimal b/test/livestatus/queries/log/minimal
new file mode 100644
index 0000000..d224387
--- /dev/null
+++ b/test/livestatus/queries/log/minimal
@@ -0,0 +1,5 @@
+GET log
+Columns: host_name service_description time lineno class type options plugin_output state state_type comment contact_name command_name
+Filter: time >= 1348657741
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/log/trend b/test/livestatus/queries/log/trend
new file mode 100644
index 0000000..bd44d89
--- /dev/null
+++ b/test/livestatus/queries/log/trend
@@ -0,0 +1,26 @@
+GET log
+Columns: time type message
+Filter: host_name = localhost
+Filter: type = HOST ALERT
+Filter: state_type = HARD
+Filter: type = INITIAL HOST STATE
+Filter: state_type = HARD
+Filter: type = CURRENT HOST STATE
+Filter: state_type = HARD
+Filter: type = HOST DOWNTIME ALERT
+Or: 7
+And: 2
+Filter: host_name = localhost
+Filter: type = SERVICE ALERT
+Filter: state_type = HARD
+Filter: type = INITIAL SERVICE STATE
+Filter: state_type = HARD
+Filter: type = CURRENT SERVICE STATE
+Filter: state_type = HARD
+Filter: type = SERVICE DOWNTIME ALERT
+Or: 7
+And: 2
+Filter: class = 2
+Or: 3
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/services/bygroup b/test/livestatus/queries/services/bygroup
new file mode 100644
index 0000000..668e5f1
--- /dev/null
+++ b/test/livestatus/queries/services/bygroup
@@ -0,0 +1,4 @@
+GET servicesbygroup
+Columns: servicegroup_name host_name service_description
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/services/byhostgroup b/test/livestatus/queries/services/byhostgroup
new file mode 100644
index 0000000..ddcdbe8
--- /dev/null
+++ b/test/livestatus/queries/services/byhostgroup
@@ -0,0 +1,4 @@
+GET servicesbyhostgroup
+Columns: hostgroup_name host_name service_description
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/services/check b/test/livestatus/queries/services/check
new file mode 100644
index 0000000..1a8e857
--- /dev/null
+++ b/test/livestatus/queries/services/check
@@ -0,0 +1,4 @@
+GET services
+Columns: description host_name plugin_output check_source
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/services/command b/test/livestatus/queries/services/command
new file mode 100644
index 0000000..7bbf268
--- /dev/null
+++ b/test/livestatus/queries/services/command
@@ -0,0 +1,4 @@
+GET services
+Columns: check_command check_command_expanded
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/services/comment b/test/livestatus/queries/services/comment
new file mode 100644
index 0000000..d69ba67
--- /dev/null
+++ b/test/livestatus/queries/services/comment
@@ -0,0 +1,4 @@
+GET services
+Columns: comments comments_with_info comments_with_extra_info
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/services/contact b/test/livestatus/queries/services/contact
new file mode 100644
index 0000000..1729003
--- /dev/null
+++ b/test/livestatus/queries/services/contact
@@ -0,0 +1,4 @@
+GET services
+Columns: contacts contact_groups
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/services/customvar b/test/livestatus/queries/services/customvar
new file mode 100644
index 0000000..75c452c
--- /dev/null
+++ b/test/livestatus/queries/services/customvar
@@ -0,0 +1,4 @@
+GET services
+Columns: host_name service_description custom_variables cv_is_json
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/services/downtime b/test/livestatus/queries/services/downtime
new file mode 100644
index 0000000..243c000
--- /dev/null
+++ b/test/livestatus/queries/services/downtime
@@ -0,0 +1,4 @@
+GET services
+Columns: downtimes downtimes_with_info
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/services/extra b/test/livestatus/queries/services/extra
new file mode 100644
index 0000000..b58976f
--- /dev/null
+++ b/test/livestatus/queries/services/extra
@@ -0,0 +1,4 @@
+GET services
+Columns: description host_name host_address notes notes_expanded notes_url notes_url_expanded action_url action_url_expanded icon_image icon_image_expanded icon_image_alt
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/services/group b/test/livestatus/queries/services/group
new file mode 100644
index 0000000..83f4404
--- /dev/null
+++ b/test/livestatus/queries/services/group
@@ -0,0 +1,3 @@
+GET servicegroups
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/services/legacy b/test/livestatus/queries/services/legacy
new file mode 100644
index 0000000..ebc0b4b
--- /dev/null
+++ b/test/livestatus/queries/services/legacy
@@ -0,0 +1,4 @@
+GET services
+Columns: host_name description notes notes_url action_url icon_image icon_image_alt
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/services/modattr b/test/livestatus/queries/services/modattr
new file mode 100644
index 0000000..d1facd0
--- /dev/null
+++ b/test/livestatus/queries/services/modattr
@@ -0,0 +1,4 @@
+GET services
+Columns: description modified_attributes modified_attributes_list original_attributes
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/services/notification b/test/livestatus/queries/services/notification
new file mode 100644
index 0000000..eadcc90
--- /dev/null
+++ b/test/livestatus/queries/services/notification
@@ -0,0 +1,4 @@
+GET services
+Columns: description current_notification_number notification_period notification_interval notifications_enabled no_more_notifications last_notification next_notification
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/services/services b/test/livestatus/queries/services/services
new file mode 100644
index 0000000..09640fd
--- /dev/null
+++ b/test/livestatus/queries/services/services
@@ -0,0 +1,3 @@
+GET services
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/services/state b/test/livestatus/queries/services/state
new file mode 100644
index 0000000..65bf5f7
--- /dev/null
+++ b/test/livestatus/queries/services/state
@@ -0,0 +1,4 @@
+GET services
+Columns: description host_name last_state_change last_hard_state_change last_time_ok last_time_warning last_time_critical last_time_unknown staleness is_reachable
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/special/services b/test/livestatus/queries/special/services
new file mode 100644
index 0000000..94ddc91
--- /dev/null
+++ b/test/livestatus/queries/special/services
@@ -0,0 +1,5 @@
+GET services
+Separators: 10 32 35 95
+Columns: description custom_variables
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/statehist/duration b/test/livestatus/queries/statehist/duration
new file mode 100644
index 0000000..0de5bfa
--- /dev/null
+++ b/test/livestatus/queries/statehist/duration
@@ -0,0 +1,5 @@
+GET statehist
+Columns: host_name service_description state duration_ok duration_warning duration_critical duration_unknown duration_unmonitored
+Filter: time >= 1348657741
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/statehist/statehist b/test/livestatus/queries/statehist/statehist
new file mode 100644
index 0000000..1ef2382
--- /dev/null
+++ b/test/livestatus/queries/statehist/statehist
@@ -0,0 +1,5 @@
+GET statehist
+Columns: host_name service_description state duration duration_part in_downtime in_host_downtime in_notification_period is_flapping
+Filter: time >= 1348657741
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/statehist/statehist_disk b/test/livestatus/queries/statehist/statehist_disk
new file mode 100644
index 0000000..33f7340
--- /dev/null
+++ b/test/livestatus/queries/statehist/statehist_disk
@@ -0,0 +1,6 @@
+GET statehist
+Columns: host_name service_description state duration duration_part in_downtime in_host_downtime in_notification_period is_flapping
+Filter: service_description = disk
+Filter: time >= 1348657741
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/statehist/sum b/test/livestatus/queries/statehist/sum
new file mode 100644
index 0000000..b244adc
--- /dev/null
+++ b/test/livestatus/queries/statehist/sum
@@ -0,0 +1,9 @@
+GET statehist
+Columns: host_name service_description state duration duration_part
+Filter: host_name = localhost
+Filter: service_description = disk
+Filter: time >= 1348657741
+Stats: sum duration
+Stats: sum duration_part
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/status/checks b/test/livestatus/queries/status/checks
new file mode 100644
index 0000000..32e5957
--- /dev/null
+++ b/test/livestatus/queries/status/checks
@@ -0,0 +1,4 @@
+GET status
+Columns: accept_passive_host_checks accept_passive_service_checks execute_host_checks execute_service_checks
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/status/custom b/test/livestatus/queries/status/custom
new file mode 100644
index 0000000..1c8821d
--- /dev/null
+++ b/test/livestatus/queries/status/custom
@@ -0,0 +1,4 @@
+GET status
+Columns: custom_variables
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/status/livestatus b/test/livestatus/queries/status/livestatus
new file mode 100644
index 0000000..47f163c
--- /dev/null
+++ b/test/livestatus/queries/status/livestatus
@@ -0,0 +1,4 @@
+GET status
+Columns: connections connections_rate external_commands external_commands_rate livestatus_active_connections
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/status/program b/test/livestatus/queries/status/program
new file mode 100644
index 0000000..64d3c17
--- /dev/null
+++ b/test/livestatus/queries/status/program
@@ -0,0 +1,4 @@
+GET status
+Columns: nagios_pid program_start num_hosts num_services program_version
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/status/status b/test/livestatus/queries/status/status
new file mode 100644
index 0000000..bf92485
--- /dev/null
+++ b/test/livestatus/queries/status/status
@@ -0,0 +1,3 @@
+GET status
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/timeperiods/timeperiod b/test/livestatus/queries/timeperiods/timeperiod
new file mode 100644
index 0000000..e5f02ca
--- /dev/null
+++ b/test/livestatus/queries/timeperiods/timeperiod
@@ -0,0 +1,3 @@
+GET timeperiods
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/run_queries b/test/livestatus/run_queries
new file mode 100755
index 0000000..c80aa59
--- /dev/null
+++ b/test/livestatus/run_queries
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+NC=`which nc`
+LOCALSTATEDIR=`icinga2 variable get LocalStateDir`
+LIVESTATUSSOCKET="$LOCALSTATEDIR/run/icinga2/cmd/livestatus"
+LIVESTATUSHOST="127.0.0.1"
+LIVESTATUSPORT="6558"
+LIVESTATUSQUERIES="./queries"
+
+LIVESTATUSTABLE=$1
+
+echo -e "Querying Livestatus socket: $LIVESTATUSSOCKET"
+
+if [ -n "$LIVESTATUSTABLE" ]; then
+ cat "$LIVESTATUSTABLE"
+ (cat "$LIVESTATUSTABLE"; sleep 1) | $NC -U $LIVESTATUSSOCKET
+else
+
+ echo -e "Looking into $LIVESTATUSQUERIES\n"
+ for q in $(find $LIVESTATUSQUERIES -type f)
+ do
+ cat $q
+ (cat $q; sleep 1) | $NC -U $LIVESTATUSSOCKET
+ echo -e "================================\n\n"
+ done
+fi