Quantcast
Channel: Symantec Connect - Articles
Viewing all articles
Browse latest Browse all 1863

How to find task output data in the Symantec cmdb

$
0
0

Tasks have an advanced option to collect output data. This data is what would appear on the client computer's screen if one were watching the task execute real-time or if one manually executed the task in a shell window. The option is found on the task edit screen's Advanced window, on the 'Script' tab. It is a checkbox labeled' Save script output with task status'. 

Task output data includes anything displayed on-screen by the task. It can be output of a 'cat' statement, success and error codes/messages, etc. 

The task output data is stored in the "TaskOutputPropertyValue" table in the "Value" column/attribute. 

Following is a simplified explanation of tasks, task versions and task instances. 

1. Each task is an item and can be found in the "item" table. (There are other task related tables but this is a good starting point when working with a task name from the NS console.) 

2. Each task can have multiple versions, which are found in the "itemversions" table. (Yes, we track versions but restoring is a manual process. View the task xml (right-click) for info.) 

3. Each itemversion of a task can be ran multiple times. Each execution of a task is called a task instances. Task instance data is found in the "taskinstances" table. 

Note: There are other task-related tables for status, results, output, etc., as shown below. 

Following is a sample sql query that might help:

====================

-- Find task instances by task name. Show completion status and output text

-- Provided as-is by Symantec

-- Written by Doug Jenkins, April 21, 2015

--

-- To use, simply copy a task name in the '@TaskName field, below, and execute the script.

-- The output can be further refined by adding a computer name. 

 

Declare @TaskName varchar(255)

Declare @ComputerName varchar(255)

Set @TaskName = '%Mac unix shell script2%'

Set @ComputerName = '%'

 

select    vc.name 'Client Name'

        , i.name 'Task name'

        , tir.endtime 'Instance EndTime'

        , case tis.instancestatus

            when 0 then 'Not started'

            when 1 then 'Started'

            when 2 then 'Completed'

            when 3 then 'Failed'

            when 4 then 'Stop Requested'

            else 'unknown'

          end 'Instance Status'

        , topv.value 'Instance Output Text'

  from item i 

  join itemversions iv on iv.itemguid = i.guid

  join taskinstances ti on ti.taskversionguid = iv.versionguid

  join vcomputer vc on ti.resourceguid = vc.guid

  left join taskinstancestatus tis        on tis.taskinstanceguid = ti.taskinstanceguid

  left join taskinstanceresults tir    on tir.taskinstanceguid = ti.taskinstanceguid

  left join TaskOutputPropertyValue topv on topv.taskinstanceguid = ti.taskinstanceguid

  where 

    i.name like @TaskName

    and vc.name like @ComputerName

  order by tir.endtime, i.name  --, v.name --, iv.version,

====================


Viewing all articles
Browse latest Browse all 1863

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>