OK, so I think I'm done with modifications that make nagios-db's handling
of the transient pendings on startup much better. Here's what I did:
As the NEB module initializes, I reset the has_been_checked flag on all
hosts and services. I've also changed the postgres NEB module to behave
like the mysql one in that it registers for an event, and kicks into
steady state once nagios processes that event. This hides the NEB from the
status calls as the previous values are read in. (I also fixed a cast in
the mysql NEB, FWIW.)
The NEB also now registers for host and service check callbacks. When it
gets these, it calls new stored proces that set the has_been_checked flag.
I'm not sure this is strictly necessary, as the flag also gets set in the
status callback.... but it seems more proper.
The UI has been changed on the tac and hostgroup tac pages, in that
services on hosts that are still pending are listed as such, instead of as
being on good hosts or bad hosts. This change meant changing the views
around, and not just because I needed to display service status totals
with a new "pending_hosts" column. Many of the views were using
last_checked = 0 as a test for if the service had been checked; now, they
use the (I hope) more correct has_been_checked flag. I also decided it
didn't make sense to count pending-but-previously-checked services and
hosts in the execution times. Finally, the host details view went through
a major bloating process in order to properly union in pending services
and services not associated with any hostgroup.
Oh, yes, and I modified the status stored procs to update the host/service
check output to be the most recent output, as opposed to first output when
the host/service entered the current state.
So, here's where I fall on my face and be lame - I simply don't have time
to port these database changes back to mysql. I altered mysql_control.php
to add in -1 for the pending_hosts column where I altered the views, so at
least it shouldn't actually *break*. But the logic is not correct.
Hopefully, somebody (like Matthew?) will look at the changes in
database/postgres/ and copy them over to database/mysql/.
And speaking of more unfinished code, am I just dumb, or are templates not
yet working? After I figured out that the cache directory needs the proper
permissions, I got a really nice-looking menu system.... but nothing I
selected seemed to work.
|