icinga2/test/jenkins/nsca-ng.test

30 lines
978 B
Plaintext
Raw Normal View History

2013-12-20 15:32:45 +01:00
#!/bin/sh
pid_before_restart=`ps -U icinga | grep icinga2 | awk '{print $1}'`
echo 'RESTART_PROCESS' | sudo send_nsca -C
sleep 3
pid_after_restart=`ps -U icinga | grep icinga2 | awk '{print $1}'`
if [ $pid_after_restart -eq $pid_before_restart ]; then
2014-02-14 16:05:58 +01:00
echo "[FAIL] Failed to send 'RESTART_PROCESS' to icinga2"
2013-12-20 15:32:45 +01:00
exit 1
else
2014-02-14 16:05:58 +01:00
echo "[OK] Successfully sent 'RESTART_PROCESS' to icinga2"
2013-12-20 15:32:45 +01:00
fi
printf "localhost\t0\tA passive result returning OK\n" | sudo send_nsca
if [ $? -gt 0 ]; then
2014-02-14 16:05:58 +01:00
echo "[FAIL] Failed to send passive check result for host 'localhost'"
2013-12-20 15:32:45 +01:00
exit 1
else
2014-02-14 16:05:58 +01:00
echo "[OK] Successfully sent a passive check result for host 'localhost'"
2013-12-20 15:32:45 +01:00
fi
printf "localhost\tdisk\t2\tA passive result not returning OK\n" | sudo send_nsca
if [ $? -gt 0 ]; then
2014-02-14 16:05:58 +01:00
echo "[FAIL] Failed to send passive check result for service 'disk' on host 'localhost'"
2013-12-20 15:32:45 +01:00
exit 1
else
2014-02-14 16:05:58 +01:00
echo "[OK] Successfully sent a passive check result for service 'disk' on host 'localhost'"
2013-12-20 15:32:45 +01:00
fi