in reply to Parsing a really, REALLY big MRTG config

Not knowing about specifics, but "parsing the configs every hour" strikes me as a very bad idea. Parse only that which has changed. Find the least memory / cpu stressing way to access information when it's needed. Think diff(1).
ERROR: CFG Error in "setenv[192.168.52.1_1]", line 18: must be XY="dd +dd" AASD=" kjlkj" ...

Far too little information to make an educated guess.

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Replies are listed 'Best First'.
Re^2: Parsing a really, REALLY big MRTG config
by Hercynium (Hermit) on Jun 09, 2007 at 00:30 UTC
    Indeed... I hit a wall trying to parse all the configs each hour and thus created the script that loads, parses and stores the pre-digested data in a DBM::Deep file (Compiler), but only once a night. Then, the web-page generator (Indexer) could simply load into memory only what it needed, rather than the whole enchilada.

    DBM::Deep is great stuff, even for ridiculously deep/complex data structures... as long as you read the author's recommendations for performance (luckily I already coded it that way). It allowed me to make my code scale against the parsed MRTG configs *much* better by only adding a few lines and a tie! (but, alas, that is now over)