Feature #312

Event Profiler Patch

Added by mfriedrich almost 7 years ago. Updated over 6 years ago.

Status:ResolvedStart date:02/27/2010
Priority:LowDue date:
Assignee:magellanic% Done:


Target version:1.0.2


-------- Original Message --------
Subject:     [Nagios-devel] Event Profiler Patch
Date:     Fri, 5 Jun 2009 15:44:50 -0600
From:     Steven D. Morrey <smorrey@ldschurch.org>
Reply-To:     Nagios Developers List <nagios-devel@lists.sourceforge.net>
To:     nagios-devel@lists.sourceforge.net <nagios-devel@lists.sourceforge.net>

Hi Everyone,

In our attempts to squeeze more and more performance out of Nagios, we wanted a way to see how long Nagios is spending in each event type,  average and tota as well as how many times each event is calledl.
The solution I came up with was an Event Profiler.
It's quite simple really, we start a timer at the beginning of handle_timed_event, then we stop the timer at the end.
Next we add that time to the total timer for the event type, and increment the event call timer for that type.
Finally we write it out as part of status.dat.  From here nagiostats prints out a nicely formatted list of whats going on as per normal.
It looks something like this (note I have host checking and retention saving disabled on my dev box right now, also my copy/paste munged the formatting).

EVENT PROFILE DATA:        total seconds spent / number of events / avg time per event
service check                         7420 / 104033 / 0.0713 
host check                             0 / 0 / 0.0000 
external command check                0 / 159 / 0.0000 
log file rotation                     0 / 0 / 0.0000 
program restart                       0 / 0 / 0.0000 
service check reaper                  1438 / 951 / 1.5121 
orphaned service check                0 / 0 / 0.0000 
retention save                        0 / 0 / 0.0000 
status save                           634 / 317 / 2.0000 
scheduled downtime                    0 / 0 / 0.0000 
service result freshness check        0 / 0 / 0.0000 
host result freshness check           0 / 0 / 0.0000 
expire downtime                       0 / 0 / 0.0000 
reschedule checks                     0 / 159 / 0.0000 
expire comment                        0 / 0 / 0.0000 
user function                         0 / 0 / 0.0000 

Simply apply the patch to your nagios install (I have included patches for Nagios3x and nagios-2.12), and compile with the -DEVENT_PROFILER to take advantage of the new functionality.
I hope this helps!


-------- Original Message --------
Subject:     Re: [Nagios-devel] Event Profiler Patch
Date:     Sat, 06 Jun 2009 12:31:44 +0200
From:     Hiren Patel <hir3npatel@gmail.com>
Reply-To:     hir3npatel@gmail.com, Nagios Developers List <nagios-devel@lists.sourceforge.net>
To:     Nagios Developers List <nagios-devel@lists.sourceforge.net>
References:     <3679AE44D8C04547A4F3EB83E77905628241945A3F@MBX01.ldschurch.org>, <4A299766.8080401@iweb.com> <3679AE44D8C04547A4F3EB83E77905628241945A41@MBX01.ldschurch.org> <4A299F4D.5090605@iweb.com> <4A2A3E61.4060504@op5.se>

Andreas Ericsson wrote:
> Mathieu Gagné wrote:
>> On 6/5/09 6:29 PM, Steven D. Morrey wrote:
>>> p.s.  Let me know how that patch goes on a 3x system I don't have a
>>> running 3x to test it on, so all i can promise with that one is that it compiles :)
>> I'm trying it on a Nagios 3.0.6 system. Note that I had to remove all 
>> references to EVENT_CHECK_PROGRAM_UPDATE because it's an event only 
>> available in Nagios 3.1.x.
>> All volatile data are already located on tmpfs partitions. So I'll have 
>> to try without tmpfs partitions afterward so I can compare impact on 
>> performances.
> Steve, thanks for the patch. Mathieu, thanks for testing it out. If it's
> useful to you, I'll apply it and make sure it's included in 3.1.1. The
> data we might be able to gather from it may well be important for the
> 3.2.0 release.
what would be the impact of having this feature be a configuration 
setting in nagios.cfg, instead of having to compile with a flag to get 
the behavior? I'm wondering if it would be useful to be able to switch 
it on to get some information (perhaps during diagnosing something) and 
switch it off again if it's not wanted, without needing to recompile 
nagios for this?

-------- Original Message --------
Subject:     Re: [Nagios-devel] Event Profiler Patch
Date:     Mon, 8 Jun 2009 17:02:31 -0600
From:     Steven D. Morrey <smorrey@ldschurch.org>
Reply-To:     Nagios Developers List <nagios-devel@lists.sourceforge.net>
To:     Nagios Developers List <nagios-devel@lists.sourceforge.net>
References:     <3679AE44D8C04547A4F3EB83E77905628241945A3F@MBX01.ldschurch.org>, <4A299766.8080401@iweb.com> <3679AE44D8C04547A4F3EB83E77905628241945A41@MBX01.ldschurch.org> <4A299F4D.5090605@iweb.com> <4A2A3E61.4060504@op5.se> <4A2A4590.7010306@gmail.com>, <4A2A99D1.2080001@op5.se> <3679AE44D8C04547A4F3EB83E77905628241945A43@MBX01.ldschurch.org>, <4A2D2E8F.2080704@op5.se>

Hello Folks,

Here is a version with the event profiler as a config file option.
To turn it on or off, just set event_profiling_enabled=1 or 0 respectively.
You still need to compile with -DEVENT_PROFILER for it to work, but at least this way you can start and stop the profiler at will.


nagios-3-event_profiler.patch Magnifier (24.8 KB) mfriedrich, 02/27/2010 06:52 PM

nagios-3x-event_profiler.patch Magnifier (21.3 KB) mfriedrich, 02/27/2010 07:03 PM

Related issues

Related to Core, Classic UI, IDOUtils - Bug #2244: segfaults with event_profiling_enabled=1 => deprecate fea... Resolved 01/04/2012

Associated revisions

Revision 8ca33ed1
Added by mfriedrich about 6 years ago

move eventprofiler init after config parsing, checking if enabled, making it optional all over #572 #702

refs #572
refs #702
refs #312


#1 Updated by mfriedrich almost 7 years ago

-------- Original Message --------
Subject:     [Nagios-devel] Event Profiler Patch for Nagios 3x
Date:     Wed, 17 Jun 2009 22:17:33 -0600
From:     Steven D. Morrey <smorrey@ldschurch.org>
Reply-To:     Nagios Developers List <nagios-devel@lists.sourceforge.net>
To:     nagios-devel@lists.sourceforge.net <nagios-devel@lists.sourceforge.net>
CC:     Adam Augustine <AugustineAS@ldschurch.org>

Hello Everyone,

Attached you will find the fully redesigned event profiler patch for nagios-3x.
It was generated against the cvs head as of today.

As is, it instruments each event type as well as the event loop itself.
It has the ability to instrument any portion of code you wish to measure with very little difficulty.

It will display results through the standard nagiostats as well as via mrtg.

By default this will display elapsed time, event counter, time per event and events per second.

For instance to get the events per second stat for service checks.


I hope this will help everyone fine tune their nagios install for maximum performance. :)


#2 Updated by mfriedrich over 6 years ago

  • Assignee set to magellanic

#3 Updated by mfriedrich over 6 years ago

  • Category changed from Other to Performance
  • Status changed from New to Resolved
  • Target version set to 1.0.2

#4 Updated by Anonymous over 6 years ago

Wrong target version? ;-)

#5 Updated by mfriedrich over 6 years ago

was already in 1.0.2 .. forgotten issue.

Also available in: Atom PDF