sources:
ibmi-system:
host: ${DB2i_HOST}
user: ${DB2i_USER}
password: ${DB2i_PASS}
port: 8076
ignore-unauthorized: true
tools:
system_status:
source: ibmi-system
description: "Overall system performance statistics with CPU, memory, and I/O metrics"
parameters: []
statement: |
SELECT * FROM TABLE(QSYS2.SYSTEM_STATUS(RESET_STATISTICS=>'YES',DETAILED_INFO=>'ALL')) X
system_activity:
source: ibmi-system
description: "Current system activity information including active jobs and resource utilization"
parameters: []
statement: |
SELECT * FROM TABLE(QSYS2.SYSTEM_ACTIVITY_INFO())
remote_connections:
source: ibmi-system
description: "Number of established remote connections to the system"
parameters: []
statement: |
SELECT COUNT(REMOTE_ADDRESS) as REMOTE_CONNECTIONS
FROM qsys2.netstat_info
WHERE TCP_STATE = 'ESTABLISHED'
AND REMOTE_ADDRESS != '::1'
AND REMOTE_ADDRESS != '127.0.0.1'
memory_pools:
source: ibmi-system
description: "Information about memory pool sizes and thread utilization"
parameters: []
statement: |
SELECT POOL_NAME, CURRENT_SIZE, DEFINED_SIZE,
MAXIMUM_ACTIVE_THREADS, CURRENT_THREADS, RESERVED_SIZE
FROM TABLE(QSYS2.MEMORY_POOL(RESET_STATISTICS=>'YES')) X
temp_storage_buckets:
source: ibmi-system
description: "Information about named temporary storage usage"
parameters: []
statement: |
SELECT REPLACE(UPPER(REPLACE(GLOBAL_BUCKET_NAME, '*','')), ' ', '_') as NAME,
BUCKET_CURRENT_SIZE as CURRENT_SIZE, BUCKET_PEAK_SIZE as PEAK_SIZE
FROM QSYS2.SystmpSTG
WHERE GLOBAL_BUCKET_NAME IS NOT NULL
unnamed_temp_storage:
source: ibmi-system
description: "Total usage of unnamed temporary storage buckets"
parameters: []
statement: |
SELECT SUM(BUCKET_CURRENT_SIZE) as CURRENT_SIZE,
SUM(BUCKET_PEAK_SIZE) as PEAK_SIZE
FROM QSYS2.SystmpSTG
WHERE GLOBAL_BUCKET_NAME IS NULL
http_server:
source: ibmi-system
description: "Performance metrics for HTTP servers including connections and request handling"
parameters: []
statement: |
SELECT SERVER_NAME CONCAT '_' CONCAT REPLACE(HTTP_FUNCTION, ' ','_') as SERVER_FUNC,
SERVER_NORMAL_CONNECTIONS, SERVER_SSL_CONNECTIONS, SERVER_ACTIVE_THREADS,
SERVER_IDLE_THREADS, SERVER_TOTAL_REQUESTS, SERVER_TOTAL_REQUESTS_REJECTED,
SERVER_TOTAL_RESPONSES, REQUESTS, RESPONSES, NONCACHE_RESPONSES,
BYTES_RECEIVED, BYTES_SENT, NONCACHE_PROCESSING_TIME, CACHE_PROCESSING_TIME
FROM QSYS2.HTTP_SERVER_INFO
system_values:
source: ibmi-system
description: "Current numeric system values that affect performance"
parameters: []
statement: |
SELECT SYSTEM_VALUE_NAME, CURRENT_NUMERIC_VALUE
FROM QSYS2.SYSTEM_VALUE_INFO
WHERE CURRENT_NUMERIC_VALUE IS NOT NULL
collection_services:
source: ibmi-system
description: "Current configuration of Collection Services"
parameters: []
statement: |
SELECT * FROM QSYS2.COLLECTION_SERVICES_INFO
collection_categories:
source: ibmi-system
description: "Collection Services category settings and intervals"
parameters: []
statement: |
SELECT cs_category, cs_interval
FROM QSYS2.COLLECTION_SERVICES_INFO,
LATERAL (SELECT * FROM JSON_TABLE(CATEGORY_LIST, 'lax $.category_list[*]'
COLUMNS(cs_category CLOB(1K) CCSID 1208 PATH 'lax $."category"',
cs_interval CLOB(1K) CCSID 1208 PATH 'lax $."interval"'))) a
active_job_info:
source: ibmi-system
description: "Find the top 10 consumers of CPU in the QUSRWRK and QSYSWRK subsystems"
parameters:
- name: limit
type: integer
default: 10
description: "Number of top CPU consumers to return"
statement: |
SELECT CPU_TIME, A.* FROM
TABLE(QSYS2.ACTIVE_JOB_INFO(SUBSYSTEM_LIST_FILTER => 'QUSRWRK,QSYSWRK')) A
ORDER BY CPU_TIME DESC
FETCH FIRST :limit ROWS ONLY
# execute_sql:
# source: ibmi-system
# description: "Execute arbitrary SQL statements against the IBM i database for data analysis and troubleshooting"
# readOnlyHint: true
# parameters:
# - name: sql
# type: string
# description: "The SQL statement to execute"
# statement: |
# :sql
# security:
# readOnly: true
# maxQueryLength: 15000
# forbiddenKeywords: ["TRUNCATE", "FORMAT", "DELETE", "UPDATE", "DROP"]
toolsets:
performance:
tools:
- system_status
- system_activity
- remote_connections
- memory_pools
- temp_storage_buckets
- unnamed_temp_storage
- http_server
- system_values
- collection_services
- collection_categories
- active_job_info
# - execute_sql