Skip to content

Instantly share code, notes, and snippets.

@gspncr
gspncr / check-nr-jenking.py
Created May 26, 2021 13:49
Check NR with a query, if conditions are met, run a Jenkins or other API call
import requests, json
graphQLEndpoint = 'https://api.newrelic.com/graphql'
APIKey = '<Your-NRAK-Key>'
# check New Relic for the stock status
def checkNewRelic():
# set headers for the request
headers = {
"Content-Type": 'application/json',
@gspncr
gspncr / multipleQueries.py
Created May 20, 2021 08:37
Multiple NR Queries to CSV
import requests, json, csv, re, os.path
graphQLEndpoint = 'https://api.newrelic.com/graphql'
#graphQLEndpoint = 'https://api.eu.newrelic.com/graphql'
APIKey = 'NRAK-xxxx'
headers = {"Content-Type": 'application/json',"API-Key": APIKey}
def getAccounts():
query = """
{
@gspncr
gspncr / nrdgrph.py
Last active March 31, 2021 09:52
run new relic nerdgraph query
import requests, json, csv
graphQLEndpoint = 'https://api.newrelic.com/graphql'
#graphQLEndpoint = 'https://api.eu.newrelic.com/graphql'
APIKey = '<NRAK Key>'
headers = {
"Content-Type": 'application/json',
"API-Key": APIKey
}
@gspncr
gspncr / rageClick.js
Last active March 24, 2021 10:22
rage click detection
let lastClick = 0;
let secondLastClick = 0;
let totalClicks = 0;
let target = null;
let clickedObject = null;
var rageThreshold = 6;
function clickCounter(event){
totalClicks++
if (totalClicks > rageThreshold){
totalClicks = 0;
@gspncr
gspncr / appList.csv
Created February 25, 2021 11:25
fetch-nr-apps.py
ID Name
876990294 Application name is required.
516776661 Blog Prod
968623920 MyDotNetApp
887470292 Node Workshop
305164720 staging-blog
781875136 tic tac toe
968641669 windowshit
@gspncr
gspncr / accountList.csv
Last active February 25, 2021 10:08
fetch-NR-accounts.py
ID Name
1147177 gspncr
2267296 New Relic_1389
3065959 k6-playground
@gspncr
gspncr / new-relic-terraform.md
Last active November 29, 2023 07:27
New Relic Terraform step by step

New Relic Terraform Provider step by step

# Configure terraform
terraform {
  required_version = "~> 0.14.0"
  required_providers {
    newrelic = {
      source  = "newrelic/newrelic"
      version = "~> 2.9.0"
@gspncr
gspncr / intro.md
Last active January 24, 2021 14:48
nerdpack demo

NR1 Programmability Demo

inspired by Lew's demo at AWS re:Invent 2020 because that was ✨awesome✨ and building on it.

Intro

Thanks for joining. Most of you will know New Relic perhaps for our Observability platform, for APM, but you might not know that you can build applications right on top of of our platform to make the most out of the telemetry that we collect. You can do this using the very same API's and components that our developers themselves use to build our products views.

So in this demo I am going to build an application in New Relic from scratch.

@gspncr
gspncr / _webinar-links.md
Last active December 28, 2022 16:02
new relic x k6 test