]> granicus.if.org Git - icinga2/commitdiff
livestatus: import test queries and script
authorMichael Friedrich <michael.friedrich@netways.de>
Tue, 30 Jul 2013 11:07:13 +0000 (13:07 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Tue, 30 Jul 2013 11:07:13 +0000 (13:07 +0200)
refs #2762

33 files changed:
test/compat/livestatus/README [new file with mode: 0644]
test/compat/livestatus/queries/comment/comment [new file with mode: 0644]
test/compat/livestatus/queries/contact/contacts [new file with mode: 0644]
test/compat/livestatus/queries/contact/group [new file with mode: 0644]
test/compat/livestatus/queries/downtime/downtime [new file with mode: 0644]
test/compat/livestatus/queries/host/command [new file with mode: 0644]
test/compat/livestatus/queries/host/comment [new file with mode: 0644]
test/compat/livestatus/queries/host/contact [new file with mode: 0644]
test/compat/livestatus/queries/host/customvar [new file with mode: 0644]
test/compat/livestatus/queries/host/downtime [new file with mode: 0644]
test/compat/livestatus/queries/host/extra [new file with mode: 0644]
test/compat/livestatus/queries/host/group [new file with mode: 0644]
test/compat/livestatus/queries/host/host [new file with mode: 0644]
test/compat/livestatus/queries/host/notification [new file with mode: 0644]
test/compat/livestatus/queries/host/services [new file with mode: 0644]
test/compat/livestatus/queries/host/state [new file with mode: 0644]
test/compat/livestatus/queries/host/stats_sum [new file with mode: 0644]
test/compat/livestatus/queries/service/command [new file with mode: 0644]
test/compat/livestatus/queries/service/comment [new file with mode: 0644]
test/compat/livestatus/queries/service/contact [new file with mode: 0644]
test/compat/livestatus/queries/service/customvar [new file with mode: 0644]
test/compat/livestatus/queries/service/downtime [new file with mode: 0644]
test/compat/livestatus/queries/service/extra [new file with mode: 0644]
test/compat/livestatus/queries/service/group [new file with mode: 0644]
test/compat/livestatus/queries/service/notification [new file with mode: 0644]
test/compat/livestatus/queries/service/services [new file with mode: 0644]
test/compat/livestatus/queries/service/state [new file with mode: 0644]
test/compat/livestatus/queries/special/services [new file with mode: 0644]
test/compat/livestatus/queries/status/livestatus [new file with mode: 0644]
test/compat/livestatus/queries/status/program [new file with mode: 0644]
test/compat/livestatus/queries/status/status [new file with mode: 0644]
test/compat/livestatus/queries/timeperiod/timeperiod [new file with mode: 0644]
test/compat/livestatus/run_queries [new file with mode: 0755]

diff --git a/test/compat/livestatus/README b/test/compat/livestatus/README
new file mode 100644 (file)
index 0000000..0c839e0
--- /dev/null
@@ -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 (file)
index 0000000..18d7db9
--- /dev/null
@@ -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 (file)
index 0000000..a81c463
--- /dev/null
@@ -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 (file)
index 0000000..a15b3a5
--- /dev/null
@@ -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 (file)
index 0000000..263dd51
--- /dev/null
@@ -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 (file)
index 0000000..61dfe83
--- /dev/null
@@ -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 (file)
index 0000000..1ac1e84
--- /dev/null
@@ -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 (file)
index 0000000..9322944
--- /dev/null
@@ -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 (file)
index 0000000..b98ff3c
--- /dev/null
@@ -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 (file)
index 0000000..db20ae7
--- /dev/null
@@ -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 (file)
index 0000000..d6a583a
--- /dev/null
@@ -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 (file)
index 0000000..cc60032
--- /dev/null
@@ -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 (file)
index 0000000..4390fa9
--- /dev/null
@@ -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 (file)
index 0000000..27600ce
--- /dev/null
@@ -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 (file)
index 0000000..a6e10ba
--- /dev/null
@@ -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 (file)
index 0000000..0eff604
--- /dev/null
@@ -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 (file)
index 0000000..8a44ff4
--- /dev/null
@@ -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 (file)
index 0000000..7bbf268
--- /dev/null
@@ -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 (file)
index 0000000..d69ba67
--- /dev/null
@@ -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 (file)
index 0000000..1729003
--- /dev/null
@@ -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 (file)
index 0000000..8f52f27
--- /dev/null
@@ -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 (file)
index 0000000..243c000
--- /dev/null
@@ -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 (file)
index 0000000..b58976f
--- /dev/null
@@ -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 (file)
index 0000000..83f4404
--- /dev/null
@@ -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 (file)
index 0000000..eadcc90
--- /dev/null
@@ -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 (file)
index 0000000..09640fd
--- /dev/null
@@ -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 (file)
index 0000000..ecc4485
--- /dev/null
@@ -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 (file)
index 0000000..94ddc91
--- /dev/null
@@ -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 (file)
index 0000000..47f163c
--- /dev/null
@@ -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 (file)
index 0000000..64d3c17
--- /dev/null
@@ -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 (file)
index 0000000..bf92485
--- /dev/null
@@ -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 (file)
index 0000000..e5f02ca
--- /dev/null
@@ -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 (executable)
index 0000000..0c5eea4
--- /dev/null
@@ -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