[dev.icinga.com #312] Event Profiler Patch #136

icinga-migration opened this Issue Feb 27, 2010 · 5 comments


None yet

1 participant


This issue has been migrated from Redmine: https://dev.icinga.com/issues/312

Created by mfriedrich on 2010-02-27 17:52:14 +00:00

Assignee: magellanic
Status: Resolved (closed on 2010-07-09 14:53:27 +00:00)
Target Version: 1.0.2
Last Update: 2010-07-09 16:41:13 +00:00 (in Redmine)

-------- Original Message --------
Subject:    [Nagios-devel] Event Profiler Patch
Date:   Fri, 5 Jun 2009 15:44:50 -0600
From:   Steven D. Morrey 
Reply-To:   Nagios Developers List 
To:     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 
Reply-To:   hir3npatel@gmail.com, Nagios Developers List 
To:     Nagios Developers List 
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 
Reply-To:   Nagios Developers List 
To:     Nagios Developers List 
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.




2010-09-24 16:38:26 +00:00 by mfriedrich 8ca33ed

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

refs #572
refs #702
refs #312



Updated by mfriedrich on 2010-02-27 18:03:23 +00:00

  • File added nagios-3x-event_profiler.patch

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

    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.

    mrtg for profiler stats is PROFILE_(COUNTER/ELAPSED/EVENTPS)_STAT_NAME
    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. :)



Updated by mfriedrich on 2010-05-16 18:24:05 +00:00

  • Assigned to set to magellanic

Updated by mfriedrich on 2010-07-09 14:53:27 +00:00

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

Updated by Anonymous on 2010-07-09 16:36:36 +00:00

Wrong target version? ;-)


Updated by mfriedrich on 2010-07-09 16:41:13 +00:00

was already in 1.0.2 .. forgotten issue.

@icinga-migration icinga-migration added this to the 1.0.2 milestone Jan 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment