Gluon - Decision-tree monitor daemon
gluon.pl [--configfile config-file ] [--treefile tree-file ] [--daemon] [--scriptdir script-dir ] [--logging integer ] [--logfile log-file ] [--duser user ] [--dgroup group ] [--sleep integer ] [--debug integer ] [--version] [--help] [--manual] [--]
Gluon is a simple decision-tree daemon, written in Perl, that executes external programs (scripts) to determine the path-flow within the decision-tree. It essentially operates as a basic IF-THEN-ELSE expert system that can be used to monitor and take action.
Tree::Simple Tree::Parser Getopt::Long
and a few others in the Perl Core.
Options are processed in the following sequence:
Application defaults -> Configuration file -> Command line options
The only exception to this is supplying an alternative configuration file in the command line options. The contents of that configuration file are then overridden by any other options supplied on the command line.
See the FILES section for further information.
0 - No logging 1 - Warnings only 2 - Info + Warnings 3 - Debug + Info + Warnings 4 - Verbose Debug + Info + Warnings
0 - Fatal errors only 1 - Warnings + Fatal errors 2 - Info + Warnings + Fatal errors 3 - Debug + Info + Warnings + Fatal errors 4 - Verbose Debug + Info + Warnings + Fatal errors
If run in single mode (not daemon), Gluon will exit with a return value equal to one hundred (100) plus the sum of the exit values of each tree branch, unless there is an error.
To allow for user determined exit values, Gluon uses exit values of less than 100 for its internal error values. See the ERRORS section for further details.
Please see the OPTIONS section of this manpage for futher details.
These are:
Action, Result, Goto and Exit (and technically root node, but we're only interested in its children).
It is the structure of the tree, using the above four nodes, that determines the behavior of Gluon. Gluon allows for three different tree formats:
Dot-separated:
E.g.
|1 Node A |1.1 Child of A |1.2 Another child of A |2 Node B |2.1 Child of node B |2.1.1 Child of the 2.1 node
Space indented (two spaces):
E.g.
|Node A | Child of A | Another child of A |Node B | Child of node B | Child of the 2.1 node
Tab indented (Spaces used below, but you should use tabs):
E.g.
|Node A | Child of A | Another child of A |Node B | Child of node B | Child of the 2.1 node
Here the ``|'' characters represent the left side of the tree file.
Using this method we can easily build up a tree structure. Now, the above examples are all quite generic, however Gluon requires the node labels (eg. ``Node A'' or ``Node B'' etc.) to have a specific format. As stated above, there are four different node types, each with a particular purpose. The structure of Gluon tree files is quite specific and takes the generic form of:
|1 Action Node |1.1 Result Node |1.1.1 Action/Exit/Goto Node |1.2 Result Node |1.2.1 Action/Exit/Goto Node |2 Action Node
So, the children of an Action node will generally be Result nodes and the children of a Result node can be either Action, Exit or Goto nodes. Gluon does not enforce any particular structure, so it is technically possible to set an Exit node as a child of an Action node. This could have the desired effect, but could quite easily have unexpected effects (Gluon processes the nodes as it finds them). The process of moving through the nodes of the decision-tree (following a path-flow) is called a cycle or run.
As you can see from the example above, Gluon allows for multiple ``root'' nodes. So, in the example the first one is ``1 Action Node'' and the second is ``2 Action Node''. Once the cycle of one node branch is finished, Gluon simply moves on to the next. This allows one to run multiple tests from one instance of the Gluon daemon. However, this can be a problem when using Goto nodes for two reasons. Firstly, the Goto node searches across all nodes, not just the branch it was called from. This is actually quite useful as it allows one to jump across to otherwise unrelated branches. Secondly, if Gluon gets stuck in a Goto loop, it will never run through the other brances (until the Goto loop disappears).
The Gluon nodes are:
Action
nodeThe values inside the ``'' can be set as required. The Name variable (e.g. ``A Name'') must be a unique name to describe that node and can be made up of letters, numbers, spaces and ``.'' ``_'' characters. The Action variable must contain a path/filename of an executable. Gluon executes this file and records the exit status. It is this exit status, along with the Result node that determines the next step in path-flow through the tree. This variable can contain all the previous characters and also ``/''. Finally, the Log variable is an optional variable which, if not empty, contains a message that gets written to the log file if logging is switched on.
This node is simple in that it only has one variable, but the contents of the variable itself can be quite complicated. The expression is made up of 3 parts:
The expression must at least be of the following form ``RESULT C integer'' but can be expanded to create more complex statements using the logical operators. So, an example Result node might be:
Result ``RESULT > 0 && RESULT < 10''
or
Result ``RESULT != 0''
The ``RESULT'' keyword is then replaced by the exit value of the previous Action node. If the expression is true then this path is followed. Else, Gluon moves on to the next Result node.
This is quite an interesting node. It allows one to jump from one part of the tree to another. It does this by looking for an Action node with a Name variable that matches the value set in the Goto variable. Once it finds a matching node, it will sleep for the set timeout period (see the OPTIONS section for more details), then proceed from the found node. One thing to take note of is that if nothing in the path-flow up to the goto changes, Gluon will simply loop continuously down this path. That is why the timeout period was introduced, as it creates the effect of starting a new run.
This nodes terminates a run. If Gluon was set to run once only, then the script will exit with an exit code as set by the Exit variable. This is useful as it allows one to use Gluon within another Gluon tree. This could be to break up anotherwise complicated tree into smaller, more managable trees. If Gluon is running as a daemon, it simply terminates the run and does not pay attention to the exit value.
perl (1) the Tree::Simple manpage the Tree::Parser manpage the Getops::Long manpage
Exit value of compilation or perl module errors might clash when expecting Gluon to return a similar value.
Environmental variables could be an interesting way around this.
No known bugs at present. Please submit bugs to:
gluon-bugs at lists dot sourceforge dot net
Character restrictions apply to node variables. Allow characters are:
and spaces.
and spaces.
and spaces.
!= == > < >= <= 0-9 && ||
and spaces.
and spaces.
Please note: This affects allowed filenames and paths.
Fraser Scott fraser at 0x10 dot com
For support please email:
gluon-support at lists dot sourceforge dot net
or visit http://gluon.sourceforge.net