Menu

#30 Importer scrambles data

Development
open-accepted
5
2003-03-04
2003-01-01
Anonymous
No

When importing samples from the original Nagios distro
you must remove all comments for import to work
properly. Also doing an import of all items at once does
not function correctly.

You can only import one .cfg file at a time. Then using
this method after about four imports previously imported
items will loose data.

ie. Import in this sequence:
hosts
hostgroups
services
contacts
contactgroups

and by the time you get to contactgroups if you check
hosts previously correct information will be lost.

Observed on a RH8.0 box with php 4.2.3 and apache
1.3.

Discussion

  • Geert Vanderkelen

    Logged In: YES
    user_id=131327

    Yes, this is a strange behavious I have sometimes too.. I
    will have
    to check the parser more these issues.

     
  • Geert Vanderkelen

    • assigned_to: nobody --> kemuri
    • status: open --> open-accepted
     
  • Allen Parker

    Allen Parker - 2003-05-23

    Logged In: YES
    user_id=785181

    also observed on Debian Woody: Apache/1.3.27 (Unix)
    Debian GNU/Linux PHP/4.2.3 mod_ssl/2.8.9 OpenSSL/0.9.6g

     
  • Allen Parker

    Allen Parker - 2003-05-23

    Logged In: YES
    user_id=785181

    kemuri, icq 7749229 if you have it, not a php buff here, but if
    there's anything i can do, a patch or something to test for
    you, let me know

     
  • David Panofsky

    David Panofsky - 2004-09-28

    Logged In: YES
    user_id=132806

    After several hours of banging my head against this problem, I
    discovered that it is a result of repeatedly calling the
    "PluginImportObjects" in quick succession (once for each file to be
    imported). This function reads the nagatobjs.dat file (which
    contains nagat's current knowledge of your nagios config) into a
    buffer, adds any new data to the buffer, and writes it back out. The
    problem occurs the second (and possibly subsequent) time calling
    PluginImportObjects when (near line 355 in plugin_default.inc) this
    code is executed:
    if( file_exists(NGT_CFGLOC."nagatobjs.dat") ) {

    PHP has a file attribute cache which has doesn't keep up with the
    fact that this file was just written in the first pass, so the
    nagatobjs.dat re-import code doesn't get run.

    The fix (for me, at least) is to call the clearcache() function
    immediately preceding the "if(file_exists(...))" line. Out of paranoia,
    I added the clearcache function before every "file_exists" function
    call in plugin_default.inc. Any slowdown in the script execution by
    doing this is totally acceptable in my opinion.

     

Log in to post a comment.

MongoDB Logo MongoDB