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

dhipp

ADSM.ORG Member
Joined
Feb 2, 2011
Messages
19
Reaction score
0
Points
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
 
You can't specify a file but you can use a comma delimited list of nodes.

q eve * * node=NODE1,NODE2,NODE3,...,NODEN ....
 
Problem is the list is HUGE. The only other way I thought of was either splitting into separate schedules within the same domain.
 
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:
What are the red smily faces supposed to be? :)
 
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
).
 
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%')
 
Back
Top