Are all the last_update values in status.dat always the same?

Andreas Ericsson ae at op5.se
Thu Jul 9 22:45:38 CEST 2009


Steven D. Morrey wrote:
> I've vetted through 2.7, 2.12 and 3.x in all cases it's the same 
> fprintf(fp,"\tlast_update=%lu\n",current_time);
> 

Typ. It was introduced in commit 93d550845e56ea41682ef348065be0a667f8e7f7,
which describes as nagios-1.0-45-g93d5508. That's *waaay* old (2003-02-15).

> Oddly enough I don't think this was a bug.  I think that this WAS a
> bug fix way back in the mists of time, the reason being is that the
> last_update time is NEVER set or updated except when it's read in
> from retention.dat
> 

Well, in 1.0 it was both set and updated.


> If we correct this code to the proper temp_host->last_update and
> temp_service->last_update, nagios will likely segfault as soon as it
> writes out status.dat

Umm... no? There's no reason why it should segfault because we fix
this. The patch is rather simple, too. All we have to do is fix it
to make update_host_status() set the last_updated flag and make sure
it's actually printed. However, since it doesn't seem to be *used*
anywhere we'd be better off scheduling it for removal completely.
Unfortunately, doing so would alter the object and would thus alter
the eventbroker API. Doing such a thing requires some planning.

I've scheduled some object refactoring for when we're about to move
to 4.0, but that could well be a long way off (or then again, maybe
not), where a lot of things are likely to be done differently.

> I vote for complete removal of this line and
> modification of extinfo.c to use the file update time, since it
> appears to be the only file that uses it. Let me know what you think!
> 

Well, I'd take a patch to do it, but I see little reason for it
since it doesn't actually break anything (although some weird addon
somewhere might actually depend on it). Parsing even 45k strings in
C is done faster than you can blink, so it's not as if we're wasting
massive amounts of time on it either, even for *very* large
installations.

In short; I don't care either way. If anyone else does, prove you
do by sending me a patch and I'll apply it ;-)

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge




More information about the Developers mailing list