Chapter 3. Database structure 109
With this capability, we can extend the menu for any distributed objects that we
can identify as belonging to a Tivoli Management Region where a task server is
defined. For simplicity, we define additional commands for resources that are
defined from TEC, where an Event Enablement host is one of the attributes.
We pick up a generic object that is defined as cid of G02K and add an extension
to perform a DIR command on a Windows platform or a df command on a UNIX
platform.
The tasks are similar, except that we create a Tivoli Framework task called
DIRCDrv under TBSMTasks Task Library. The script that the task runs is shown
in Example 3-6.
Example 3-6 Shell script for DIRCDrv task
#!/bin/sh
if [ x"$OS" = x"Windows_NT" ] ; then
CMD.EXE /C DIR C:
else
df
fi
exit 0
We then define a stored procedure called _DIRCDrv as shown in Example 3-7.
Example 3-7 _DIRCDrv Stored Procedure
CREATE PROCEDURE _DIRCDrv
@cid ClassID,
@id ObjID,
@ReturnCode INT = NULL OUTPUT
AS
RAISERROR(‘_DIRCDrv: %s, %d’, 0, 1, @cid, @id)
DECLARE @command NVARCHAR(255)
DECLARE @userID NVARCHAR(255)
DECLARE @tmeid NVARCHAR(255)
DECLARE @epname NVARCHAR(255)
IF @cid = ‘LOB’
SELECT @cid = phy_cid, @id = phy_id FROM lob_link WHERE dst_id = @id
SELECT @tmeid = _EEhost, @epname = _MgedSystemName
FROM G02Kcname_V where id = @id
EXEC asisp_getContextUserID @userID OUTPUT
IF @tmeid is NULL
BEGIN
SELECT ‘_DIRCDrv ERROR: Cound not locate EE host’
RETURN 8