Table: jenkins_node - Query Jenkins Nodes using SQL
Jenkins Nodes are the worker machines that are part of the Jenkins distributed build system. They are responsible for executing the build jobs dispatched by the master. Each Jenkins Node can have different operating systems and architecture, allowing for diverse build environments.
Table Usage Guide
The jenkins_node
table provides insights into Jenkins Nodes within Jenkins distributed build system. As a DevOps engineer, explore node-specific details through this table, including name, description, number of executors, labels, and status. Utilize it to uncover information about nodes, such as those with high executor counts, the labels associated with each node, and the status of each node.
Examples
Total number of nodes
Explore the total count of nodes in your Jenkins environment to understand the scale of your build and test infrastructure. This information can be useful for capacity planning and resource allocation.
select count(1) as number_of_nodesfrom jenkins_node;
select count(1) as number_of_nodesfrom jenkins_node;
Number of idle nodes
Explore how many nodes are currently idle in the Jenkins system. This can help in assessing system resource utilization and planning capacity.
select count(1) as number_of_nodes_in_idlefrom jenkins_nodewhere idle;
select count(1) as number_of_nodes_in_idlefrom jenkins_nodewhere idle = 1;
Get the offline nodes
Explore which Jenkins nodes are offline and understand the underlying reasons for their status. This can help in identifying issues and implementing appropriate solutions to restore these nodes.
select display_name, offline_cause, offline_cause_reasonfrom jenkins_nodewhere offline;
select display_name, offline_cause, offline_cause_reasonfrom jenkins_nodewhere offline = 1;
Nodes that allow manual launch
Discover the segments where manual launch is permitted, offering you more control and flexibility in your operations. This can be useful in situations where automated launches may not be ideal or in testing environments.
select display_namefrom jenkins_nodewhere manual_launch_allowed;
select display_namefrom jenkins_nodewhere manual_launch_allowed = 1;
Nodes by the number of executors
Analyze the settings to understand the distribution of executors across different nodes in a Jenkins environment. This can help in balancing workload and optimizing resource utilization.
select display_name, num_executorsfrom jenkins_nodeorder by num_executors desc;
select display_name, num_executorsfrom jenkins_nodeorder by num_executors desc;
Number of nodes by OS and architecture type
Explore the distribution of nodes by operating system and architecture type, allowing you to understand your system's structure and diversity. This can be particularly useful for planning updates or assessing compatibility requirements.
select monitor_data ->> 'hudson.node_monitors.ArchitectureMonitor' as architecture, count(1) as nodesfrom jenkins_nodegroup by architectureorder by architecture desc;
select json_extract( monitor_data, '$.hudson.node_monitors.ArchitectureMonitor' ) as architecture, count(1) as nodesfrom jenkins_nodegroup by architectureorder by architecture desc;
Schema for jenkins_node
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form, e.g. connection_name. | |
display_name | text | = | Unique key for the node. |
executors | jsonb | List of executors, which are slots for execution of tasks in a node. | |
icon | text | Image indicating the status of the node, such as online/offline. | |
icon_class_name | text | An HTML/CSS class indicating the status of the node, such as online/offline. | |
idle | boolean | Boolean to indicate whether the node is not currently running any build. | |
jnlp_agent | boolean | Boolean to indicate whether the node uses a Java Network Launch Protocol agent to connect to master node. | |
manual_launch_allowed | boolean | Boolean to indicate whether a manual launch can be performed on the node. | |
monitor_data | jsonb | Node OS data used for motoring purpose such as, disk space, memory, etc. | |
num_executors | bigint | Number of executors in the node. The higher the more parallel task can be performed. | |
offline | boolean | Boolean to indicate whether the node is offline | |
offline_cause | jsonb | Cause of why node is offline | |
offline_cause_reason | text | Detailed cause of why node is offline | |
temporarily_offline | boolean | Boolean to indicate whether the node is marked to be offline. | |
title | text | The title of the resource. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- jenkins
You can pass the configuration to the command with the --config
argument:
steampipe_export_jenkins --config '<your_config>' jenkins_node