steampipe plugin install jenkins

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_nodes
from
jenkins_node;
select
count(1) as number_of_nodes
from
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_idle
from
jenkins_node
where
idle;
select
count(1) as number_of_nodes_in_idle
from
jenkins_node
where
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_reason
from
jenkins_node
where
offline;
select
display_name,
offline_cause,
offline_cause_reason
from
jenkins_node
where
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_name
from
jenkins_node
where
manual_launch_allowed;
select
display_name
from
jenkins_node
where
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_executors
from
jenkins_node
order by
num_executors desc;
select
display_name,
num_executors
from
jenkins_node
order 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 nodes
from
jenkins_node
group by
architecture
order by
architecture desc;
select
json_extract(
monitor_data,
'$.hudson.node_monitors.ArchitectureMonitor'
) as architecture,
count(1) as nodes
from
jenkins_node
group by
architecture
order by
architecture desc;

Schema for jenkins_node

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
display_nametext=Unique key for the node.
executorsjsonbList of executors, which are slots for execution of tasks in a node.
icontextImage indicating the status of the node, such as online/offline.
icon_class_nametextAn HTML/CSS class indicating the status of the node, such as online/offline.
idlebooleanBoolean to indicate whether the node is not currently running any build.
jnlp_agentbooleanBoolean to indicate whether the node uses a Java Network Launch Protocol agent to connect to master node.
manual_launch_allowedbooleanBoolean to indicate whether a manual launch can be performed on the node.
monitor_datajsonbNode OS data used for motoring purpose such as, disk space, memory, etc.
num_executorsbigintNumber of executors in the node. The higher the more parallel task can be performed.
offlinebooleanBoolean to indicate whether the node is offline
offline_causejsonbCause of why node is offline
offline_cause_reasontextDetailed cause of why node is offline
temporarily_offlinebooleanBoolean to indicate whether the node is marked to be offline.
titletextThe 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