Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Commits on Aug 2, 2012
  1. @ageric

    include/nagios: Re-update path to libnagios.h

    ageric authored
    In order to be able to install the nagios headers as a development
    package the lib path really must be relative to the -I flag we
    provide when compiling. Since we always *do* provide that -I flag
    but can't do that when other people are building their packages
    against our devel packages (neb-authors), we'll have to install
    the devel packages in "/usr/include/nagios/lib/" or some such, and
    then a relative path will work.
    
    Users who can't get the path to work right now will have to re-run
    ./configure (which is now also mentioned in a comment right next
    to the #include so as to alert the unwary developer...).
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2054 5f96b256-904b-4d8d-8c98-d829582c6739
  2. @ageric

    configure: Regenerate without threads

    ageric authored
    This really is a separate beast. Why we keep it under version control
    is beyond me. Oh well...
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2053 5f96b256-904b-4d8d-8c98-d829582c6739
  3. @ageric

    core: Refactor event_execution_loop()

    ageric authored
    We want it to be a single loop so we can avoid duplicating all the
    super-priority events, and we also want should_run_event() to be a
    separate function so we can avoid code duplication and get some
    testing instead. Not too shabby.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2052 5f96b256-904b-4d8d-8c98-d829582c6739
  4. @ageric

    core: Remove output_file_fd from check_result struct

    ageric authored
    It's unused since quite some time and has no purpose. Besides, one
    can always use the fileno() macro on the checkresult's output_file_fp
    variable to get the exact same info.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2051 5f96b256-904b-4d8d-8c98-d829582c6739
  5. @ageric
  6. @ageric

    core: Remove threading

    ageric authored
    Since the introduction of the command file worker no threads are used
    and full parallalization is acquired by means of helper processes and
    message passing instead, exactly like a micro-kernel would do it.
    
    We take some small overhead in the message passing, but it's negligible
    in the big picture and can, if necessary, be made faster through more
    complicated mechanisms, such as binary protocols or shared memory.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2049 5f96b256-904b-4d8d-8c98-d829582c6739
  7. @ageric

    core: Process passive checks as they arrive

    ageric authored
    The previous system of reading them into memory, putting them in a
    list, flushing them to disk, reading them back into memory and then,
    after much deliberation, processing them, had some fairly obvious
    design problems that are pretty much moot now that thread concurrency
    is no longer an issue. Instead of that highly tricky chain, we now
    process the passive checkresults as and when they arrive.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2048 5f96b256-904b-4d8d-8c98-d829582c6739
  8. @ageric

    core: Remove some dead variables and types

    ageric authored
    The circular_buffer struct is no more. None of the variables of that
    type is used anymore, so this commit consigns them and the type
    declaration to oblivion.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2047 5f96b256-904b-4d8d-8c98-d829582c6739
  9. @ageric

    Retire periodic command checking

    ageric authored
    Since commands are always processed immediately upon arrival since
    the inception of the command file worker thread, there's really no
    need to maintain variables that never get filled.
    
    This commit was intended to be squashed with the previous one first,
    but since it's so large on its own I'll leave it as-is.
    
    In essence, we remove the two global variables "command_check_interval"
    and "last_command_check_time", and all code affected by that removal,
    as well as example configurations and test-data.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2046 5f96b256-904b-4d8d-8c98-d829582c6739
  10. @ageric

    core: Use a command-file worker

    ageric authored
    The only thread remaining (since a looong time back) is that for
    artificially increasing the size of the external command buffer.
    By replacing it with a process, we can get rid of threading (still
    on the todo-list) entirely.
    
    On sane systems, we should be able to add the command pipe directly
    to the iobroker_set to be polled by the main process, but it appears
    OSX (and thus FreeBSD) have crap support for polling filesystem pipes
    along with sockets in a single. Solaris and Irix appear to have some
    similar issues, according to some basic google-fu, so in the best
    spirit of mathematicians we remove a difficult problem (lots of
    exception-handling) in the master process by reducing it to one we've
    already solved and put command file polling, reading and forwarding
    into a separate process.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2045 5f96b256-904b-4d8d-8c98-d829582c6739
  11. @ageric

    core: Retain workers between reloads

    ageric authored
    Respawning them for reloads makes no sense, since it just means we'll
    lose a lot of half-completed checks for no good reason.
    
    While we're at it, we fix worker process memory management so they
    can safely release each other's memory.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2044 5f96b256-904b-4d8d-8c98-d829582c6739
  12. @ageric

    lib/worker: Add set_socket_options()

    ageric authored
    It's handy to disallow sockets to spill over into plugins, and it's
    also nifty to beef up the send and receive buffers somewhat, so we
    do just that.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2043 5f96b256-904b-4d8d-8c98-d829582c6739
  13. @ageric

    lib/worker: Avoid leaking filedescriptors on worker creation errors

    ageric authored
    This amounts to adding a few close() calls and re-arranging some code.
    With the patch it's obviously correct.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2042 5f96b256-904b-4d8d-8c98-d829582c6739
  14. @ageric

    lib/kvvec: Use assignment rather than copying in buf2kvvec()

    ageric authored
    This saves an enormous amount of work, since we no longer have to
    get fresh memory for each check result reported in by the workers.
    Since new memory would inevitably be located in a different page
    than the I/O cache buffer we've got allocated for the worker, that
    means we can now avoid at least one cache-line fill and a (relatively)
    huge constant overhead of check result reception.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2041 5f96b256-904b-4d8d-8c98-d829582c6739
  15. @ageric

    lib/kvvec: Add possibility to avoid multiple alloc()/free() calls

    ageric authored
    It's quite simple to allow callers to provide a pointer to their
    own previously allocated key/value vector, and this allows them to
    avoid a large amount of needless memory munging, so it proves to be
    quite a useful performance improvement as well.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2040 5f96b256-904b-4d8d-8c98-d829582c6739
  16. @ageric

    lib/worker: Make send_kvvec() return what send() returned

    ageric authored
    Doing so makes it possible to keep track of and report write errors,
    which is naturally crucial, but also helps us keep track of how much
    data we've sent, which is really nifty to know when debugging.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2039 5f96b256-904b-4d8d-8c98-d829582c6739
  17. @ageric

    lib/iobroker: Make iobroker_poll() return number of triggered fd's

    ageric authored
    This makes it possible to do some simple verification that we're
    getting some sort of input from something registered with the broker.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2038 5f96b256-904b-4d8d-8c98-d829582c6739
  18. @ageric

    lib/iobroker: Add iobroker_is_registered(fd)

    ageric authored
    As per the questioning name, it returns 1 iff fd is registered and
    0 in all other cases.
    
    This is sort of a debug function, since callers should really keep
    track of which descriptors they've registered with the broker, but
    since I keep tip-toeing around it when committing changes it might
    as well be a permanent fixture of the broker.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2037 5f96b256-904b-4d8d-8c98-d829582c6739
  19. @ageric

    core: Process check results ad-hoc

    ageric authored
    First relegating them to an in-memory list is just an unnecessary
    extra step that we can avoid entirely by just passing the parsed
    check results to their respective handlers as soon as we encounter
    them. While we might encounter occasional long timeouts while reaping
    checks (in case they cause notifications or other helper programs to
    be spawned), we will save some cpu time overall on this change, and
    some extra memory as well.
    
    Also, we avoid the whole problem of potentially reaping more checks
    than we have time to process later, which could cause a buildup of
    check result data in memory which was possible (although very unlikely)
    with the old code.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2036 5f96b256-904b-4d8d-8c98-d829582c6739
  20. @ageric

    core: Fix deleting too old check result files

    ageric authored
    Even under pretty normal circumstances, the check result spool dir
    can fill up with a tremendous amount of check result files, which kills
    Nagios' performance completely.
    
    The problem is reloads, where old checks may be abandoned in case
    they take too long to finish. In that case, half the check result file
    is stashed in the spool directory (the other half is only written as
    the check returns). With a huge amount of checks and semi-frequent
    restarts, the checks will start to accumulate and Nagios will spend
    more and more time scanning a huge directory of files where very few of
    the check result files have ".ok" files accompanying them, leading to
    a ton of cache-misses when we try to stat() the ".ok" file.
    
    This patch fixes it by using the mtime from the stat call earlier in
    the chain so even check results without an ".ok" file can be deleted.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2035 5f96b256-904b-4d8d-8c98-d829582c6739
  21. @ageric

    core: Remove weird switch() statement when scanning check result queue

    ageric authored
    First of all, we use stat(2) instead of lstat(2), so the supposed check
    for symlinks is bogus. If it was a symlink, we'd either get ENOENT or
    the stat info of the actual file.
    
    It's also wrong to check st.st_mode & S_IFMT against S_IFREG and then
    checking it again with the macro S_ISREG(), since they'll both always
    evaluate to true.
    
    Instead, we remove the case statement and only use a simple S_ISREG()
    and ignore everything but ordinary files.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2034 5f96b256-904b-4d8d-8c98-d829582c6739
  22. @ageric

    core: fsync() files before we close them

    ageric authored
    Otherwise we just setup the errno flag to contain EBADFS, meaning
    future debugging calls to strerror() or the %m allocator in strings
    become erroneous.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2033 5f96b256-904b-4d8d-8c98-d829582c6739
  23. @ageric

    configure: Re-generate with embedded perl dropped

    ageric authored
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2032 5f96b256-904b-4d8d-8c98-d829582c6739
  24. @ageric

    core: Remove embedded perl

    ageric authored
    For several years it's been the most complex, the buggiest and the
    least tested part of Nagios, and people experiencing problems with
    the Nagios core have always gotten the suggestion to disable the
    embedded perl interpreter and its broken caching, and it's been
    all but impossible to test its functionality with all the different
    versions of Perl available.
    
    Besides; Since we run checks through workers now instead of forking
    directly and larger processes cause slower fork()'s, it's likely we
    already have better check performance than adding X MiB's of heap
    memory that we'd have to earmark for caching pre-compiled perl
    plugins if we were to support it again.
    
    A much more feasible way forward is to use a module to distribute
    certain checks to a specialized worker. Using the newly introduced
    libnagios, it shouldn't take very long to write such a one.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2031 5f96b256-904b-4d8d-8c98-d829582c6739
  25. @ageric

    core: Make DEBUGL_IPC and DEBUGL_SCHEDULING proper debug levels

    ageric authored
    They used to share an ID with checks, which generate a lot of
    irrelevant data. Since the ipc we're doing now is a lot more important
    we need it to have its own debug level in order to make sense of any
    problems related to it.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2030 5f96b256-904b-4d8d-8c98-d829582c6739
  26. @ageric

    core: Replace worker response code parsing with a perfect hash

    ageric authored
    Courtesy of gperf, we now have a very small, very fast perfect hash
    function that we can paw off the individual keys from the worker
    responses to, allowing us to get a numerical value for them in constant
    time, which lets us do response code parsing about 15 times faster
    than we could earlier.
    
    Since this happens once for every variable returned from the worker
    for every check run, that means we'll most likely run this function
    several hundred million times per hour, so the saving will end up
    being significant in the long run.
    
    The downside is that altering the response variable keys requires
    fiddling with gperf.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2029 5f96b256-904b-4d8d-8c98-d829582c6739
  27. @ageric

    lib/iocache: Add functions iocache_{add,write,send,sendto}()

    ageric authored
    It's nifty to be able to cache output in memory before flushing it,
    in order to avoid tons of small writes. This patch does just that,
    although testing is currently lacking.
    
    We're not really using these functions anywhere right now, but they've
    been sitting in my working tree far too long not to be committed now.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2028 5f96b256-904b-4d8d-8c98-d829582c6739
  28. @ageric

    lib/iocache: Add iocache_reset() and use it where sensible

    ageric authored
    It's nifty to be able to reset an I/O cache structure without having
    to release and re-create all its memory. This patch allows us to do
    just that, and also implements it where sensible.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2027 5f96b256-904b-4d8d-8c98-d829582c6739
  29. @ageric

    core: Send notifications through workers

    ageric authored
    Notifications take a significant amount of time, most of which used to
    stall Nagios completely. With this change, we get rid of that latency-
    inducing behaviour and paw off notifications to be run by one of our
    command execution workers.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2026 5f96b256-904b-4d8d-8c98-d829582c6739
Commits on Jul 18, 2012
  1. @estanley375

    Fixed bug #247: If a service reports no performance data, the perfdat…

    estanley375 authored
    …a log file has no line indicating the test. (omnikron@free.fr)
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2024 5f96b256-904b-4d8d-8c98-d829582c6739
Commits on Jul 13, 2012
  1. @estanley375
  2. @estanley375

    Updated path for libnagios.h

    estanley375 authored
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2022 5f96b256-904b-4d8d-8c98-d829582c6739
Commits on Jul 9, 2012
  1. @ageric

    core: Run eventhandlers, OC[SH]P commands and others through workers

    ageric authored
    They used to be run serially. This parallelizes them, as well as
    offloading them to a smaller process, which means a huge performance
    benefit.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2021 5f96b256-904b-4d8d-8c98-d829582c6739
  2. @ageric

    core: Run host and service checks through a worker

    ageric authored
    Fascinating observation; With a large process (+100MB) we can achieve
    1121 fork()'s per second. With a small process as parent, we can
    achieve 13891 fork()'s per second, best of five runs on my laptop.
    
    Even accounting for the message passing, which has a constant overhead
    of about 50 nanoseconds (two memcpy() and some function call overhead),
    this is a clearly superior solution, even if we don't account for the
    fact that we're now capable of utilizing parallelization as well, so
    we can multiply the number of fork()'s with the number of online cpu's
    minus 1 instead of having it fixed at 1.
    
    Naturally, performance will decline when the fork()'ed programs do
    something sensible instead of just exiting, but since the same program
    was used to measure fork() performance with large and small processes
    we can still expect a huge improvement.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2020 5f96b256-904b-4d8d-8c98-d829582c6739
  3. @ageric

    core: Handle brokered I/O events adding high priority events

    ageric authored
    Previously we used to go ahead with the event we got from the
    queue no matter if events brokered from the I/O broker turned
    were added that were supposed to be run before that one. We still
    do (sort of), except that now we prioritize the earlier scheduled
    events if the first event is scheduled far enough into the future.
    
    "Far enough" means "one second" in this case.
    
    While we're at it, we remove the fairly useless wproc_poll() call.
    Since nagios_iobs is a global variable and wproc_poll() is just a
    wrapper around iobroker_poll() called with nagios_iobs and the
    timeout as variables, we really don't need the wrapper.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2019 5f96b256-904b-4d8d-8c98-d829582c6739
Something went wrong with that request. Please try again.