cpliakas / nagiostatus Goto Github PK
View Code? Open in Web Editor NEWPHP parser library for the Nagios status.dat file.
License: GNU General Public License v2.0
PHP parser library for the Nagios status.dat file.
License: GNU General Public License v2.0
Currently the parser assumes a 3.x config file. The parser should be pluggable so that alternate parsers can be leveraged to handle different Nagios versions in addition to future versions that haven't been released yet.
Current every line is evaluated by at lease one regular expressions. If we change the logic of the parser, the 80% case could be handled first (which is parsing reports inside a status block) and we can probably eliminate the regular expressions as well.
Pluggable logging functionalities that wrap around systems such as Zend_Log or Drupal's watchdog should be implemented by this library to capture errors and debugging information.
UPDATE: Implementing the observer pattern should work fine without explicitly adding the loggers.
After the switch to the per-status rendering, the JSON plugin no longer works.
Currently the script will consume about 100MB of memory when parsing an 11MB file. This is due to creating an array from the parsed file as well as storing the entire document in memory prior to outputting. The code should be refactored so that the plugins can output the content directly so that no bog data structures are stored in memory.
The buildDocument() method incorrectly identifies empty lines as being invalid. The logic should be modified to correctly handle empty lines. There is no error handling currently in place to the library still works, but it will cause problems when we implement the observer pattern.
It'd be nice if the Parser provided a fluent interface so you could do:
<?php
$document = new SimpleXMLElement(Nagiostatus_Parser::instance('/usr/local/nagios/var/status.dat')
->render('xml', true));
?>
You could also chain your registerPlugin() calls instead of making them static methods.
Currently the XML structure closely matches the status.dat structure, so it isn't very useful when used on conjunction with things like XPath. We should come up with a structure that makes it easy to navigate the file.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.