3 statusdata_path="/var/cache/icinga2/status.dat"
4 objectscache_path="/var/cache/icinga2/objects.cache"
6 if [ ! -f $statusdata_path ];
8 sudo icinga2 feature enable statusdata 1> /dev/null
9 sudo service icinga2 restart 1> /dev/null
16 if [ -f $statusdata_path ];
26 echo "[FAIL] Icinga2 status.dat not found ($statusdata_path)"
31 echo "[OK] Icinga2 status.dat found ($statusdata_path)"
33 if [ -f $objectscache_path ];
35 echo "[OK] Icinga2 objects.cache found ($objectscache_path)"
37 echo "[FAIL] Icinga2 objects.cache not found ($objectscache_path)"
41 status_time=$(stat --format="%Y" $statusdata_path)
44 sleep $(((15 + 5) - ($now - $status_time)))
46 new_status_time=$(stat --format="%Y" $statusdata_path)
48 if [ $new_status_time -eq $status_time ];
50 echo "[FAIL] Icinga2 status.dat is not being updated (Last update: $(date -r $statusdata_path '+%x %X'))"
53 echo "[OK] Icinga2 status.dat is being updated (Last update: $(date -r $statusdata_path '+%x %X'))"