1. Forum Rules (PLEASE CLICK HERE TO READ BEFORE POSTING) Click the link to access ADSM.ORG Acceptable Use Policy and forum rules which should be observed when using this website. Violators may be banned from this website. This message will disappear after you have made at least 12 posts. Thank you for your cooperation.

Need an 'Q EVENT' script that can use a file for the 'nodes' option

Discussion in 'Scripting' started by dhipp, Jul 31, 2012.

  1. dhipp

    dhipp New Member

    Joined:
    Feb 2, 2011
    Messages:
    14
    Likes Received:
    0
    For example, I can run a select to show me a list of nodes that have a common contact:

    select node_name from nodes where contact like 'Windows_Group%'

    But then I want to run a query event log to show a list of missed/failed for the nodes that were reported from the select statement above. Such as:

    q ev * * node=(INPUT_FILE) begind=-1 begint=17:00 endd=today endt=now ex=yes

    Please let me know if I am being to vague.

    Thanks in advance,

    Don
     
  2.  
  3. rmazzon

    rmazzon Senior Member

    Joined:
    Dec 6, 2004
    Messages:
    206
    Likes Received:
    17
    Occupation:
    TSM Managed Services Lead
    Location:
    NC
    You can't specify a file but you can use a comma delimited list of nodes.

    q eve * * node=NODE1,NODE2,NODE3,...,NODEN ....
     
  4. dhipp

    dhipp New Member

    Joined:
    Feb 2, 2011
    Messages:
    14
    Likes Received:
    0
    Problem is the list is HUGE. The only other way I thought of was either splitting into separate schedules within the same domain.
     
  5. chad_small

    chad_small Moderator

    Joined:
    Dec 17, 2002
    Messages:
    2,197
    Likes Received:
    43
    Occupation:
    AIX/SAN/TSM
    Location:
    Gilbert, AZ
    You would have to change your query into a select statement. I gathered the last 10 days in the following script, just change the days to what you need.

    If you want just missed/failed/pending then use:

    select -
    schedule_name, -
    cast(SUBSTR(CHAR(actual_start),12,8) as char(8)) AS START, -
    node_name, -
    cast(status as char(10)) as "STATUS", -
    cast(result as char(7)) as "RESULT" -
    from EVENTS -
    where scheduled_start>(CURRENT TIMESTAMP - 10 DAYS) -
    and STATUS not in ('Completed','Future') -
    and node_name in (select node_name from nodes -
    where contact like 'Windows_Group%')


    This is an example returning all results:

    select -
    schedule_name, -
    cast(SUBSTR(CHAR(actual_start),12,8) as char(8)) AS START, -
    node_name, -
    cast(status as char(10)) as "STATUS", -
    case -
    when result=0 then ' 0-Succ' -
    when result=4 then ' 4-SkFi' -
    when result=8 then ' 8-Warn' -
    when result=12 then '12-Errs' -
    else cast(result as char(7)) -
    end -
    as "RESULT" -
    from events -
    where scheduled_start>(CURRENT TIMESTAMP - 10 DAYS) -
    and node_name in (select node_name from nodes -
    where contact like 'Windows_Group%')

    If you are seeing a smiley in the syntax it represents an eight followed by )
     
    Last edited: Jul 31, 2012
  6. dhipp

    dhipp New Member

    Joined:
    Feb 2, 2011
    Messages:
    14
    Likes Received:
    0
    What are the red smily faces supposed to be? :)
     
  7. moon-buddy

    moon-buddy Moderator

    Joined:
    Aug 24, 2005
    Messages:
    6,076
    Likes Received:
    269
    Occupation:
    Electronics Engineer, Security Professional
    Location:
    Somewhere in the US
    See the last line on Chad's post!
     
  8. dhipp

    dhipp New Member

    Joined:
    Feb 2, 2011
    Messages:
    14
    Likes Received:
    0
    Yea, just caught that... Did get the following:

    tsm: TSMZWEI>select schedule_name cast(SUBSTR(CHAR(actual_start),12,8) as char(8)) AS START,node_name, cast(status as char(10)) as "STATUS", case when result=0 then ' 0-Succ' hen result=4 then ' 4-SkFi' when result=8 then ' 8-Warn' when result=12 then '12-Errs' else cast(result as char(7)) end as "RESULT" from events where start_time>(CURRENT TIMESTAMP - 10 DAYS) and node_name in (select node_name from nodes where contact like 'sea%')
    ANR0162W Supplemental database diagnostic information: -1:42601:-104 ([IBM][CLI Driver][DB2/LINUXX8664] SQL0104N An
    unexpected token "(" was found following "t schedule_name cast". Expected tokens may include: ",". SQLSTATE=42601
    ).
     
  9. moon-buddy

    moon-buddy Moderator

    Joined:
    Aug 24, 2005
    Messages:
    6,076
    Likes Received:
    269
    Occupation:
    Electronics Engineer, Security Professional
    Location:
    Somewhere in the US
    Should be for the two select statements:

    Code:
    schedule_name, - 
    cast(SUBSTR(CHAR(actual_start),12,8) as char(8)) AS START, - 
    node_name, -
    cast(status as char(10)) as "STATUS", -
    cast(result as char(7)) as "RESULT" -
    from EVENTS -
    where scheduled_start>(CURRENT TIMESTAMP - 10 DAYS) -
    and STATUS not in ('Completed','Future') -
    and node_name in (select node_name from nodes - 
    where contact like 'Windows_Group%')
    
    
    This is an example returning all results:
    
    select - 
    schedule_name, - 
    cast(SUBSTR(CHAR(actual_start),12,8) as char(8)) AS START, - 
    node_name, - 
    cast(status as char(10)) as "STATUS", - 
    case - 
    when result=0 then ' 0-Succ' - 
    when result=4 then ' 4-SkFi' - 
    when result=8 then ' 8-Warn' - 
    when result=12 then '12-Errs' - 
    else cast(result as char(7)) - 
    end - 
    as "RESULT" - 
    from events - 
    where scheduled_start>(CURRENT TIMESTAMP - 10 DAYS) - 
    and node_name in (select node_name from nodes - 
    where contact like 'Windows_Group%')
    
     

Share This Page