From 603ceb992794e78f34b7a3948420a10b8cf89866 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Tue, 30 Jul 2013 13:07:13 +0200 Subject: [PATCH] livestatus: import test queries and script refs #2762 --- test/compat/livestatus/README | 12 +++++++++++ .../compat/livestatus/queries/comment/comment | 3 +++ .../livestatus/queries/contact/contacts | 3 +++ test/compat/livestatus/queries/contact/group | 3 +++ .../livestatus/queries/downtime/downtime | 3 +++ test/compat/livestatus/queries/host/command | 4 ++++ test/compat/livestatus/queries/host/comment | 4 ++++ test/compat/livestatus/queries/host/contact | 4 ++++ test/compat/livestatus/queries/host/customvar | 4 ++++ test/compat/livestatus/queries/host/downtime | 4 ++++ test/compat/livestatus/queries/host/extra | 4 ++++ test/compat/livestatus/queries/host/group | 3 +++ test/compat/livestatus/queries/host/host | 4 ++++ .../livestatus/queries/host/notification | 4 ++++ test/compat/livestatus/queries/host/services | 4 ++++ test/compat/livestatus/queries/host/state | 4 ++++ test/compat/livestatus/queries/host/stats_sum | 5 +++++ .../compat/livestatus/queries/service/command | 4 ++++ .../compat/livestatus/queries/service/comment | 4 ++++ .../compat/livestatus/queries/service/contact | 4 ++++ .../livestatus/queries/service/customvar | 4 ++++ .../livestatus/queries/service/downtime | 4 ++++ test/compat/livestatus/queries/service/extra | 4 ++++ test/compat/livestatus/queries/service/group | 3 +++ .../livestatus/queries/service/notification | 4 ++++ .../livestatus/queries/service/services | 3 +++ test/compat/livestatus/queries/service/state | 4 ++++ .../livestatus/queries/special/services | 5 +++++ .../livestatus/queries/status/livestatus | 4 ++++ test/compat/livestatus/queries/status/program | 4 ++++ test/compat/livestatus/queries/status/status | 3 +++ .../livestatus/queries/timeperiod/timeperiod | 3 +++ test/compat/livestatus/run_queries | 21 +++++++++++++++++++ 33 files changed, 150 insertions(+) create mode 100644 test/compat/livestatus/README create mode 100644 test/compat/livestatus/queries/comment/comment create mode 100644 test/compat/livestatus/queries/contact/contacts create mode 100644 test/compat/livestatus/queries/contact/group create mode 100644 test/compat/livestatus/queries/downtime/downtime create mode 100644 test/compat/livestatus/queries/host/command create mode 100644 test/compat/livestatus/queries/host/comment create mode 100644 test/compat/livestatus/queries/host/contact create mode 100644 test/compat/livestatus/queries/host/customvar create mode 100644 test/compat/livestatus/queries/host/downtime create mode 100644 test/compat/livestatus/queries/host/extra create mode 100644 test/compat/livestatus/queries/host/group create mode 100644 test/compat/livestatus/queries/host/host create mode 100644 test/compat/livestatus/queries/host/notification create mode 100644 test/compat/livestatus/queries/host/services create mode 100644 test/compat/livestatus/queries/host/state create mode 100644 test/compat/livestatus/queries/host/stats_sum create mode 100644 test/compat/livestatus/queries/service/command create mode 100644 test/compat/livestatus/queries/service/comment create mode 100644 test/compat/livestatus/queries/service/contact create mode 100644 test/compat/livestatus/queries/service/customvar create mode 100644 test/compat/livestatus/queries/service/downtime create mode 100644 test/compat/livestatus/queries/service/extra create mode 100644 test/compat/livestatus/queries/service/group create mode 100644 test/compat/livestatus/queries/service/notification create mode 100644 test/compat/livestatus/queries/service/services create mode 100644 test/compat/livestatus/queries/service/state create mode 100644 test/compat/livestatus/queries/special/services create mode 100644 test/compat/livestatus/queries/status/livestatus create mode 100644 test/compat/livestatus/queries/status/program create mode 100644 test/compat/livestatus/queries/status/status create mode 100644 test/compat/livestatus/queries/timeperiod/timeperiod create mode 100755 test/compat/livestatus/run_queries diff --git a/test/compat/livestatus/README b/test/compat/livestatus/README new file mode 100644 index 000000000..0c839e0ed --- /dev/null +++ b/test/compat/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/compat/livestatus/queries/comment/comment b/test/compat/livestatus/queries/comment/comment new file mode 100644 index 000000000..18d7db948 --- /dev/null +++ b/test/compat/livestatus/queries/comment/comment @@ -0,0 +1,3 @@ +GET comments +ResponseHeader: fixed16 + diff --git a/test/compat/livestatus/queries/contact/contacts b/test/compat/livestatus/queries/contact/contacts new file mode 100644 index 000000000..a81c46335 --- /dev/null +++ b/test/compat/livestatus/queries/contact/contacts @@ -0,0 +1,3 @@ +GET contacts +ResponseHeader: fixed16 + diff --git a/test/compat/livestatus/queries/contact/group b/test/compat/livestatus/queries/contact/group new file mode 100644 index 000000000..a15b3a51e --- /dev/null +++ b/test/compat/livestatus/queries/contact/group @@ -0,0 +1,3 @@ +GET contactgroups +ResponseHeader: fixed16 + diff --git a/test/compat/livestatus/queries/downtime/downtime b/test/compat/livestatus/queries/downtime/downtime new file mode 100644 index 000000000..263dd5137 --- /dev/null +++ b/test/compat/livestatus/queries/downtime/downtime @@ -0,0 +1,3 @@ +GET downtimes +ResponseHeader: fixed16 + diff --git a/test/compat/livestatus/queries/host/command b/test/compat/livestatus/queries/host/command new file mode 100644 index 000000000..61dfe8363 --- /dev/null +++ b/test/compat/livestatus/queries/host/command @@ -0,0 +1,4 @@ +GET hosts +Columns: check_command check_command_expanded +ResponseHeader: fixed16 + diff --git a/test/compat/livestatus/queries/host/comment b/test/compat/livestatus/queries/host/comment new file mode 100644 index 000000000..1ac1e8424 --- /dev/null +++ b/test/compat/livestatus/queries/host/comment @@ -0,0 +1,4 @@ +GET hosts +Columns: comments comments_with_info comments_with_extra_info +ResponseHeader: fixed16 + diff --git a/test/compat/livestatus/queries/host/contact b/test/compat/livestatus/queries/host/contact new file mode 100644 index 000000000..932294427 --- /dev/null +++ b/test/compat/livestatus/queries/host/contact @@ -0,0 +1,4 @@ +GET hosts +Columns: contacts contact_groups +ResponseHeader: fixed16 + diff --git a/test/compat/livestatus/queries/host/customvar b/test/compat/livestatus/queries/host/customvar new file mode 100644 index 000000000..b98ff3c54 --- /dev/null +++ b/test/compat/livestatus/queries/host/customvar @@ -0,0 +1,4 @@ +GET hosts +Columns: custom_variable_names custom_variable_values custom_variables +ResponseHeader: fixed16 + diff --git a/test/compat/livestatus/queries/host/downtime b/test/compat/livestatus/queries/host/downtime new file mode 100644 index 000000000..db20ae713 --- /dev/null +++ b/test/compat/livestatus/queries/host/downtime @@ -0,0 +1,4 @@ +GET hosts +Columns: downtimes downtimes_with_info +ResponseHeader: fixed16 + diff --git a/test/compat/livestatus/queries/host/extra b/test/compat/livestatus/queries/host/extra new file mode 100644 index 000000000..d6a583a48 --- /dev/null +++ b/test/compat/livestatus/queries/host/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/compat/livestatus/queries/host/group b/test/compat/livestatus/queries/host/group new file mode 100644 index 000000000..cc60032c1 --- /dev/null +++ b/test/compat/livestatus/queries/host/group @@ -0,0 +1,3 @@ +GET hostgroups +ResponseHeader: fixed16 + diff --git a/test/compat/livestatus/queries/host/host b/test/compat/livestatus/queries/host/host new file mode 100644 index 000000000..4390fa91d --- /dev/null +++ b/test/compat/livestatus/queries/host/host @@ -0,0 +1,4 @@ +GET hosts +Columns: name parents childs +ResponseHeader: fixed16 + diff --git a/test/compat/livestatus/queries/host/notification b/test/compat/livestatus/queries/host/notification new file mode 100644 index 000000000..27600cef4 --- /dev/null +++ b/test/compat/livestatus/queries/host/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/compat/livestatus/queries/host/services b/test/compat/livestatus/queries/host/services new file mode 100644 index 000000000..a6e10ba04 --- /dev/null +++ b/test/compat/livestatus/queries/host/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/compat/livestatus/queries/host/state b/test/compat/livestatus/queries/host/state new file mode 100644 index 000000000..0eff60449 --- /dev/null +++ b/test/compat/livestatus/queries/host/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 +ResponseHeader: fixed16 + diff --git a/test/compat/livestatus/queries/host/stats_sum b/test/compat/livestatus/queries/host/stats_sum new file mode 100644 index 000000000..8a44ff499 --- /dev/null +++ b/test/compat/livestatus/queries/host/stats_sum @@ -0,0 +1,5 @@ +GET hosts +ResponseHeader: fixed16 +Stats: latency = 3 +Stats: sum latency + diff --git a/test/compat/livestatus/queries/service/command b/test/compat/livestatus/queries/service/command new file mode 100644 index 000000000..7bbf268a4 --- /dev/null +++ b/test/compat/livestatus/queries/service/command @@ -0,0 +1,4 @@ +GET services +Columns: check_command check_command_expanded +ResponseHeader: fixed16 + diff --git a/test/compat/livestatus/queries/service/comment b/test/compat/livestatus/queries/service/comment new file mode 100644 index 000000000..d69ba6727 --- /dev/null +++ b/test/compat/livestatus/queries/service/comment @@ -0,0 +1,4 @@ +GET services +Columns: comments comments_with_info comments_with_extra_info +ResponseHeader: fixed16 + diff --git a/test/compat/livestatus/queries/service/contact b/test/compat/livestatus/queries/service/contact new file mode 100644 index 000000000..172900312 --- /dev/null +++ b/test/compat/livestatus/queries/service/contact @@ -0,0 +1,4 @@ +GET services +Columns: contacts contact_groups +ResponseHeader: fixed16 + diff --git a/test/compat/livestatus/queries/service/customvar b/test/compat/livestatus/queries/service/customvar new file mode 100644 index 000000000..8f52f27a7 --- /dev/null +++ b/test/compat/livestatus/queries/service/customvar @@ -0,0 +1,4 @@ +GET services +Columns: custom_variable_names custom_variable_values custom_variables +ResponseHeader: fixed16 + diff --git a/test/compat/livestatus/queries/service/downtime b/test/compat/livestatus/queries/service/downtime new file mode 100644 index 000000000..243c000b0 --- /dev/null +++ b/test/compat/livestatus/queries/service/downtime @@ -0,0 +1,4 @@ +GET services +Columns: downtimes downtimes_with_info +ResponseHeader: fixed16 + diff --git a/test/compat/livestatus/queries/service/extra b/test/compat/livestatus/queries/service/extra new file mode 100644 index 000000000..b58976f98 --- /dev/null +++ b/test/compat/livestatus/queries/service/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/compat/livestatus/queries/service/group b/test/compat/livestatus/queries/service/group new file mode 100644 index 000000000..83f440438 --- /dev/null +++ b/test/compat/livestatus/queries/service/group @@ -0,0 +1,3 @@ +GET servicegroups +ResponseHeader: fixed16 + diff --git a/test/compat/livestatus/queries/service/notification b/test/compat/livestatus/queries/service/notification new file mode 100644 index 000000000..eadcc9080 --- /dev/null +++ b/test/compat/livestatus/queries/service/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/compat/livestatus/queries/service/services b/test/compat/livestatus/queries/service/services new file mode 100644 index 000000000..09640fd0b --- /dev/null +++ b/test/compat/livestatus/queries/service/services @@ -0,0 +1,3 @@ +GET services +ResponseHeader: fixed16 + diff --git a/test/compat/livestatus/queries/service/state b/test/compat/livestatus/queries/service/state new file mode 100644 index 000000000..ecc448590 --- /dev/null +++ b/test/compat/livestatus/queries/service/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 +ResponseHeader: fixed16 + diff --git a/test/compat/livestatus/queries/special/services b/test/compat/livestatus/queries/special/services new file mode 100644 index 000000000..94ddc9120 --- /dev/null +++ b/test/compat/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/compat/livestatus/queries/status/livestatus b/test/compat/livestatus/queries/status/livestatus new file mode 100644 index 000000000..47f163c97 --- /dev/null +++ b/test/compat/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/compat/livestatus/queries/status/program b/test/compat/livestatus/queries/status/program new file mode 100644 index 000000000..64d3c17b2 --- /dev/null +++ b/test/compat/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/compat/livestatus/queries/status/status b/test/compat/livestatus/queries/status/status new file mode 100644 index 000000000..bf9248530 --- /dev/null +++ b/test/compat/livestatus/queries/status/status @@ -0,0 +1,3 @@ +GET status +ResponseHeader: fixed16 + diff --git a/test/compat/livestatus/queries/timeperiod/timeperiod b/test/compat/livestatus/queries/timeperiod/timeperiod new file mode 100644 index 000000000..e5f02cac0 --- /dev/null +++ b/test/compat/livestatus/queries/timeperiod/timeperiod @@ -0,0 +1,3 @@ +GET timeperiods +ResponseHeader: fixed16 + diff --git a/test/compat/livestatus/run_queries b/test/compat/livestatus/run_queries new file mode 100755 index 000000000..0c5eea427 --- /dev/null +++ b/test/compat/livestatus/run_queries @@ -0,0 +1,21 @@ +#!/bin/bash + +LIVESTATUSHOST="10.0.10.18" +LIVESTATUSPORT="6558" +LIVESTATUSQUERIES="./queries" + +LIVESTATUSTABLE=$1 + +if [ -n "$LIVESTATUSTABLE" ]; then + cat "$LIVESTATUSQUERIES/$LIVESTATUSTABLE" + (cat "$LIVESTATUSQUERIES/$LIVESTATUSTABLE"; sleep 1) | netcat $LIVESTATUSHOST $LIVESTATUSPORT +else + + echo -e "Looking into $LIVESTATUSQUERIES\n" + for q in $(find $LIVESTATUSQUERIES -type f) + do + cat $q + (cat $q; sleep 1) | netcat $LIVESTATUSHOST $LIVESTATUSPORT + echo -e "================================\n\n" + done +fi