Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: newrelic/nri-flex
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.16.4
Choose a base ref
...
head repository: newrelic/nri-flex
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.16.5
Choose a head ref
  • 15 commits
  • 18 files changed
  • 5 contributors

Commits on Jan 9, 2025

  1. fix(deps): update module github.com/spf13/afero to v1.12.0

    renovate[bot] authored Jan 9, 2025
    Copy the full SHA
    da6a48a View commit details

Commits on Jan 15, 2025

  1. fix(deps): update module github.com/aws/aws-sdk-go to v1.55.6

    renovate[bot] authored Jan 15, 2025
    Copy the full SHA
    aef3a55 View commit details

Commits on Jan 16, 2025

  1. fix(deps): update module github.com/go-git/go-git/v5 to v5.13.1 (#540)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Jan 16, 2025
    Copy the full SHA
    10fe590 View commit details

Commits on Jan 17, 2025

  1. Integration to monitor windows scheduled task status and fetch histor…

    …y logs. (#544)
    SNGoutham authored Jan 17, 2025
    Copy the full SHA
    cf562f0 View commit details
  2. fix(deps): update module github.com/sijms/go-ora/v2 to v2.8.23

    renovate[bot] authored Jan 17, 2025
    Copy the full SHA
    e2d6826 View commit details

Commits on Jan 23, 2025

  1. fix(deps): update module github.com/go-git/go-git/v5 to v5.13.2

    renovate[bot] authored Jan 23, 2025
    Copy the full SHA
    bd6c468 View commit details

Commits on Mar 6, 2025

  1. ci: fix broken go1.22 download url for Dockerfile (#555)

    * update runner ubuntu version
        * go mod tidy to fix codeql checks
    
    Co-authored-by: Rohan Yadav <rohanyadav@newrelic.com>
    ujwalsah and rajrohanyadav authored Mar 6, 2025
    Copy the full SHA
    57a5ccc View commit details

Commits on Mar 12, 2025

  1. chore: bump Go version to 1.23 (#556)

    * chore: go version bump
    
    * deps: upgrade x/crypto package
    ujwalsah authored Mar 12, 2025
    Copy the full SHA
    d8d243f View commit details
  2. feat: GCP bq example (#557)

    * feat: GCP bq example
    
    * chore: add more example queries
    khpeet authored Mar 12, 2025
    Copy the full SHA
    4240388 View commit details
  3. fix(deps): update module github.com/newrelic-experimental/go-ase to v…

    …1.3.0 (#553)
    
    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Mar 12, 2025
    Copy the full SHA
    f0f003b View commit details
  4. fix(deps): update module github.com/go-sql-driver/mysql to v1.9.0 (#549)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Mar 12, 2025
    Copy the full SHA
    3746d44 View commit details
  5. fix(deps): update module github.com/sijms/go-ora/v2 to v2.8.24 (#551)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Mar 12, 2025
    Copy the full SHA
    324d292 View commit details
  6. fix(deps): update module github.com/pkg/sftp to v1.13.8

    renovate[bot] authored Mar 12, 2025
    Copy the full SHA
    0103d54 View commit details

Commits on Mar 13, 2025

  1. chore(deps): update dependency go to v1.24.1 (#558)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Mar 13, 2025
    Copy the full SHA
    481130d View commit details
  2. fix(deps): update module github.com/go-git/go-git/v5 to v5.14.0 (#554)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Mar 13, 2025
    Copy the full SHA
    17e042b View commit details
14 changes: 7 additions & 7 deletions .github/workflows/push_pr.yml
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ jobs:
test-nix:
strategy:
matrix:
os: [ ubuntu-20.04 ]
os: [ ubuntu-24.04 ]
name: Run unit tests in ${{matrix.os}}
runs-on: ${{matrix.os}}
steps:
@@ -43,7 +43,7 @@ jobs:

test-integration-nix:
name: Run integration tests
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v2
- name: Login to DockerHub
@@ -56,7 +56,7 @@ jobs:

snyk:
name: Run security checks via snyk
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v2
- name: Login to DockerHub
@@ -72,7 +72,7 @@ jobs:
test-windows:
strategy:
matrix:
go: [ '1.22' ]
go: [ '1.23' ]
os: [ windows-2022 ]
name: Run unit and integration tests in ${{matrix.os}} with go ${{matrix.go}}
runs-on: ${{matrix.os}}
@@ -94,7 +94,7 @@ jobs:
test-build:
name: Test binary compilation for all platforms:arch
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: checkout
uses: actions/checkout@v2
@@ -108,7 +108,7 @@ jobs:

test-e2e:
name: Run e2e tests
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v2
- name: Login to DockerHub
@@ -126,7 +126,7 @@ jobs:
finish:
name: Finish
needs: [ test-nix, test-windows ]
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ jobs:
test-nix:
strategy:
matrix:
os: [ ubuntu-20.04 ]
os: [ ubuntu-24.04 ]
name: Run unit tests in ${{matrix.os}}
runs-on: ${{matrix.os}}
steps:
@@ -40,7 +40,7 @@ jobs:

test-integration-nix:
name: Run integration tests
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v2
- name: Login to DockerHub
@@ -53,7 +53,7 @@ jobs:

snyk:
name: Run security checks via snyk
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v2
- name: Login to DockerHub
@@ -69,7 +69,7 @@ jobs:
test-windows:
strategy:
matrix:
go: [ '1.22' ]
go: [ '1.23' ]
os: [ windows-2019 ]
name: Run unit and integration tests in ${{matrix.os}} with go ${{matrix.go}}
runs-on: ${{matrix.os}}
@@ -93,7 +93,7 @@ jobs:
prerelease:
name: Build and release binaries
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
needs: [ test-nix, test-windows, snyk, test-integration-nix ]
steps:
- uses: actions/checkout@v2
@@ -115,7 +115,7 @@ jobs:
finish:
name: Finish
needs: [ prerelease ]
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ SRCDIR ?= .
BUILD_DIR ?= $(CURDIR)/bin
COVERAGE_FILE ?= coverage.out

GO_VERSION ?= 1.22
GO_VERSION ?= 1.23
GO_CMD ?= go
GODOC ?= godocdown

2 changes: 1 addition & 1 deletion build/Dockerfile
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
FROM ubuntu:16.04

# Define Go version
ARG GO_VERSION=1.22
ARG GO_VERSION=1.23
ARG ARCH='amd64'

# Install dependencies
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
services:
golang:
image: golang:1.22-bullseye
image: golang:1.23-bullseye
volumes:
- .:/go/src/github.com/newrelic/nri-flex
working_dir: /go/src/github.com/newrelic/nri-flex
44 changes: 44 additions & 0 deletions examples/GCP/BigQuery/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Big Query Flex Integration

This flex integration runs bq queries via GCP CLI and reports the output to New Relic. Most useful information is found under the [INFORMATION_SCHEMA](https://cloud.google.com/bigquery/docs/information-schema-intro) view.


## Pre-requirements
* [Infrastructure Agent](https://docs.newrelic.com/docs/infrastructure/infrastructure-agent/linux-installation/package-manager-install/) installed
* [GCP CLI](https://cloud.google.com/sdk/docs/install#linux) installed & configured on host running infrastructure agent
* [GCP Service Account](https://developers.google.com/identity/protocols/oauth2/service-account#creatinganaccount) created with json key file downloaded

Service account must have the following permissions:
* Bigquery.tables.get
* Bigquery.tables.list
* Bigquery.routines.get
* Bigquery.routines.list
* Bigquery.jobs.listAll



## Installation
1. Copy service account json key file to host running the integration
2. Copy `bq.yml` under `/etc/newrelic-infra/integrations.d`
3. Authenticate the CLI with the service account key file:

```bash
gcloud auth login --cred-file=/path/to/key.json
```

4. Run Flex manually **one time** with the `bq-auth` block uncommented. This will authenticate for all subsequent executions of the CLI via Flex.

```bash
[sudo] /opt/newrelic-infra/newrelic-integrations/bin/nri-flex --verbose --pretty --config_file bq.yml
```

Comment out the `bq-auth` block after this is done successfully.

5. [Restart the infrastructure agent](https://docs.newrelic.com/docs/infrastructure/infrastructure-agent/manage-your-agent/start-stop-restart-infrastructure-agent/)



## Configuration
The bq configuration requires the service account email, GCP project id, and region. These values are substituted dynamically into each bq CLI command ran, so any additional queries added can follow the same format as the examples provided.

Additionally, the polling interval can be set at the top (in seconds), and the `INSIGHTS*` environment variables can be used to remove all infrastructure agent metadata tacked onto each bq payload forwarded to New Relic. These are configured with an ingest key and an account id within the URL variable.
61 changes: 61 additions & 0 deletions examples/GCP/BigQuery/bq.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
integrations:
- name: nri-flex
interval: 300s
env:
## Uncomment these variables and set to remove all infrastructure agent metadata appended to data within NRDB
# INSIGHTS_API_KEY: <ingest_key>
# INSIGHTS_URL: https://insights-collector.newrelic.com/v1/accounts/<account_id>/events
EVENT_LIMIT: 100000
config:
name: gcp-bq-flex
variable_store:
service_account_email: service-account@project123.iam.gserviceaccount.com # Requred
project_id: my-project-id-123456 # Required
region: us # Required
apis:
## Initial authentication of service account - only required 1 time via running flex manually, otherwise comment out
# - name: bq-auth
# event_type: bq_auth
# ignore_output: true
# commands:
# - run: gcloud auth activate-service-account ${var:service_account_email} --key-file=/home/ubuntu/tmp/my-service-account.json
- name: bq-column
event_type: bq_table_column_count
commands:
- run: bq query --project_id=${var:project_id} --use_legacy_sql=false --quiet=true --format=json "SELECT table_name, COUNT(column_name) as column_count FROM \`${var:project_id}.region-${var:region}.INFORMATION_SCHEMA.COLUMNS\` GROUP BY table_Name"
timeout: 90000
- name: bq-table-storage
event_type: bq_table_stats
commands:
- run: bq query --project_id=${var:project_id} --use_legacy_sql=false --quiet=true --format=json "SELECT table_name, total_rows, total_partitions, total_logical_bytes, total_physical_bytes FROM \`${var:project_id}\`.\`region-${var:region}\`.INFORMATION_SCHEMA.TABLE_STORAGE"
timeout: 90000
- name: bq-table-ingest-rate
event_type: bq_table_ingest_rate
commands:
- run: bq query --project_id=${var:project_id} --use_legacy_sql=false --quiet=true --format=json "SELECT destination_table.table_id as table_name, COUNT(*) as ingest_rate, MAX(creation_time) as last_ingestion_time FROM \`region-${var:region}.INFORMATION_SCHEMA.JOBS\` where state='DONE' and job_type in ('LOAD', 'QUERY') GROUP BY table_name"
timeout: 90000
- name: bq-metrics-by-user
event_type: bq_job_metrics
commands:
- run: bq query --project_id=${var:project_id} --use_legacy_sql=false --quiet=true --format=json "SELECT user_email, COUNT(*) AS job_count, AVG(TIMESTAMP_DIFF(end_time, start_time, SECOND)) AS avg_duration_seconds, SUM(total_slot_ms) AS total_slot_usage, SUM(total_bytes_processed) AS total_bytes_processed FROM \`region-${var:region}\`.INFORMATION_SCHEMA.JOBS_BY_USER GROUP BY user_email"
timeout: 90000
- name: bq-metrics-by-dataset
event_type: bq_job_metrics
commands:
- run: bq query --project_id=${var:project_id} --use_legacy_sql=false --quiet=true --format=json "SELECT destination_table.project_id as project_id, destination_table.dataset_id as dataset_id, destination_table.table_id as table_id, COUNT(*) AS job_count, AVG(TIMESTAMP_DIFF(end_time, start_time, SECOND)) AS avg_duration_seconds, SUM(total_slot_ms) AS total_slot_usage, SUM(total_bytes_processed) AS total_bytes_processed FROM \`region-${var:region}\`.INFORMATION_SCHEMA.JOBS_BY_PROJECT GROUP BY project_id, dataset_id, table_id ORDER BY job_count DESC"
timeout: 90000
- name: bq-slot-usage-by-user-job
event_type: bq_slot_usage
commands:
- run: bq query --project_id=${var:project_id} --use_legacy_sql=false --quiet=true --format=json "SELECT job_id, user_email, total_bytes_processed, total_slot_ms FROM \`region-${var:region}\`.INFORMATION_SCHEMA.JOBS_BY_USER"
timeout: 90000
- name: bq-slowest-jobs
event_type: bq_slowest_jobs
commands:
- run: bq query --project_id=${var:project_id} --use_legacy_sql=false --quiet=true --format=json "SELECT job_id, user_email, TIMESTAMP_DIFF(end_time, start_time, SECOND) AS duration_seconds FROM \`region-${var:region}\`.INFORMATION_SCHEMA.JOBS_BY_USER ORDER BY duration_seconds DESC LIMIT 100"
timeout: 90000
- name: bq-job-failures
event_type: bq_job_failures
commands:
- run: bq query --project_id=${var:project_id} --use_legacy_sql=false --quiet=true --format=json "SELECT error_result.message AS error_message, COUNT(*) AS failure_count FROM \`region-${var:region}\`.INFORMATION_SCHEMA.JOBS_BY_USER WHERE error_result.message IS NOT NULL GROUP BY error_message ORDER BY failure_count DESC"
timeout: 90000
31 changes: 31 additions & 0 deletions examples/windows/windows-scheduled-task-monitor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
This integration monitors the windows scheduled tasks execution status and missed executions.

This integration contains two parts,
1. a flex based integration to gather execution status and missed executions and report as a custom event.
2. captures scheduled job history as windows event logs and report them to NR Log management solution.

Follow the below steps to configure this integration to monitor windows scheduled tasks:

Pre-requisites:
1. A new relic account
2. New relic infrastructure agent set up on the host
3. Power shell installed on the host
4. Task Scheduler history logs are enabled on the host (https://docs.nxlog.co/integrate/windows-task-scheduler.html)

Configure the integration
1. Copy below files to C:\Program Files\New Relic\newrelic-infra\integrations.d\ directory
a. WindowsScheduledTaskInfo.ps1
b. windows-scheduledtask-info-new.yml
2. Copy below files to C:\Program Files\New Relic\newrelic-infra\logging.d\ directory
a. winevt_taskscheduler_logs.yml

Configure Dashboard to view the data
1. Import below csv files as lookup tables
a. Refer to https://docs.newrelic.com/docs/logs/ui-data/lookup-tables-ui/
b. windows-event-log-level.csv with Table name as windows_event_log_level
c. windows-task-result-descriptions.csv with Table name as windows_scheduled_task_result_descriptions
2. Import Dashboard
a. open dashboard_windows_scheduled_task_oveview.json file in a text editor, and replace accountId 9999999 with the accountId, where you are importing this dashboard.
b. On New Relic UI, Navigate to Dashboards and click on “Import Dashboard”.
c. Copy the updated json content from the above step in the “Paste your json code” text box and click on the Import dashboard button.
d. Edit the dashboard created and update the default value for the Scheduled Task variable.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
$taskInfos = Get-ScheduledTask | Where-Object {
($_.TaskPath -notlike '\Microsoft\*' -and $_.TaskPath -ne '\')
} | ForEach-Object {
(Get-ScheduledTaskInfo -TaskName $_.TaskName -TaskPath $_.TaskPath | Select-Object -Property *,
@{Name='LastTaskResultHex'; Expression={'0x'+([System.Convert]::ToString($_.LastTaskResult,16)).ToUpper() }},
@{Name='LastRunTimeInMillis'; Expression={([int] (Get-Date $_.LastRunTime.ToUniversalTime() -UFormat '%s'))*1000}},
@{Name='NextRunTimeInMillis'; Expression={([int] (Get-Date $_.NextRunTime.ToUniversalTime() -UFormat '%s'))*1000}},
@{Name='TaskFullPath'; Expression={$_.TaskPath + $_.TaskName}},
@{Name='TaskFullPathStringLiteral'; Expression={'\' + $_.TaskPath + '\' + $_.TaskName}
} -ExcludeProperty PSComputerName, CimClass, CimInstanceProperties, CimSystemProperties, CimInstance)
} | ConvertTo-Json

Write-Output $taskInfos
Loading