Let all vm-tests output filesystem paths when they work with them

This commit is contained in:
Johannes Meyer 2014-02-19 15:33:10 +01:00
parent 9bdf2f4766
commit f867029180
7 changed files with 70 additions and 59 deletions

View File

@ -1,10 +1,12 @@
#!/bin/sh
if [ -e "/var/run/icinga2/cmd/icinga2.cmd" ];
commandpipe_path="/var/run/icinga2/cmd/icinga2.cmd"
if [ -e $commandpipe_path ];
then
echo "[OK] Icinga2 commandpipe found"
echo "[OK] Icinga2 commandpipe found ($commandpipe_path)"
exit 0
else
echo "[FAIL] Icinga2 commandpipe not found"
echo "[FAIL] Icinga2 commandpipe not found ($commandpipe_path)"
exit 1
fi

View File

@ -1159,51 +1159,51 @@ def test_servicegroup_commands():
def main():
failure = test_host_comments('localhost')
#failure &= test_host_comments('nsca-ng') # Cannot work without a hostcheck!
#failure |= test_host_comments('nsca-ng') # Cannot work without a hostcheck!
failure &= test_service_comments('localhost', 'disk')
failure &= test_service_comments('nsca-ng', 'PassiveService1')
failure |= test_service_comments('localhost', 'disk')
failure |= test_service_comments('nsca-ng', 'PassiveService1')
failure &= test_host_downtimes('localhost')
#failure &= test_host_downtimes('nsca-ng')
failure |= test_host_downtimes('localhost')
#failure |= test_host_downtimes('nsca-ng')
failure &= test_service_downtimes('localhost', 'disk')
failure &= test_service_downtimes('nsca-ng', 'PassiveService1')
failure |= test_service_downtimes('localhost', 'disk')
failure |= test_service_downtimes('nsca-ng', 'PassiveService1')
failure &= test_host_problem_acknowledgements('localhost')
failure &= test_remove_host_acknowledgements('localhost')
failure &= test_expiring_host_acknowledgements('localhost')
failure |= test_host_problem_acknowledgements('localhost')
failure |= test_remove_host_acknowledgements('localhost')
failure |= test_expiring_host_acknowledgements('localhost')
failure &= test_change_host_check_command('localhost', 'disk')
failure &= test_change_service_check_command('localhost', 'disk', 'ping4')
failure &= test_change_host_check_timeperiod('localhost', 'none')
failure &= test_change_service_check_timeperiod('localhost', 'disk', 'none')
failure &= test_change_host_max_check_attempts('localhost')
failure &= test_change_service_max_check_attempts('localhost', 'disk')
failure &= test_change_host_normal_check_interval('localhost')
failure &= test_change_service_normal_check_interval('localhost', 'disk')
failure &= test_change_host_retry_check_interval('localhost')
failure &= test_change_service_retry_check_interval('localhost', 'disk')
failure &= test_change_host_modified_attributes('localhost')
failure |= test_change_host_check_command('localhost', 'disk')
failure |= test_change_service_check_command('localhost', 'disk', 'ping4')
failure |= test_change_host_check_timeperiod('localhost', 'none')
failure |= test_change_service_check_timeperiod('localhost', 'disk', 'none')
failure |= test_change_host_max_check_attempts('localhost')
failure |= test_change_service_max_check_attempts('localhost', 'disk')
failure |= test_change_host_normal_check_interval('localhost')
failure |= test_change_service_normal_check_interval('localhost', 'disk')
failure |= test_change_host_retry_check_interval('localhost')
failure |= test_change_service_retry_check_interval('localhost', 'disk')
failure |= test_change_host_modified_attributes('localhost')
failure &= test_delay_service_notification('localhost', 'disk')
failure &= test_delay_host_notification('localhost')
failure |= test_delay_service_notification('localhost', 'disk')
failure |= test_delay_host_notification('localhost')
failure &= test_disabling_scheduling_host_checks('localhost')
failure &= test_disabling_scheduling_service_checks('localhost', 'disk')
failure |= test_disabling_scheduling_host_checks('localhost')
failure |= test_disabling_scheduling_service_checks('localhost', 'disk')
failure &= test_shutdown_restart_process()
failure |= test_shutdown_restart_process()
failure &= test_passive_host_checkresult_processing('localhost')
failure &= test_passive_svc_checkresult_processing('localhost', 'disk')
failure |= test_passive_host_checkresult_processing('localhost')
failure |= test_passive_svc_checkresult_processing('localhost', 'disk')
failure &= test_process_file('localhost')
failure |= test_process_file('localhost')
failure &= test_custom_host_notifications('localhost')
failure &= test_custom_svc_notifications('localhost', 'disk')
failure |= test_custom_host_notifications('localhost')
failure |= test_custom_svc_notifications('localhost', 'disk')
failure &= test_hostgroup_commands()
failure &= test_servicegroup_commands()
failure |= test_hostgroup_commands()
failure |= test_servicegroup_commands()
return 1 if failure else 0

View File

@ -18,7 +18,7 @@ template Notification "mail-notification" {
NotificationFilterDowntimeRemoved),
notification_period = "24x7",
notifications_interval = 10
notification_interval = 10
}
/**

View File

@ -1,17 +1,19 @@
#!/bin/sh
if [ ! -e /var/run/icinga2/cmd/livestatus ];
livestatus_path="/var/run/icinga2/cmd/livestatus"
if [ ! -e $livestatus_path ];
then
sudo icinga2-enable-feature livestatus 1> /dev/null
sudo service icinga2 restart 1> /dev/null
sleep 1
if [ ! -e /var/run/icinga2/cmd/livestatus ];
if [ ! -e $livestatus_path ];
then
echo "[FAIL] Icinga2 Livestatus socket not found"
echo "[FAIL] Icinga2 Livestatus socket not found ($livestatus_path)"
exit 1
fi
fi
echo "[OK] Icinga2 Livestatus socket found"
echo "[OK] Icinga2 Livestatus socket found ($livestatus_path)"
exit 0

View File

@ -1,10 +1,12 @@
#!/bin/sh
if sudo test -f /var/log/icinga2/icinga2.log;
logfile_path="/var/log/icinga2/icinga2.log"
if sudo test -f $logfile_path;
then
echo "[OK] Icinga2 log file found"
echo "[OK] Icinga2 log file found ($logfile_path)"
exit 0
else
echo "[FAIL] Icinga2 log file not found"
echo "[FAIL] Icinga2 log file not found ($logfile_path)"
exit 1
fi

View File

@ -1,10 +1,12 @@
#!/bin/sh
if [ -f /var/run/icinga2/icinga2.pid ];
pidfile_path="/var/run/icinga2/icinga2.pid"
if [ -f $pidfile_path ];
then
echo "[OK] Icinga2 pidfile found"
echo "[OK] Icinga2 pidfile found ($pidfile_path)"
exit 0
else
echo "[FAIL] Icinga2 pidfile not found"
echo "[FAIL] Icinga2 pidfile not found ($pidfile_path)"
exit 1
fi

View File

@ -1,6 +1,9 @@
#!/bin/sh
#!/bin/bash
if [ ! -f /var/cache/icinga2/status.dat ];
statusdata_path="/var/cache/icinga2/status.dat"
objectscache_path="/var/cache/icinga2/objects.cache"
if [ ! -f $statusdata_path ];
then
sudo icinga2-enable-feature statusdata 1> /dev/null
sudo service icinga2 restart 1> /dev/null
@ -10,7 +13,7 @@ then
do
sleep 15
if [ -f /var/cache/icinga2/status.dat ];
if [ -f $statusdata_path ];
then
break
fi
@ -20,32 +23,32 @@ then
if [ $n -eq 3 ];
then
echo "[FAIL] Icinga2 status.dat not found"
echo "[FAIL] Icinga2 status.dat not found ($statusdata_path)"
exit 1
fi
fi
echo "[OK] Icinga2 status.dat found"
echo "[OK] Icinga2 status.dat found ($statusdata_path)"
if [ -f /var/cache/icinga2/objects.cache ];
if [ -f $objectscache_path ];
then
echo "[OK] Icinga2 objects.cache found"
echo "[OK] Icinga2 objects.cache found ($objectscache_path)"
else
echo "[FAIL] Icinga2 objects.cache not found"
echo "[FAIL] Icinga2 objects.cache not found ($objectscache_path)"
exit 1
fi
status_time=$(stat --format="%Y" /var/cache/icinga2/status.dat)
status_time=$(stat --format="%Y" $statusdata_path)
now=$(date +"%s")
sleep $(((15 + 5) - ($now - $status_time)))
new_status_time=$(stat --format="%Y" /var/cache/icinga2/status.dat)
new_status_time=$(stat --format="%Y" $statusdata_path)
if [ $new_status_time -eq $status_time ];
then
echo "[FAIL] Icinga2 status.dat is not being updated"
echo "[FAIL] Icinga2 status.dat is not being updated (Last update: $(date -r $statusdata_path '+%x %X'))"
exit 1
else
echo "[OK] Icinga2 status.dat is being updated"
echo "[OK] Icinga2 status.dat is being updated (Last update: $(date -r $statusdata_path '+%x %X'))"
fi