turbot/newrelic
steampipe plugin install newrelic

New Relic + Steampipe

New Relic is a SaaS providing Monitoring, Alerting, Dashboards for applications, infrastructure, etc.

Steampipe is an open source CLI for querying cloud APIs using SQL from Turbot

List APM Applications on your New Relic account:

select
id,
name,
error_rate,
health_status,
response_time
from
newrelic_apm_application;
+-----------+------+------------+---------------+---------------+
| id | name | error_rate | health_status | response_time |
+-----------+------+------------+---------------+---------------+
| 511153982 | test | 0 | gray | 0 |
+-----------+------+------------+---------------+---------------+

Documentation

Quick start

Install

Download and install the latest New Relic plugin:

steampipe plugin install newrelic

Credentials

ItemDescription
CredentialsYou will require a New Relic API Token
PermissionsUser API Keys are associated with a user account, they have the same permissions as the user which may mean they can access multiple accounts.
RadiusEach connection represents one New Relic user, this can be across multiple accounts if the user has permissions on multiple accounts.
Resolution1. Credentials explicitly set in a steampipe config file (~/.steampipe/config/newrelic.spc).
2. Credentials specified in environment variables, e.g., NEW_RELIC_API_KEY and NEW_RELIC_REGION.

Configuration

Installing the latest New Relic plugin will create a config file (~/.steampipe/config/newrelic.spc) with a single connection named newrelic:

Configure your account details in ~/.steampipe/config/newrelic.spc:

connection "newrelic" {
plugin = "newrelic"
# New Relic API Key. Required.
# This can also be set via the 'NEW_RELIC_API_KEY' environment variable.
# api_key = "NRAK-XX0X0XX00XXXX0000XXXXXXXXX0X"
# New Relic Region - valid values are 'us' or 'eu' (default, if not chosen, is 'us'). Optional.
# This can also be set via the 'NEW_RELIC_REGION' environment variable.
# region = "us"
}

Alternatively, you can also use the standard New Relic environment variables to configure your credentials only if other arguments (api_key, region) are not specified in the connection:

export NEW_RELIC_API_KEY=NRAK-XX0X0XX00XXXX0000XXXXXXXXX0X
export NEW_RELIC_REGION=us

Postgres FDW

This plugin is available as a native Postgres FDW. Unlike Steampipe CLI, which ships with an embedded Postgres server instance, the Postgres FDW can be installed in any supported Postgres database version.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_postgres_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/postgres.sh)" -- newrelic

The installer will prompt you for the plugin name and version, download and install the appropriate files for your OS, system architecture, and Postgres version.

To configure the Postgres FDW, you will create an extension, foreign server, and schema and import the foreign schema.

CREATE EXTENSION IF NOT EXISTS steampipe_postgres_newrelic;
CREATE SERVER steampipe_newrelic FOREIGN DATA WRAPPER steampipe_postgres_newrelic OPTIONS (config '<your_config>');
CREATE SCHEMA newrelic;
IMPORT FOREIGN SCHEMA newrelic FROM SERVER steampipe_newrelic INTO newrelic;

SQLite Extension

This plugin is available as a SQLite Extension, making the tables available as SQLite virtual tables.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_sqlite_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/sqlite.sh)" -- newrelic

The installer will prompt you for the plugin name, version, and destination directory. It will then determine the OS and system architecture, and it will download and install the appropriate package.

To configure the SQLite extension, load the extension module and then run the steampipe_configure_newrelic function to configure it with plugin-specific options.

$ sqlite3
sqlite> .load ./steampipe_sqlite_extension_newrelic.so
sqlite> select steampipe_configure_newrelic('<your_config>');

Export

This plugin is available as a standalone Export 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)" -- newrelic

You can pass the configuration to the command with the --config argument:

steampipe_export_newrelic --config '<your_config>' <table_name>