I chose to check the nagios use over the directory only because I was worried about the permissions, but now you mentioned, the cronjob runs as root just like the hook, so checking os.path.isdir('/var/lib/nagios') will do the trick as well and it's more explicit what it's needed.
I chose to check the nagios use over the directory only because I was worried about the permissions, but now you mentioned, the cronjob runs as root just like the hook, so checking os.path. isdir(' /var/lib/ nagios' ) will do the trick as well and it's more explicit what it's needed.
I'll do the change.