You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`This notebook utilizes the \`ENDED_JOB_INFO\` SQL service, which extracts details about jobs that have started and ended within a specific time period.`,
27
+
`If no parameter values are passed to \`ENDED_JOB_INFO\`, it will use today and yesterday for the historical analysis.`,
28
+
`[Click here for documentation](https://www.ibm.com/docs/en/i/7.5.0?topic=services-ended-job-info-table-function).`,
29
+
].join('\n\n')),
30
+
31
+
`## Top 10 jobs that used the most temporary storage (where the job ended, today or yesterday)`,
32
+
[
33
+
`-- title: Temp Storage top 10`,
34
+
`-- hideStatement: true`,
35
+
`-- y: Peak Temporary Storage `,
36
+
`bar: select from_job as label, PEAK_TEMPORARY_STORAGE, `,
37
+
` from_user concat ' using ' concat JOB_INTERFACE as PEAK_TEMPORARY_STORAGE_DESC`,
38
+
` from table (`,
39
+
` SYSTOOLS.ENDED_JOB_INFO()`,
40
+
` )`,
41
+
` where subsystem in ('QUSRWRK', 'QBATCH')`,
42
+
` order by PEAK_TEMPORARY_STORAGE desc`,
43
+
` limit 10`,
44
+
].join('\n'),
45
+
46
+
`## Top 10 jobs that used the most CPU (where the job ended, today or yesterday)`,
47
+
[
48
+
`-- title: CPU top 10`,
49
+
`-- hideStatement: true`,
50
+
`-- y: CPU Consumers `,
51
+
`bar: select from_job as label, cpu_time, `,
52
+
` from_user concat ' using ' concat JOB_INTERFACE as cpu_time_DESC`,
53
+
` from table (`,
54
+
` SYSTOOLS.ENDED_JOB_INFO()`,
55
+
` )`,
56
+
` where subsystem in ('QUSRWRK', 'QBATCH')`,
57
+
` order by cpu_time desc`,
58
+
` limit 10`,
59
+
].join('\n'),
60
+
61
+
`## Top 10 jobs that used the most I/O (where the job ended, today or yesterday)`,
62
+
[
63
+
`-- title: I/O top 10`,
64
+
`-- hideStatement: true`,
65
+
`-- y: I/O Drivers `,
66
+
`bar: select from_job as label, sync_aux_io_count, `,
67
+
` from_user concat ' using ' concat JOB_INTERFACE as sync_aux_io_count_DESC`,
68
+
` from table (`,
69
+
` SYSTOOLS.ENDED_JOB_INFO()`,
70
+
` )`,
71
+
` where subsystem in ('QUSRWRK', 'QBATCH')`,
72
+
` order by sync_aux_io_count desc`,
73
+
` limit 10`,
74
+
].join('\n'),
75
+
76
+
`## Top 10 longest running jobs over the last 7 days`,
77
+
[
78
+
`-- title: Longest running jobs over the 7 days`,
79
+
`-- hideStatement: true`,
80
+
`-- y: Elapsed time (minutes)`,
81
+
`bar: with barchart(execution_minutes, job_info) as (`,
82
+
` select timestampdiff(4, cast(MESSAGE_TIMESTAMP - JOB_ACTIVE_TIME as char(22))), `,
83
+
` from_user concat ' using ' concat JOB_INTERFACE concat ' in job: ' concat from_job`,
84
+
` from table (`,
85
+
` SYSTOOLS.ENDED_JOB_INFO(start_time => ( CURRENT_DATE - 7 DAYS ))`,
86
+
` )`,
87
+
` where subsystem in ('QUSRWRK', 'QSYSWRK', 'QBATCH')`,
88
+
` order by timestampdiff(4, cast(MESSAGE_TIMESTAMP - JOB_ACTIVE_TIME as char(22))) desc`,
89
+
` limit 10`,
90
+
` )`,
91
+
` select execution_minutes as label, execution_minutes, job_info as execution_minutes_desc`,
92
+
` from barchart`,
93
+
].join('\n')
94
+
],
95
+
isNotebook: true
96
+
},
97
+
22
98
{
23
99
name: "Local Services (Bar with tooltip)",
24
100
content: [
25
-
`-- This will show top services sending/receiving data`,
101
+
`## This will show top services sending/receiving data`,
`--Review the audit journal authority failure (AF) detail, over the last month\n\nWhich days had the highest number of AF entries?`,
187
+
`## Review the audit journal authority failure (AF) detail, over the last month\n\nWhich days had the highest number of AF entries?`,
112
188
`bar: select date(entry_timestamp) as label, count(*) as AF_count\n from table (\n SYSTOOLS.AUDIT_JOURNAL_AF(STARTING_TIMESTAMP => current timestamp - 1 month)\n )\n group by date(entry_timestamp)\n order by AF_count desc`,
113
-
`--Which users had the highest number of AF entries?`,
189
+
`## Which users had the highest number of AF entries?`,
114
190
`bar: select user_name as label, count(*) as AF_count\n from table (\n SYSTOOLS.AUDIT_JOURNAL_AF(STARTING_TIMESTAMP => current timestamp - 1 month)\n )\n group by user_name\n order by AF_count desc`,
115
-
`--Which types of AF failures are being hit?`,
191
+
`## Which types of AF failures are being hit?`,
116
192
`bar: select VIOLATION_TYPE_DETAIL as label, count(*) as AF_count\n from table (\n SYSTOOLS.AUDIT_JOURNAL_AF(STARTING_TIMESTAMP => current timestamp - 1 month)\n )\n group by VIOLATION_TYPE_DETAIL\n order by AF_count desc`,
117
-
`--Which objects are having the authorization failures?`,
193
+
`## Which objects are having the authorization failures?`,
118
194
`bar: select coalesce(\n path_name, object_library concat '/' concat object_name concat ' ' concat object_type) as label,\n count(*) as AF_count\n from table (\n SYSTOOLS.AUDIT_JOURNAL_AF(STARTING_TIMESTAMP => current timestamp - 1 month)\n )\n group by coalesce(\n path_name, object_library concat '/' concat object_name concat ' ' concat object_type)\n order by AF_count desc limit 10 `
119
195
],
120
196
isNotebook: true
121
197
},
122
198
{
123
199
name: `IFS_OBJECT_STATISTICS (Bar)`,
124
200
content: [
125
-
`-- Get raw info about files from IFS_OBJECT_STATISTICS. **This is a long running query**.`,
201
+
`## Get raw info about files from IFS_OBJECT_STATISTICS. **This is a long running query**.`,
126
202
`bar: WITH ALL_OBJS AS (\n SELECT PATH_NAME,\n OBJECT_TYPE,\n DATA_SIZE AS FILESIZE,\n OBJECT_OWNER\n FROM TABLE (\n QSYS2.IFS_OBJECT_STATISTICS(START_PATH_NAME => '/home', -- Set "root" directory for analysis\n SUBTREE_DIRECTORIES => 'YES',\n OMIT_LIST => '/QSYS.LIB /QFileSvr.400')\n )\n ),\n -- Get the total size of all data underneath root\n TOTAL_DATA_SIZE AS (\n SELECT CAST(SUM(FILESIZE) AS DECFLOAT) AS DATA_SIZE\n FROM ALL_OBJS\n WHERE OBJECT_TYPE != '*DIR'\n ),\n -- Get path names to files, also calculate percent storage used (relative to total storage under root).\n PATHS_AND_FILES AS (\n SELECT SUBSTRING(PATH_NAME, 1, LOCATE_IN_STRING(PATH_NAME, '/', -1)) AS PATHNAME,\n SUBSTRING(PATH_NAME, LOCATE_IN_STRING(PATH_NAME, '/', -1) + 1) AS FILENAME,\n FILESIZE,\n OBJECT_TYPE,\n (CAST(FILESIZE AS DECFLOAT) / (SELECT DATA_SIZE FROM TOTAL_DATA_SIZE)) * 100 AS PERCENT_STORAGE\n FROM ALL_OBJS\n WHERE OBJECT_TYPE != '*DIR'\n ),\n \n -- Sum file size by directory.\n FILES_AND_DIRS AS (\n SELECT PATHNAME, \n COUNT(*) AS NUM_FILES,\n CAST(CAST(SUM(FILESIZE) AS DECFLOAT) / 1000000 AS DEC(12, 2)) AS STORAGE_USED_MB, \n CAST(SUM(PERCENT_STORAGE) AS DEC(5, 2)) AS PERCENT_STORAGE_USED_OF_RELATIVE_ROOT\n FROM PATHS_AND_FILES\n GROUP BY PATHNAME)\nSELECT PATHNAME AS LABEL, STORAGE_USED_MB FROM FILES_AND_DIRS\nORDER BY PERCENT_STORAGE_USED_OF_RELATIVE_ROOT DESC\nLIMIT 10;`
127
203
],
128
204
isNotebook: true
129
205
},
130
206
{
131
207
name: `Temp storage by day (Line)`,
132
208
content: [
133
-
`--Show the top temp storage consumption by day. **This is a long running query**.`,
209
+
`##Show the top temp storage consumption by day. **This is a long running query**.`,
134
210
`line: WITH TOP_CONSUMERS AS (\n SELECT RANK() OVER (\n PARTITION BY DATE(MESSAGE_TIMESTAMP)\n ORDER BY PEAK_TEMPORARY_STORAGE DESC\n ) AS RANK,\n DATE(MESSAGE_TIMESTAMP) AS DATE,\n FROM_JOB,\n JOB_END_CODE,\n JOB_END_DETAIL,\n CPU_TIME,\n SYNC_AUX_IO_COUNT,\n PEAK_TEMPORARY_STORAGE\n FROM TABLE (\n SYSTOOLS.ENDED_JOB_INFO(START_TIME => CURRENT TIMESTAMP - 7 DAYS, END_TIME => CURRENT TIMESTAMP)\n )\n )\n SELECT FROM_JOB || ' ' || DATE AS LABEL, PEAK_TEMPORARY_STORAGE \n FROM TOP_CONSUMERS\n WHERE RANK <= 1\n ORDER BY DATE ASC,\n RANK ASC`,
0 commit comments