How can a situation formula be developed without using the TEP Situation Editor definition?
At times you may need a situation formula which cannot be composed or changed in the Tivoli Enterprise Portal Client Situation Editor. The example formula here is:
*IF ((*SCAN KLZ_Process.Process_Command_Name *EQ 'tar') *OR
*VALUE KLZ_Process.Process_Command_Name *EQ 'init'
*COUNT KLZ_Process.Process_ID *LT 2
The function here is meant to start with all Linux processes and compose a result set which consists of any process with "tar" in the Process_Command_Name or with "init" exactly equal to the Process_Command Name. That result set is returned to the TEMS. The number of rows is calculated and an alert if generated if that is less than 2, or one.
You can think of it as an alternate way to do MISSING testing. If the test was *LT 3, the event would fire if there was exactly one tar or if tar was missing. The scheme depends on having one result which will always be present.
Important Performance Warning
The formula above results in much more TEMS processing than usual. All the Linux process events are transmitted to the TEMS and then TEMS logic does the needed tests. As a result, you may see higher TEMS cpu requirements and higher communication requirements. In one case, this introduced a fragmentation based storage growth condition and the remote TEMS had to be recycled once a week.
However, that issue may be less important than having simplified results and fewer situations.
Portal Client Situation Editor Limitations
The above situation formula cannot be created with the Portal Client Situation editor. As a historical note, there was a predecessor to TEP/TEPS called CMW [Candle Management Workstation] which was limited in some ways but had a more flexible way to author situation formula. The limitation may be lifted in the future but for the present a command line utility is needed.
Create a Situation named "IBM_nomiss" with a minimal formula, such as:
*IF *VALUE KLZ_Process.Process_Command_Name *EQ 'init'
This will always fire since any Linux system will have that process running. As usual during situation development turn off "Run at Startup" and distribute to a single test environment. Do an "Apply" and "OK" to exit.
Now continue using the tacmd command line functions:
./tacmd login . . .
./tacmd editsit -s IBM_nomiss -p Formula="*IF ((*SCAN KLZ_Process.Process_Command_Name *EQ 'tar') *OR *VALUE KLZ_Process.Process_Command_Name *EQ 'init') *AND *COUNT KLZ_Process.Process_ID *LT 2"
The details are sometimes hard to figure out. If you are uncertain of the coding details, create a test situation with the type of functions and comparison you want, do a "tacmd viewsit" to view the resulting situation. Finally, compose your formula in a convenient editor.
After the tacmd editsit, invoke the Situation Editor on the situation. If the situation has severe syntax issues - like a missing parenthesis - the situation editor will treat it as an empty formula and will ask you for an attribute. That is just like it behaves on a new entry.
If it is correct, you will see some formula, but it will be incorrect in some ways. In this case the Formula displayed as:
and the formula display:
( SCAN(Process Command Name) == 'init' AND COUNT(Process ID) < 2) OR ( SCAN(Process Command Name) == 'tar' AND COUNT(Process ID) < 2)
which is very different than the intention.
You can start and stop the situation from the list as long as you Cancel out of the view. If you do make changes, like changing the distribution targets, or the "Run at Startup" setting, or an action command, then you will need to redo the "tacmd editsit" afterwards.
Situation testing should work just like normal: set up test conditions and make sure the situation event behaves as expected.
This document shows how to create situation formulas outside of the Situation Editor Formula tab. The same technique could be used to make changes to a situation formula from an external process.