Back to Netdata

IBM i (AS/400) collector

src/go/plugin/ibm.d/README.md

2.10.321.0 KB
Original Source

IBM i (AS/400) collector

Overview

Monitors IBM i (AS/400) systems using SQL services and CL commands to expose CPU, memory, storage, job, and subsystem activity.

Dependencies:

  • unixODBC 2.3+ with IBM i Access ODBC driver
  • IBM i 7.2 or later with SQL services enabled

Required Libraries:

  • libodbc.so (provided by unixODBC)
  • IBM i Access Client Solutions

Collection paths

The collector executes queries in multiple tracks:

  • Fast path (5s): lightweight system status queries remain sequential on the main plugin thread.
  • Slow path (10s beat): heavier queries (per-queue metrics, subsystems, plan cache, etc.) run in a background worker with bounded concurrency.
  • Batch path (≥60s beat): optional long-period worker used for expensive aggregate queries such as queue totals. Disabled by default unless queue totals are explicitly enabled.

CPU Collection Methods:

The collector uses a hybrid approach for CPU utilization metrics to handle IBM i 7.4+ where AVERAGE_CPU_* columns were deprecated:

  1. Primary Method - TOTAL_CPU_TIME: Uses the monotonic TOTAL_CPU_TIME counter from QSYS2.SYSTEM_STATUS() to calculate CPU utilization via delta-based calculation. This is the most accurate method but requires *JOBCTL special authority. TOTAL_CPU_TIME is a cumulative counter in nanoseconds representing CPU-seconds consumed, naturally in per-core scale.

  2. Fallback Method - ELAPSED_CPU_USED: If *JOBCTL authority is not available, falls back to ELAPSED_CPU_USED with automatic reset detection. This method tracks when IBM i statistics are reset (either manually or via reset_statistics configuration) and re-establishes a baseline after detecting resets. The values are already in per-core scale.

  3. Legacy Method - AVERAGE_CPU_UTILIZATION: For IBM i versions before 7.4, uses the now- deprecated AVERAGE_CPU_UTILIZATION column, which IBM reports in the same per-core scale.

The collector automatically selects the appropriate method based on available permissions and logs which method is being used.

CPU Metric Scale:

CPU utilization is reported using the "100% = 1 CPU core" semantic. This means:

  • 100% indicates one CPU core is fully utilized
  • 400% indicates four CPU cores are fully utilized
  • Values are limited to 100% × ConfiguredCPUs, matching the partition's configured capacity

For shared LPARs, the metrics show absolute CPU consumption in per-core scale, not relative to entitled capacity. For example, a shared LPAR entitled to 0.20 cores can show 150% utilization when bursting above entitlement.

Statistics Reset Behavior:

The reset_statistics configuration option controls whether the collector resets IBM i system statistics on each query via SYSTEM_STATUS(RESET_STATISTICS=>'YES'). When enabled:

  • System-level statistics (CPU, memory pools, etc.) are reset after each collection cycle
  • Matches legacy behavior but clears global statistics that other tools may rely on
  • The ELAPSED_CPU_USED fallback method will detect and handle these resets automatically
  • Caution: Enabling this affects all users and applications on the IBM i system

Default: false (statistics are not reset, using RESET_STATISTICS=>'NO')

Chart Gaps During Baseline Resets:

The as400.system_activity_cpu_rate and as400.system_activity_cpu_utilization charts rely on delta calculations. When the collector detects that IBM i reset these statistics—or when it is still establishing the initial baseline—it intentionally skips a sample instead of emitting a zero or spike. Netdata renders those skipped samples as small gaps, which is expected behaviour.

Cardinality Management:

To prevent performance issues from excessive metric creation, the collector enforces cardinality limits on per-instance metrics (disks, subsystems, job queues, message queues, output queues, active jobs, network interfaces, HTTP servers).

How Limits Work:

  • The collector counts instances before collecting metrics
  • If count exceeds the configured max_* limit, collection is skipped entirely for that category
  • The collector logs a warning: "[category] count (X) exceeds limit (Y), skipping collection"
  • No metrics are collected for that category until you adjust the configuration

Configuration Options:

Use both limit and selector options together to manage high-cardinality environments:

OptionPurposeDefault
max_disksMaximum disk units to monitor100
max_subsystemsMaximum subsystems to monitor100
max_job_queuesMaximum job queues to monitor100
max_message_queuesMaximum message queues to monitor100
max_output_queuesMaximum output queues to monitor100
active_jobsFully qualified active jobs to monitor (JOB_NUMBER/USER/JOB_NAME)[]
collect_disks_matchingGlob pattern to filter disks (e.g., "001* 002*")"" (match all)
collect_subsystems_matchingGlob pattern to filter subsystems (e.g., "QINTER QBATCH")"" (match all)
collect_job_queues_matchingGlob pattern to filter job queues (e.g., "QSYS/*")"" (match all)

Optional batch-path controls:

OptionPurposeDefault
batch_pathEnables the long-period batch worker for aggregate queriesfalse
batch_path_update_everyBatch worker cadence (minimum 60s, recommend ≥600s in production)60s
batch_path_max_connectionsMaximum concurrent connections for batch queries1
collect_message_queue_totalsEnables full-scan counting of all message queues and messagesauto (off)
collect_job_queue_totalsEnables aggregate counting of job queues and queued jobsauto (off)
collect_output_queue_totalsEnables aggregate counting of output queues and spooled filesauto (off)

Warning: queue totals require scanning IBM i catalog views and can be very expensive on large systems. Leave these options disabled unless aggregate counts are absolutely necessary.

Example Workflow:

  1. System has 500 disks, collector skips disk metrics (exceeds default limit of 100)
  2. Check logs: "disk count (500) exceeds limit (100), skipping per-disk metrics"
  3. Two options:
    • Option A: Increase limit: max_disks: 500 (collects all 500 disks)
    • Option B: Use selector: collect_disks_matching: "00[1-5]*" (cherry-pick specific disks)

Best Practices:

  • Use selectors to monitor only business-critical objects in large environments
  • Set limits based on your Netdata server's capacity (each instance = multiple charts)
  • Start with defaults and adjust based on actual usage patterns

IBM i 7.2–7.3 Behavior Note (Message Queues):

IBM i 7.4 introduced a message-queue table function that returns only the live backlog. On 7.2–7.3 systems we fall back to the QSYS2.MESSAGE_QUEUE_INFO view, which includes all recorded messages (even those already processed/cleared from the queue). Aggregations—especially MAX(SEVERITY)—therefore reflect the historical log, not just the outstanding backlog. This behaviour is inherent to the IBM SQL service and can lead to higher-than-expected max severity values on pre-7.4 systems.

Network interface metrics have a fixed internal limit of 50 instances, and HTTP server metrics are capped at 200 instances; these limits are currently not configurable.

This collector is part of the Netdata monitoring solution.

Collected metrics

Metrics grouped by scope.

The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels.

Per IBM i (AS/400) instance

These metrics refer to the entire monitored IBM i (AS/400) instance.

This scope has no labels.

Metrics:

MetricDimensionsUnit
netdata.plugin_ibm.as400_query_latency_fastcount_disks, count_http_servers, count_network_interfaces, detect_ibmi_version_primary, detect_ibmi_version_fallback, disk_instances, disk_instances_enhanced, disk_status, http_server_info, job_info, memory_pools, network_connections, network_interfaces, serial_number, system_name, system_activity, system_model, system_status, temp_storage_named, temp_storage_total, technology_refresh_level, active_jobms
netdata.plugin_ibm.as400_query_latency_slowanalyze_plan_cache, count_subsystems, subsystems, message_queue_aggregates, job_queues, output_queue_info, plan_cache_summaryms
netdata.plugin_ibm.as400_query_latency_batchmessage_queue_totals, job_queue_totals, output_queue_totalsms

These metrics refer to the entire monitored IBM i (AS/400) instance.

This scope has no labels.

Metrics:

MetricDimensionsUnit
as400.cpu_utilizationutilizationpercentage
as400.cpu_utilization_entitledutilizationpercentage
as400.cpu_configurationconfiguredcpus
as400.cpu_capacitycapacitypercentage
as400.total_jobstotaljobs
as400.active_jobs_by_typebatch, interactive, activejobs
as400.job_queue_lengthwaitingjobs
as400.main_storage_sizetotalbytes
as400.temporary_storagecurrent, maximumMiB
as400.memory_pool_usagemachine, base, interactive, spoolbytes
as400.memory_pool_definedmachine, basebytes
as400.memory_pool_reservedmachine, basebytes
as400.memory_pool_threadsmachine, basethreads
as400.memory_pool_max_threadsmachine, basethreads
as400.disk_busy_averagebusypercentage
as400.system_asp_usageusedpercentage
as400.system_asp_storagetotalMiB
as400.total_auxiliary_storagetotalMiB
as400.system_threadsactive, per_processorthreads
as400.network_connectionsremote, totalconnections
as400.network_connection_stateslisten, close_waitconnections
as400.temp_storage_totalcurrent, peakbytes
as400.system_activity_cpu_rateaveragepercentage
as400.system_activity_cpu_utilizationaverage, minimum, maximumpercentage

Per activejob

These metrics refer to individual activejob instances.

Labels:

LabelDescription
job_nameJob_name identifier
job_statusJob_status identifier
subsystemSubsystem identifier
job_typeJob_type identifier

Metrics:

MetricDimensionsUnit
as400.activejob_cpucpupercentage
as400.activejob_resourcestemp_storageMiB
as400.activejob_timecpu_time, total_timeseconds
as400.activejob_activitydisk_io, interactive_transactionsoperations/s
as400.activejob_threadsthreadsthreads

Per disk

These metrics refer to individual disk instances.

Labels:

LabelDescription
disk_unitDisk_unit identifier
disk_typeDisk_type identifier
disk_modelDisk_model identifier
hardware_statusHardware_status identifier
disk_serial_numberDisk_serial_number identifier

Metrics:

MetricDimensionsUnit
as400.disk_busybusypercentage
as400.disk_io_requestsread, writerequests/s
as400.disk_space_usageusedpercentage
as400.disk_capacityavailable, usedgigabytes
as400.disk_blocksread, writeblocks/s
as400.disk_ssd_healthlife_remainingpercentage
as400.disk_ssd_agepower_on_daysdays

Per httpserver

These metrics refer to individual httpserver instances.

Labels:

LabelDescription
serverServer identifier
functionFunction identifier

Metrics:

MetricDimensionsUnit
as400.http_server_connectionsnormal, sslconnections
as400.http_server_threadsactive, idlethreads
as400.http_server_requestsrequests, responses, rejectedrequests/s
as400.http_server_bytesreceived, sentbytes/s

Per jobqueue

These metrics refer to individual jobqueue instances.

Labels:

LabelDescription
job_queueJob_queue identifier
libraryLibrary identifier
statusStatus identifier

Metrics:

MetricDimensionsUnit
as400.jobqueue_lengthjobsjobs

Per messagequeue

These metrics refer to individual messagequeue instances.

Labels:

LabelDescription
libraryLibrary identifier
queueQueue identifier

Metrics:

MetricDimensionsUnit
as400.message_queue_messagestotal, informational, inquiry, diagnostic, escape, notify, sender_copymessages
as400.message_queue_severitymaxseverity

Per networkinterface

These metrics refer to individual networkinterface instances.

Labels:

LabelDescription
interfaceInterface identifier
interface_typeInterface_type identifier
connection_typeConnection_type identifier
internet_addressInternet_address identifier
network_addressNetwork_address identifier
subnet_maskSubnet_mask identifier

Metrics:

MetricDimensionsUnit
as400.network_interface_statusactivestatus
as400.network_interface_mtumtubytes

Per outputqueue

These metrics refer to individual outputqueue instances.

Labels:

LabelDescription
libraryLibrary identifier
queueQueue identifier
statusStatus identifier

Metrics:

MetricDimensionsUnit
as400.output_queue_filesfilesfiles
as400.output_queue_writerswriterswriters
as400.output_queue_statusreleasedstate

Per plancache

These metrics refer to individual plancache instances.

Labels:

LabelDescription
metricMetric identifier

Metrics:

MetricDimensionsUnit
as400.plan_cache_summaryvaluevalue

Per queueoverview

These metrics refer to individual queueoverview instances.

Labels:

LabelDescription
queue_typeQueue_type identifier
item_typeItem_type identifier

Metrics:

MetricDimensionsUnit
as400.queues_countqueuesqueues
as400.queued_itemsitemsitems

Per subsystem

These metrics refer to individual subsystem instances.

Labels:

LabelDescription
subsystemSubsystem identifier
libraryLibrary identifier
statusStatus identifier

Metrics:

MetricDimensionsUnit
as400.subsystem_jobsactive, maximumjobs

Per tempstoragebucket

These metrics refer to individual tempstoragebucket instances.

Labels:

LabelDescription
bucketBucket identifier

Metrics:

MetricDimensionsUnit
as400.temp_storage_bucketcurrent, peakbytes

Configuration

File

The configuration file name for this integration is ibm.d/as400.conf.

You can edit the configuration file using the edit-config script from the Netdata config directory.

bash
cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
sudo ./edit-config ibm.d/as400.conf

Options

The following options can be defined globally or per job.

NameDescriptionDefaultRequiredMinMax
update_everyData collection frequency5no1-
VnodeVnode allows binding the collector to a virtual node.``no--
DSNDSN provides a full IBM i ODBC connection string if manual override is needed.``no--
TimeoutTimeout controls how long to wait for SQL statements and RPCs.2000000000no--
HostnameHostname is the remote IBM i host to monitor.``no--
PortPort is the TCP port for the IBM i Access ODBC server.8471no165535
UsernameUsername supplies the credentials used for authentication.``no--
PasswordPassword supplies the password used for authentication.``no--
DatabaseDatabase selects the IBM i database (library) to use when building the DSN.*SYSBASno--
ConnectionTypeConnectionType selects how the collector connects (currently only "odbc").odbcno--
ODBCDriverODBCDriver specifies the driver name registered on the host.IBM i Access ODBC Driverno--
UseSSLUseSSL enables TLS for the ODBC connection when supported by the driver.falseno--
ResetStatisticsResetStatistics toggles destructive SQL services that reset system statistics on each query.falseno--
CollectDiskMetricsCollectDiskMetrics toggles collection of disk unit statistics.autono--
CollectSubsystemMetricsCollectSubsystemMetrics toggles collection of subsystem activity metrics.autono--
CollectActiveJobsCollectActiveJobs toggles collection of detailed per-job metrics.autono--
CollectHTTPServerMetricsCollectHTTPServerMetrics toggles collection of IBM HTTP Server statistics.autono--
CollectPlanCacheMetricsCollectPlanCacheMetrics toggles collection of plan cache analysis metrics.autono--
CollectMessageQueueTotalsCollectMessageQueueTotals enables expensive aggregate counting across all message queues.autono--
CollectJobQueueTotalsCollectJobQueueTotals enables expensive aggregate counting across all job queues.autono--
CollectOutputQueueTotalsCollectOutputQueueTotals enables expensive aggregate counting across all output queues.autono--
SlowPathSlowPath enables the asynchronous slow-path worker for heavy queries.trueno--
SlowPathUpdateEverySlowPathUpdateEvery controls the beat interval for the slow-path worker.10000000000no--
SlowPathMaxConnectionsSlowPathMaxConnections caps the number of concurrent queries the slow-path worker may run.1no--
BatchPathBatchPath enables the long-period batch worker for expensive queue aggregates.falseno--
BatchPathUpdateEveryBatchPathUpdateEvery controls the beat interval for the batch worker.60000000000no--
BatchPathMaxConnectionsBatchPathMaxConnections caps concurrent queries for the batch worker.1no--
MaxDisksMaxDisks caps how many disk units may be charted.100no--
MaxSubsystemsMaxSubsystems caps how many subsystems may be charted.100no--
DiskSelectorDiskSelector filters disk units by name using glob-style patterns.``no--
SubsystemSelectorSubsystemSelector filters subsystems by name using glob-style patterns.``no--
ActiveJobsActiveJobs lists active jobs to monitor, using fully-qualified job identifiers (JOB_NUMBER/USER/JOB_NAME). When empty, active job collection is disabled.nilno--
MessageQueuesMessageQueues lists message queues to collect, formatted as LIBRARY/QUEUE strings. When empty, message queue collection is disabled. The default configuration monitors QSYS/QSYSOPR, QSYS/QSYSMSG, and QSYS/QHST.[QSYS/QSYSOPR QSYS/QSYSMSG QSYS/QHST]no--
JobQueuesJobQueues lists job queues to collect, formatted as LIBRARY/QUEUE strings. When empty, job queue collection is disabled.nilno--
OutputQueuesOutputQueues lists output queues to collect, formatted as LIBRARY/QUEUE strings. When empty, output queue collection is disabled.nilno--

Examples

Basic configuration

IBM i (AS/400) monitoring with default settings.

<details> <summary>Config</summary>
yaml
jobs:
  - name: local
    endpoint: dummy://localhost
</details>

Troubleshooting

Debug Mode

To troubleshoot issues with the as400 collector, run the ibm.d.plugin with the debug option enabled. The output should give you clues as to why the collector isn't working.

  • Navigate to the plugins.d directory, usually at /usr/libexec/netdata/plugins.d/
  • Switch to the netdata user
  • Run the ibm.d.plugin to debug the collector:
bash
sudo -u netdata ./ibm.d.plugin -d -m as400

Getting Logs

If you're encountering problems with the as400 collector, follow these steps to retrieve logs and identify potential issues:

  • Run the command specific to your system (systemd, non-systemd, or Docker container).
  • Examine the output for any warnings or error messages that might indicate issues. These messages will typically provide clues about the root cause of the problem.

For systemd systems (most Linux distributions)

bash
sudo journalctl -u netdata --reverse | grep as400

For non-systemd systems

bash
sudo grep as400 /var/log/netdata/error.log
sudo grep as400 /var/log/netdata/collector.log

For Docker containers

bash
sudo docker logs netdata 2>&1 | grep as400