IBM Support

Running Commands Using Always True ITM situations

Technote (FAQ)


Question

How do you run a command on many servers with a single action?

Answer

Use this example when the preconditions are known and the tasks are simple.

Create a situation that fires once and does not autostart. Add an action tab system command that contains the required command. This example uses a zLinux environment with 4 Linux OS Agents at ITM 622 FP2.

Create a situation and name it IBM_one_cmd. The following example is from the Situation Editor started from the toolbar icon. Created in this way, the situation will not be associated with any Portal Client navigation node and so will not show visible events.




Click OK.

For initial condition select Local Time attribute group and the Time attribute, which represents hhmmss. All agents have that attribute group.



Click OK.

Set the condition as <= 250000. Since all times satisfy that condition it will fire once and then never again. Turn off the Run at Startup since it runs under manual control only. Set the sampling interval at 999 days. There is no run-once control for situations but 999 days will make sure it will not accidentally run twice unless the agent is recycled.



On the distribution tab, chose the distribution which is all Linux OS Agent managed systems. In actual use, always experiment first with a test server.



On the EIF tab, make ensure that no events from this situation are forwarded to any event server. One will be created for each agent it runs on.

On the Action tab, set the command. In this case it is an echo command into a log file $CANDLEHOME/tmp



The command was this

echo IBM_one_cmd &{Local_Time.Time} >> $CANDLEHOME/tmp/one.log

and it was executed at the agent.

A terminal session showed the log created.



When you are satisfied then stop the situation.

End of situation example

One way of using this example would be to have a server file to represent that the server is in maintenance mode. Situations running on that server could have an UNTIL situation which suppress events when the file is present. When the "create file" situation starts the file gets created on all those servers and the situations with the UNTIL clauses will have any events suppressed. The situation has to be stopped to clear it for next time. Later on when the related "remove file" situation is started, the events will be propagated again.

Until situations are somewhat more intensive since each sampling interval the results are transmitted to the TEMS for evaluation.

The start/stop situation is fine but it requires two actions.

Simpler is to have a workflow policy using the same scheme. The policy would wait for an always true situation like the one above. When true it would use an action command run at the agent. The policy would have the same distribution as the situation above and would have the restart control turned off. In that way you would start the policy manually to begin maintenance mode.





The example reuses the IBM_one_cmd for control. When situations are used like this, the situations are activated in situation evaluation mode and do not generated events or run action commands.

With this solution, the file would be created with just the policy start - a single action.

Document information

More support for: IBM Tivoli Monitoring V6

Software version: All Versions

Operating system(s): AIX, HP-UX, IBM i, Linux, Solaris, Windows, z/OS

Software edition: All Editions

Reference #: 1390488

Modified date: 07 March 2011