<?xml version="1.0" encoding="windows-1252"?>
<node id="240670" title="More than just a config file" created="2003-03-05 14:20:26" updated="2004-08-22 10:22:58">
<type id="115">
perlquestion</type>
<author id="19861">
Mur</author>
<data>
<field name="doctext">
I'm tasked with developing a system that monitors the rest of our application, and issues alert messages when certain measurements exceed predefined limits.  I have a design in mind for how to do this, but what I still need is a way to supply the limits in the form of an external config file.

&lt;p&gt;
I know there are all sorts of .INI file parsers, but what I need is a bit stronger.  I envision the configuration looking something like the following:

&lt;code&gt;
ALERT1     green      0 - 20
           yellow     21 - 40
           red        &gt; 40
ALERT2     green      IN ('a','b','c')
           yellow     IN ('d','e')
           red        OTHERWISE
ALERT3     yellow     &lt; 12
           red        &gt;= 12
&lt;/code&gt;

Each alert would correspond to an external script that would measure something (say, load average), and return a single value.  That value might be a number on a scale, or it might be a discrete value (like a string).  The alert levels might be scaled so that "high" values are "redder", or it might be the other way around.  Some alert levels might be undefined (as the "green" level is in ALERT3, above).

&lt;p&gt;
What I'm hoping to find is a parser for a format like this. It's a long shot, but I figure it couldn't hurt to ask here. I poked around at CPAN for a bit, but I don't have a good "search" term that will filter out the various *.INI-type modules.



&lt;table width="66%"&gt;
&lt;tr&gt;&lt;td&gt;--&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td align="left"&gt;
&lt;table&gt;
&lt;tr&gt;&lt;td&gt;Jeff Boes&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Database Engineer&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Nexcerpt, Inc.&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;/td&gt;
&lt;td align="right"&gt;
&lt;table&gt;
&lt;tr&gt;&lt;td align="right"&gt;vox 269.226.9550 ext 24&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align="right"&gt;fax 269.349.9076&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align="right"&gt;&lt;a href="http://www.nexcerpt.com/"&gt;&lt;code&gt; http://www.nexcerpt.com&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan="2" align="center"&gt;
...Nexcerpt...Connecting People With Expertise
&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
</field>
</data>
</node>
