[Nagios-db-devel] neb startup revisited
Status: Beta
Brought to you by:
bench23
From: Matthew K. <mk...@ma...> - 2005-01-27 06:04:35
|
Going over the changes for pending hosts and I've noticed a few things in the postgres module. In restart.sql (during nagios startup) I'm not quite clear on why an existing host and service should be reset back to a pending state by setting has_been_checked = FALSE. If you look at nagios and the standard cgis during startup, the data is read in from the retention file and the previous states for hosts/services is assumed to be correct. Also in restart.sql, I'm not sure about inserting the empty host/service when one isn't found in the database. For example if you clear out the database and start nagios up the tac display will show X hosts with flap detection/notifications etc disabled which will slowly count backwards as all the checks complete. Kinda funky :) As I see it the solution for both issues would be to - set configured = false for all hosts/services - do the 'select into thisHostID id FROM host WHERE name = hostName;' if the host/service is NOT found, send the object to processStatus like /* update this host */ nebstruct_host_status_data ds; ds.object_ptr=(void *)hl; processStatus(NEBCALLBACK_HOST_STATUS_DATA, (void*)&ds); which will set configured = TRUE, update the has_been_checked field etc. else we set host/service configured = true and assume the rest of the data in the db is correct and leave it alone (save the extra resources of running the stored proc) Come to think of it at this point you could actually delete from host,service where configured = false to prune any hosts that have been removed from the config. This should give a more immediate overview of nagios's status right after startup. Apologies for the long email. -- Matthew Kent <mk...@ma...> http://magoazul.com |