Skip to content

Instantly share code, notes, and snippets.

@gspncr
gspncr / tomcat.conf
Created October 27, 2019 18:38
tomcat.conf for New Relic Partner Enablement
server {
listen 80;
listen[::]: 80;
server_name INSTANCE_PUBLIC_IP;
location / {
proxy_pass http: //localhost:8080/;
}
}
@gspncr
gspncr / post-monitor-to-postman.json
Created October 27, 2019 18:49
New Relic Partner enablement - post monitor to json
https://synthetics.newrelic.com/synthetics/api/v3/monitors
Header:
X-Api-Key {{apiKey}}
Content-Type application/json
Body:
{
"name": "Gary Homepage",
"type": "SIMPLE",
"frequency": 30,
"uri": "https://my-lab-4-hostname.com:8080/wordpress/",
@gspncr
gspncr / post-monitor-to-cURL.json
Created October 27, 2019 18:50
New Relic Partner Enablement to cURL
POST /synthetics/api/v3/monitors HTTP/1.1
Host: synthetics.newrelic.com
X-Api-Key: {{apiKey}}
Content-Type: application/json
{
"name": "Gary Homepage",
"type": "SIMPLE",
"frequency": 30,
"uri": "https://my-lab-4-hostname.com:8080/wordpress/",
"locations": ["AWS_US_WEST_1","AWS_EU_WEST_2"],
@gspncr
gspncr / .new-relic-insights-workshop.md
Last active October 29, 2019 12:09
New Relic Insights Workshop

Welcome to the New Relic Insights workshop!

Below are the code snippets that we will use while we are going through the workshop. You can watch, follow along, or come back to these later (the gist is public).

Questions?

The best place for questions is the New Relic Explorers Hub, but if you have questions on the workshop you can drop me a line or pop a question below if you are happy for it to be public and is workshop related 🤓

Contents

Custom Attributes with APM

@gspncr
gspncr / food-agency-new-relic-synthetics.js
Created October 30, 2019 11:18
New Relic Synthetics script to check for new food allergy alerts
var parseString = require('xml2js').parseString;
var $http = require('request');
// Get the New Relic status RSS feed
$http.get('https://www.food.gov.uk/rss-feed/alerts-allergy', function(err, response, body) {
parseString(body, function(err, result){
// Parse the RSS, and get the latest incident
var latestIncident = result.rss.channel[0].item[0];
// Push the incident details to Insights
@gspncr
gspncr / findGuids.py
Last active August 6, 2020 14:26
New Relic NerdGraph GUID Lookup
import requests, json
graphQLEndpoint = 'https://api.newrelic.com/graphql'
#graphQLEndpoint = 'https://api.eu.newrelic.com/graphql'
APIKey = '<your key here>'
headers = {
"Content-Type": 'application/json',
"API-Key": APIKey
}
@gspncr
gspncr / td-agent.conf
Created October 7, 2019 14:15
An example td-agent.conf file for you to use with New Relic Logs. My example source is for Tomcat, but you can use whatever your source is :)
<source>
@type tail
path /opt/apache-tomcat-8.5.5/logs/catalina.out
pos_file /var/log/catalina.log.pos
tag webportal
<parse>
@type none
</parse>
</source>
{
"dashboard": {
"metadata": { "version": 1 },
"title": "k6 Sample Dashboard",
"icon": "line-chart",
"visibility": "all",
"editable": "editable_by_all",
"filter": null,
"widgets": [
{
@gspncr
gspncr / apache-v2-integrations.yml
Last active September 28, 2020 10:03
new relic nri-apache version 2 integration example for multiple apache instances.
integrations:
- name: apache-server-metrics
integration_name: com.newrelic.apache
command: metrics
arguments:
status_url: http://127.0.0.1:90/server-status?auto
remote_monitoring: true
labels:
env: production
role: load_balancer
@gspncr
gspncr / new-relic-snmp-demo.md
Last active October 1, 2020 17:49
New Relic 💙 SNMP

Demo SNMP and New Relic Setup

Assumptions: Ubuntu 18 and New Relic Infra already installed.

Install SNMP, SNMP daemon, optionally mibs downloader

sudo apt install snmpd snmp snmp-mibs-downloader

Replace snmpd.conf with contents of below file. Really we are just commenting out line 15 and uncommenting line 17. Adding line 64 and line 185.