NodeBrain  Demonstration Site
A Rule Engine for State and Event Monitoring     

OnAssert

Next  Prior  Up        Home        
Suppose we have two monitored elements, A and B, and we are interested to know whan A is in a "happy" state while B is in a "sad" state. This demonstration illustrates how an ON rule fires when the condition we are interested in becomes true, but does not fire when it remains true. We include the IsFalse and IsUnknown rules in this demonstration just to illustrate the changing state of the IsTrue rule when it is not firing. However, this also illustrates how you can take action when leaving a state as well as entering it. The IsTrue and IsFalse rules are initially in an unknown state and the IsUnknown rule is in a true state.
Tutorial: Formulas Rules     Language: Formulas Define Assert

Rules

Transactions

Log

again after modifications.     Reset to orignal rules and transactions.

N o d e B r a i n   0.9.04 (Columbo) 2015-09-24
Spec 0.0.904 built for x86_64-redhat-linux-gnu
Copyright (C) 2014-2015 Ed Trettevik <eat@nodebrain.org>
MIT or NodeBrain License
----------------------------------------------------------------
/usr/bin/nb = ++safe 
Date       Time     Message
---------- -------- --------------------------------------------
2017-06-23 15:20:30 NB000I NodeBrain nb[24678] apache@ip-172-31-40-21.us-west-2.compute.internal
2017-06-23 15:20:30 NB000I Argument [1] =
2017-06-23 15:20:30 NB000I Reading from standard input.
---------- --------
Rules
| define IsTrue on(A="happy" and B="sad");
| define IsFalse on(!IsTrue); # just to illustrate when false
| define IsUnknown on(?IsTrue); # just to illustrate when unkown
Transactions
| assert A="sad"; # expect IsFalse to fire
2017-06-23 15:20:30 NB000I Rule IsFalse fired 
| assert B="sad";
| assert A="happy"; # expect IsTrue to fire
2017-06-23 15:20:30 NB000I Rule IsTrue fired 
| assert ?B; # expect IsUnknown to fire
2017-06-23 15:20:30 NB000I Rule IsUnknown fired 
| assert B="happy"; # expect IsFalse to fire
2017-06-23 15:20:30 NB000I Rule IsFalse fired 
| assert B="sad"; # expect IsTrue to fire
2017-06-23 15:20:30 NB000I Rule IsTrue fired 
| assert A="happy"; # no change
2017-06-23 15:20:30 NB000I NodeBrain nb[24678] terminating - exit code=0