livestatus: import test queries and script

refs #2762
This commit is contained in:
Michael Friedrich 2013-07-30 13:07:13 +02:00
parent 168dbbd28d
commit 603ceb9927
33 changed files with 150 additions and 0 deletions

View File

@ -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

View File

@ -0,0 +1,3 @@
GET comments
ResponseHeader: fixed16

View File

@ -0,0 +1,3 @@
GET contacts
ResponseHeader: fixed16

View File

@ -0,0 +1,3 @@
GET contactgroups
ResponseHeader: fixed16

View File

@ -0,0 +1,3 @@
GET downtimes
ResponseHeader: fixed16

View File

@ -0,0 +1,4 @@
GET hosts
Columns: check_command check_command_expanded
ResponseHeader: fixed16

View File

@ -0,0 +1,4 @@
GET hosts
Columns: comments comments_with_info comments_with_extra_info
ResponseHeader: fixed16

View File

@ -0,0 +1,4 @@
GET hosts
Columns: contacts contact_groups
ResponseHeader: fixed16

View File

@ -0,0 +1,4 @@
GET hosts
Columns: custom_variable_names custom_variable_values custom_variables
ResponseHeader: fixed16

View File

@ -0,0 +1,4 @@
GET hosts
Columns: downtimes downtimes_with_info
ResponseHeader: fixed16

View File

@ -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

View File

@ -0,0 +1,3 @@
GET hostgroups
ResponseHeader: fixed16

View File

@ -0,0 +1,4 @@
GET hosts
Columns: name parents childs
ResponseHeader: fixed16

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,5 @@
GET hosts
ResponseHeader: fixed16
Stats: latency = 3
Stats: sum latency

View File

@ -0,0 +1,4 @@
GET services
Columns: check_command check_command_expanded
ResponseHeader: fixed16

View File

@ -0,0 +1,4 @@
GET services
Columns: comments comments_with_info comments_with_extra_info
ResponseHeader: fixed16

View File

@ -0,0 +1,4 @@
GET services
Columns: contacts contact_groups
ResponseHeader: fixed16

View File

@ -0,0 +1,4 @@
GET services
Columns: custom_variable_names custom_variable_values custom_variables
ResponseHeader: fixed16

View File

@ -0,0 +1,4 @@
GET services
Columns: downtimes downtimes_with_info
ResponseHeader: fixed16

View File

@ -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

View File

@ -0,0 +1,3 @@
GET servicegroups
ResponseHeader: fixed16

View File

@ -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

View File

@ -0,0 +1,3 @@
GET services
ResponseHeader: fixed16

View File

@ -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

View File

@ -0,0 +1,5 @@
GET services
Separators: 10 32 35 95
Columns: description custom_variables
ResponseHeader: fixed16

View File

@ -0,0 +1,4 @@
GET status
Columns: connections connections_rate external_commands external_commands_rate livestatus_active_connections
ResponseHeader: fixed16

View File

@ -0,0 +1,4 @@
GET status
Columns: nagios_pid program_start num_hosts num_services program_version
ResponseHeader: fixed16

View File

@ -0,0 +1,3 @@
GET status
ResponseHeader: fixed16

View File

@ -0,0 +1,3 @@
GET timeperiods
ResponseHeader: fixed16

View File

@ -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