Fixed compiler warnings.
Fixed some more compiler warnings.
Improve check latency.
Implemented LAST*STATE* macros.
Move pidfile and command pipe to /var/run/icinga2 rather than /var/run

Fixes #3670