Event Profiler Patch

Steven D. Morrey smorrey at ldschurch.org
Fri Jun 5 23:44:50 CEST 2009


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!

Sincerely,
Steve


 NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: nagios-2.12-event_profiler.patch
Type: text/x-patch
Size: 23611 bytes
Desc: nagios-2.12-event_profiler.patch
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20090605/51f7f0f0/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nagios-3-event_profiler.patch
Type: text/x-patch
Size: 23532 bytes
Desc: nagios-3-event_profiler.patch
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20090605/51f7f0f0/attachment-0001.bin>
-------------- next part --------------
------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
-------------- next part --------------
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel


More information about the Developers mailing list