Table: equinix_metal_device - Query Equinix Metal Devices using SQL
Equinix Metal is a bare metal infrastructure service that provides users with high-performance, on-demand, and globally available bare metal servers. It offers a fully automated platform for deploying infrastructure at scale, with features such as API-driven provisioning, hourly and reserved billing, and a wide range of server configuration options. Equinix Metal Devices are the individual servers that users can provision and manage within this service.
Table Usage Guide
The equinix_metal_device
table provides insights into individual servers within the Equinix Metal service. As a system administrator or DevOps engineer, you can explore device-specific details through this table, including the device's ID, hostname, state, and associated project ID. Use this table to manage and monitor your infrastructure, identify unused or underutilized resources, and ensure compliance with your organization's infrastructure policies.
Examples
List all devices
Explore all devices in your Equinix Metal account to manage and monitor your resources more effectively. This query is useful in providing a comprehensive overview of your devices, aiding in resource allocation and troubleshooting.
select *from equinix_metal_device;
select *from equinix_metal_device;
Get IP addresses for a device
Determine the IP addresses associated with a specific device to better understand its network connections and interactions. This information can be useful for troubleshooting network issues or for security audits.
select jsonb_array_elements(ip_addresses) ->> 'address' as ip_addressfrom equinix_metal_devicewhere hostname = 'ny5-c3-medium-x86-01';
select json_extract(ip.value, '$.address') as ip_addressfrom equinix_metal_device, json_each(ip_addresses) as ipwhere hostname = 'ny5-c3-medium-x86-01';
Find devices tagged as production
Explore which devices are tagged as production. This is useful for identifying and managing devices specifically used in the production environment.
select hostname, tagsfrom equinix_metal_devicewhere tags -> 'production' is not null;
select hostname, tagsfrom equinix_metal_devicewhere json_extract(tags, '$.production') is not null;
Group devices by facility
Determine the distribution of devices across different facilities to understand where resources are concentrated. This can aid in resource allocation and management.
select f.code, f.name, count(*) as num_devicesfrom equinix_metal_device as d, equinix_metal_facility as fwhere d.facility_id = f.idgroup by f.code, f.nameorder by num_devices desc
select f.code, f.name, count(*) as num_devicesfrom equinix_metal_device as d join equinix_metal_facility as f on d.facility_id = f.idgroup by f.code, f.nameorder by num_devices desc;
List devices with OS information
Explore devices and their corresponding operating systems to gain insights into system compatibility and version distribution across your network. This could be particularly useful for IT administrators looking to maintain system uniformity or troubleshoot software issues.
select d.hostname, os.name, os.versionfrom equinix_metal_device as d, equinix_metal_operating_system as oswhere d.operating_system_slug = os.slug;
select d.hostname, os.name, os.versionfrom equinix_metal_device as d, equinix_metal_operating_system as oswhere d.operating_system_slug = os.slug;
Group devices by OS distribution
Discover the segments that are grouped by their operating system distribution, which can help in identifying the most commonly used systems and managing resources effectively. This can assist in making informed decisions about resource allocation and system updates.
select os.distro, count(*)from equinix_metal_device as d, equinix_metal_operating_system as oswhere d.operating_system_slug = os.sluggroup by os.distroorder by count desc;
select os.distro, count(*)from equinix_metal_device as d join equinix_metal_operating_system as os on d.operating_system_slug = os.sluggroup by os.distroorder by count(*) desc;
Schema for equinix_metal_device
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
akas | jsonb | Array of globally unique identifier strings (also known as) for the resource. | |
always_pxe | text | True if PXE is always enabled for the device. | |
billing_cycle | text | Billing cycle for the device. | |
created_at | timestamp with time zone | When the device was created. | |
customdata | jsonb | Custom data associated with the device. | |
description | text | Description of the device. | |
facility_id | text | Facility for the device. | |
hardware_reservation | jsonb | Hardware reservation for the device. | |
hostname | text | Hostname of the device. | |
href | text | URL of the device. | |
id | text | = | ID of the device. |
ip_addresses | jsonb | Network configuration for the device. | |
ipxe_script_url | text | IPXE script URL for the device. | |
locked | boolean | True if the device is locked. | |
metro_id | text | Metro for the device. | |
network_ports | jsonb | List of network ports for the device. | |
operating_system_slug | text | OS for the device. | |
plan_id | text | Plan for the device. | |
project_id | text | ID of the Project. | |
provisioning_events | jsonb | Provisioning events for the device. | |
provisioning_percentage | double precision | Provisioning percentage complete for the device. | |
root_password | text | Root password for the device. Only available for 24hr after launch. | |
short_id | text | Short ID for the device. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
spot_instance | boolean | True if the device is a spot instance. | |
spot_price_max | double precision | Maximum spot price allowed for the device. | |
ssh_key_ids | jsonb | SSH Keys deployed to the device. | |
state | text | State of the device. | |
storage | jsonb | Storage details for the device. | |
switch_uuid | text | Switch UUID for the device. | |
tags | jsonb | A map of tags for the resource. | |
tags_src | jsonb | Tags for the device in source list form. | |
termination_time | timestamp with time zone | Time when the device was terminated. | |
title | text | Title of the resource. | |
updated_at | timestamp with time zone | When the device was updated. | |
user | text | User for the device. | |
userdata | text | User data for the device. | |
volume_ids | jsonb | Volumes for the device. |
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)" -- equinix
You can pass the configuration to the command with the --config
argument:
steampipe_export_equinix --config '<your_config>' equinix_metal_device