go-nrutil

command module
v0.1.0-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2019 License: Apache-2.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-nrutil

release Go Report Card

New Relic utility

Cli to read and write Synthetics scripts to local files. It's main purpose is to make it easier to store Synthetics scripts in source control.

Shout-out and Thank You

A thank you to the great Go community and the individuals and groups who provide and maintain the libraries we use! We really appreciate all your efforts.

Modules used in this project:

  • Mow.Cli - A versatile library for building CLI applications in Go
  • go-homedir - Go library for detecting and expanding the user's home directory without cgo.
    • github.com/mitchellh/go-homedir
  • go-yaml - YAML support for the Go language.
  • Termtables - Go ASCII Table Generator, ported from the Ruby terminal-tables library
    • github.com/apcera/termtables
    • github.com/brettski/go-termtables
      • Apcera deleted termtables from GitHub so I restored the repo for others to use

Usage

nrutil is a single executable cli which synchronizes New Relic Synthetics scripted-typed checks with a local file system. This allows you to manage these scripts in some type of source control (e.g. Git). New Relic Synthetics itself has no observance of version history, etc.

nrutil has inline help. Add -h to any command to get details about it. E.g. nrutil getmonitorlist -h

nrutil requires a configuration file in your $HOME directory (C:\Users\me, ~/, etc.). You can create this file by running:

nrutil config create -nradminkey <Your New Relic Admin Key>

The configuration file manages the following data:

---
nradminkey: <your-admin-key>
basepath: ~/nrsynthetics
syntheticmonitors
- guid-of-monitor-1-23456
- guid-of-monitor-2-34567
- guid-of-monitor-n-opqrs
  • nradminkey - The admin API key from New Relic. Per NR: "You must use your Admin User's API key to make Synthetics REST API calls. The account's REST API key will not work."
  • basepath - The base path to store the synthetic scripts.
  • syntheticmonitors - (not yet implemented) A list of monitors the cli is managing.

In this early stage of nrutil, the list of managed Synthetics isn't implemented. You can however manage Synthetic monitors individually:

nrutil getscript --id <Synthetics guid id>
nrutil setscript --id <Synthetics guid id>

These commands will store the file in the basepath set in the configuration file allowing you to manage them in any source control.

Add any questions or bugs discovered in the GitHub Issue Tracker

Short-term Roadmap

  • Option to add Synthetics api and scripted test id's to configuration file
  • Pull scripts based on id's to local folders
  • Push scripts based on id's to New Relic
  • Use correct home folder location when creating configuration file. Currently uses default ~/

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package nrrequest generates our default http client for making requests
Package nrrequest generates our default http client for making requests
Package synthetics used for interacting with synthetics api Performs work to get script from API.
Package synthetics used for interacting with synthetics api Performs work to get script from API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址