IBM i/AS400
The IBM i/AS400 collector uses IBM i Access ODBC Driver to query Db2 for i SQL Services remotely and collect system, ASP, job, memory pool, subsystem, job queue, and message queue metrics.
Already tested version:
- IBM i 7.4
Configuration¶
Prerequisites¶
Configure the ODBC environment¶
The collector currently runs only on Linux AMD64.
The IBM i/AS400 collector loads IBM i Access ODBC Driver through unixODBC. An existing unixODBC installation and configuration on the Linux collector host can be reused.
First, check the unixODBC installation and configuration file locations:
If odbcinst is unavailable, install unixODBC for the Linux distribution:
# Debian/Ubuntu
sudo apt-get update
sudo apt-get install -y unixodbc
# RHEL/Rocky Linux
sudo dnf install -y unixODBC
# SUSE Linux
sudo zypper install unixODBC
Download the ACS Application Package for the collector platform from IBM i Access Client Solutions, then install IBM i Access ODBC Driver according to the package instructions. Select the AMD64 package. The driver libraries must match the collector runtime architecture.
After installation, confirm that unixODBC can discover IBM i Access ODBC Driver:
The default driver name is IBM i Access ODBC Driver 64-bit.
Check the driver with:
If the driver is not registered automatically, edit the odbcinst.ini file
reported by odbcinst -j. Driver library paths can vary by package.
The following is a common configuration:
[IBM i Access ODBC Driver 64-bit]
Description=IBM i Access for Linux 64-bit ODBC Driver
Driver=/opt/ibm/iaccess/lib64/libcwbodbc.so
Setup=/opt/ibm/iaccess/lib64/libcwbodbcs.so
Threading=0
DontDLClose=1
UsageCount=1
Verify that the driver and the collector's ODBC dependency can be loaded:
Collector Configuration¶
Go to the conf.d/samples directory under the DataKit installation directory, copy ibm_i.conf.sample and name it ibm_i.conf. The configuration is as follows:
[[inputs.external]]
daemon = true
name = "ibm_i"
cmd = "/usr/local/datakit/externals/ibm_i"
## Set true to enable election.
election = true
args = [
"--interval", "60s",
"--host", "<ibm-i-host>",
"--username", "DKUSER",
## Optional: IBM i Access ODBC driver name registered in odbcinst.ini.
# "--driver", "IBM i Access ODBC Driver 64-bit",
## Optional: use a raw ODBC connection string instead of host/username/password/driver.
# "--dsn", "Driver={IBM i Access ODBC Driver 64-bit};System=<ibm-i-host>;UID=DKUSER;PWD=<password>;",
## Optional query and timeout settings.
# "--query-timeout", "30s",
# "--job-query-timeout", "240s",
# "--system-mq-query-timeout", "80s",
# "--severity-threshold", "50",
## Repeat these arguments as needed.
## When --query is omitted, all default queries are enabled.
## On large systems, start with base queries and enable job detail
## queries only when needed.
# "--query", "disk_usage",
# "--query", "cpu_usage",
# "--query", "memory_info",
# "--query", "subsystem",
# "--query", "job_queue",
## Limit message_queue_info to selected queues to reduce target load.
# "--message-queue", "QSYSOPR",
# "--message-queue", "QSYSMSG",
]
envs = [
"ENV_INPUT_IBM_I_PASSWORD=<password>",
"LD_LIBRARY_PATH=/opt/ibm/iaccess/lib64:$LD_LIBRARY_PATH",
]
[inputs.external.tags]
# some_tag = "some_value"
# more_tag = "some_other_value"
Once configured, restart DataKit.
The collector can be enabled through ConfigMap injection.
A raw ODBC connection string can be supplied through --dsn. When --dsn is configured, --host, --username, --password, and --driver are not used to build the connection string:
To avoid exposing the password in the configuration or command line, pass it through an environment variable:
envs = [
"ENV_INPUT_IBM_I_PASSWORD=<password>",
"LD_LIBRARY_PATH=/opt/ibm/iaccess/lib64:$LD_LIBRARY_PATH",
]
Options¶
| Option | Description |
|---|---|
--dsn |
Raw ODBC connection string. When configured, it has the highest priority |
--driver |
IBM i Access ODBC Driver name. Default: IBM i Access ODBC Driver 64-bit |
--host |
IBM i host address |
--username |
IBM i collection user |
--password |
IBM i collection password. Use ENV_INPUT_IBM_I_PASSWORD where possible |
--interval |
Metric collection interval. Default: 60s. Use at least 60s when all queries are enabled |
--query-timeout |
Default query timeout. Default: 30s |
--job-query-timeout |
Job query timeout. Default: 240s |
--system-mq-query-timeout |
Message queue query timeout. Default: 80s |
--query |
Query to enable. Repeat this option to enable multiple queries. All default queries are enabled when omitted |
--severity-threshold |
Critical message severity threshold. Default: 50 |
--message-queue |
Message queue name filter. Repeat this option to configure multiple queues |
--metric-enabled |
Enable metric reporting. Default: true |
All default queries are enabled when --query is omitted. Job detail queries
emit metrics per job and can create many time series on IBM i systems with a
large number of jobs. In production, you can start with the base queries and
enable job detail queries later as needed.
The message_queue_info query scans all message queues by default. On systems
with many messages, use --message-queue to restrict collection to the queues
you want to monitor, such as QSYSOPR and QSYSMSG.
The following values are supported by --query:
disk_usage
cpu_usage
jobq_job_status
active_job_status
job_memory_usage
memory_info
subsystem
job_queue
message_queue_info
Metric¶
ibm_i¶
| Tags & Fields | Description |
|---|---|
| asp_number ( tag) |
ASP number. |
| host ( tag) |
IBM i host name or connection address. |
| job_active_status ( tag) |
Active job status. |
| job_id ( tag) |
IBM i job identifier. |
| job_name ( tag) |
IBM i job name. |
| job_queue_library ( tag) |
Job queue library. |
| job_queue_name ( tag) |
Job queue name. |
| job_queue_status ( tag) |
Job queue status. |
| job_status ( tag) |
IBM i job status. |
| job_user ( tag) |
IBM i job user. |
| memory_pool_name ( tag) |
Memory pool name used by a job. |
| message_queue_library ( tag) |
Message queue library. |
| message_queue_name ( tag) |
Message queue name. |
| partition_id ( tag) |
IBM i partition ID. |
| pool_name ( tag) |
Memory pool name. |
| resource_name ( tag) |
Disk resource name. Available on IBM i 7.3 or later. |
| serial_number ( tag) |
Disk serial number. |
| subsystem_name ( tag) |
Subsystem name. |
| unit_number ( tag) |
Disk unit number. |
| unit_type ( tag) |
Disk unit type. |
| asp_io_requests_per_s | IO requests per second. Available on IBM i 7.3 or later. Type: float | (gauge) Unit: throughput,reqps Tagged by: asp_number, resource_name, serial_number, unit_number, unit_type |
| asp_percent_busy | Disk busy percentage. Available on IBM i 7.3 or later. Type: float | (gauge) Unit: percent,percent Tagged by: asp_number, resource_name, serial_number, unit_number, unit_type |
| asp_percent_used | Disk unit used percentage. Type: float | (gauge) Unit: percent,percent Tagged by: asp_number, serial_number, unit_number, unit_type |
| asp_unit_space_available | Available disk unit space. Type: int | (gauge) Unit: digital,B Tagged by: asp_number, serial_number, unit_number, unit_type |
| asp_unit_storage_capacity | Disk unit capacity. Type: int | (gauge) Unit: digital,B Tagged by: asp_number, serial_number, unit_number, unit_type |
| job_active_duration | Active job duration. Type: float | (gauge) Unit: time,s Tagged by: job_active_status, job_id, job_name, job_status, job_user, subsystem_name |
| job_cpu_usage | Job CPU usage. Type: float | (gauge) Unit: percent,percent Tagged by: job_active_status, job_id, job_name, job_status, job_user, subsystem_name |
| job_cpu_usage_pct | Job CPU usage percentage. Type: float | (gauge) Unit: percent,percent Tagged by: job_active_status, job_id, job_name, job_status, job_user, subsystem_name |
| job_queue_duration | Duration spent in job queue. Type: float | (gauge) Unit: time,s Tagged by: job_id, job_name, job_queue_library, job_queue_name, job_queue_status, job_status, job_user, subsystem_name |
| job_queue_held_size | Held job count. Type: int | (gauge) Unit: count Tagged by: job_queue_name, job_queue_status, subsystem_name |
| job_queue_released_size | Released job count. Type: int | (gauge) Unit: count Tagged by: job_queue_name, job_queue_status, subsystem_name |
| job_queue_scheduled_size | Scheduled job count. Type: int | (gauge) Unit: count Tagged by: job_queue_name, job_queue_status, subsystem_name |
| job_queue_size | Total jobs in the job queue. Type: int | (gauge) Unit: count Tagged by: job_queue_name, job_queue_status, subsystem_name |
| job_status_value | Job status marker. Returned job records are set to 1. Type: int | (gauge) Unit: count Tagged by: job_active_status, job_id, job_name, job_queue_library, job_queue_name, job_queue_status, job_status, job_user, subsystem_name |
| job_temp_storage | Temporary storage used by the job. Type: int | (gauge) Unit: digital,MB Tagged by: job_active_status, job_id, job_name, job_user, memory_pool_name, subsystem_name |
| message_queue_critical_size | Message count with severity greater than or equal to the configured threshold. Type: int | (gauge) Unit: count Tagged by: message_queue_library, message_queue_name |
| message_queue_size | Total messages in the message queue. Type: int | (gauge) Unit: count Tagged by: message_queue_library, message_queue_name |
| pool_defined_size | Defined pool size. Type: float | (gauge) Unit: digital,MB Tagged by: pool_name, subsystem_name |
| pool_reserved_size | Reserved pool size. Type: float | (gauge) Unit: digital,MB Tagged by: pool_name, subsystem_name |
| pool_size | Current pool size. Type: float | (gauge) Unit: digital,MB Tagged by: pool_name, subsystem_name |
| subsystem_active | Whether the subsystem is active. Active is 1. Type: int | (gauge) Unit: count Tagged by: subsystem_name |
| subsystem_active_jobs | Current active job count. Type: int | (gauge) Unit: count Tagged by: subsystem_name |
| system_configured_cpus | Configured CPU count. Type: float | (gauge) Unit: count Tagged by: partition_id |
| system_cpu_usage | Average CPU utilization. Type: float | (gauge) Unit: percent,percent Tagged by: partition_id |
| system_current_cpu_capacity | Current CPU capacity. Type: float | (gauge) Unit: count Tagged by: partition_id |
| system_normalized_cpu_usage | Normalized CPU usage. Type: float | (gauge) Unit: percent,percent Tagged by: partition_id |
| system_shared_cpu_usage | Shared CPU usage. Type: float | (gauge) Unit: percent,percent Tagged by: partition_id |
collector¶
| Tags & Fields | Description |
|---|---|
| instance ( tag) |
Server addr of the instance |
| job ( tag) |
Server name of the instance |
| up | Whether the collector successfully scraped the target during the last collection cycle: 1 means true and 0 means false. Type: int | (gauge) Unit: bool |
FAQ¶
How do I verify ODBC?¶
If you need to verify ODBC independently, add a test DSN to the odbc.ini
file reported by odbcinst -j:
Then run these commands in order:
odbcinst -j
odbcinst -q -d
ldd /opt/ibm/iaccess/lib64/libcwbodbc.so
isql -v IBMI DKUSER '<password>'
Verify that the driver is registered, all dynamic library dependencies are
available, and isql can connect to IBM i.
What should I check on IBM i?¶
TCP/IP and the Database Host Server must be running on IBM i. The collection user must be able to sign on to IBM i and query Db2 for i SQL Services.
Why are no metrics reported?¶
Check the following:
- unixODBC and IBM i Access ODBC Driver can be loaded on the DataKit host.
odbcinst -q -dlists the configured driver name.isqlcan connect to IBM i with the collection user.- The IBM i Database Host Server is running and reachable through the network and firewall.
- The collection user can access the Db2 for i SQL Services listed in this document.
- [DataKit installation directory]/externals/ibm_i.log does not contain connection or query errors.