OpsMatters Core

Java library for the opsmatters suite including a data cache for New Relic Monitoring and Alerting, models, and reporting utilities.

License

License

GroupId

GroupId

com.opsmatters
ArtifactId

ArtifactId

opsmatters-core
Last Version

Last Version

1.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

OpsMatters Core
Java library for the opsmatters suite including a data cache for New Relic Monitoring and Alerting, models, and reporting utilities.
Project URL

Project URL

https://github.com/opsmatters/opsmatters-core
Source Code Management

Source Code Management

https://github.com/opsmatters/opsmatters-core

Download opsmatters-core

How to add to project

<!-- https://jarcasting.com/artifacts/com.opsmatters/opsmatters-core/ -->
<dependency>
    <groupId>com.opsmatters</groupId>
    <artifactId>opsmatters-core</artifactId>
    <version>1.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.opsmatters/opsmatters-core/
implementation 'com.opsmatters:opsmatters-core:1.0.2'
// https://jarcasting.com/artifacts/com.opsmatters/opsmatters-core/
implementation ("com.opsmatters:opsmatters-core:1.0.2")
'com.opsmatters:opsmatters-core:jar:1.0.2'
<dependency org="com.opsmatters" name="opsmatters-core" rev="1.0.2">
  <artifact name="opsmatters-core" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.opsmatters', module='opsmatters-core', version='1.0.2')
)
libraryDependencies += "com.opsmatters" % "opsmatters-core" % "1.0.2"
[com.opsmatters/opsmatters-core "1.0.2"]

Dependencies

compile (7)

Group / Artifact Type Version
com.opsmatters : newrelic-api jar 1.0.11
org.docx4j : docx4j jar 3.3.6
net.sourceforge.jexcelapi : jxl jar 2.6.12
com.opencsv : opencsv jar 4.1
joda-time : joda-time jar 2.9.9
org.apache.commons : commons-lang3 jar 3.7
commons-codec : commons-codec jar 1.11

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

opsmatters

OpsMatters Core

Build Status Maven Central Javadocs

Java library for the opsmatters suite including a data cache for New Relic Monitoring and Alerting, models, and reporting utilities.

Examples

To obtain a New Relic cache instance containing all the static configuration:

NewRelicCache cache = NewRelicCache.builder()
    .apiKey("<YOUR_API_KEY>")
    .alerts(true)
    .apm(true)
    .mobile(true)
    .browser(true)
    .synthetics(true)
    .insights(true)
    .servers(true)
    .plugins(true)
    .infrastructure(true)
    .build();

Next, create a manager to synchronise the cache with New Relic by importing all resources for the enabled products:

ProviderManager manager = ProviderFactory.getManager(Provider.NEW_RELIC);
boolean success = manager.sync(cache);

Once the cache has been populated, it can be queried for the resources and collections it contains. Here are some examples:

  • To query the alert channels:
Collection<AlertChannel> channels = cache.alertChannels().list();
  • To query the alert policies:
Collection<AlertPolicy> policies = cache.alertPolicies().list();
  • To query the APM alert conditions for a particular alert policy:
Collection<AlertCondition> conditions = cache.alertPolicies().alertConditions(policy.getId()).list()
  • To query the Infrastructure alert conditions for a particular alert policy:
Collection<InfraAlertCondition> infraConditions = cache.alertPolicies().infraAlertConditions(policy.getId()).list()
  • To query the dashboards:
Collection<Dashboard> dashboards = cache.dashboards().list();

Prerequisites

A New Relic account with an Admin user. The user needs to generate an Admin API Key to provide read-write access via the New Relic REST APIs. The Admin API Key is referenced in the documentation as the parameter "YOUR_API_KEY".

Installing

First clone the repository using:

>$ git clone https://github.com/opsmatters/opsmatters-core.git
>$ cd opsmatters-core

To compile the source code, run all tests, and generate all artefacts (including sources, javadoc, etc):

mvn package 

Running the tests

To execute the unit tests:

mvn clean test 

The following tests are included:

  • ProviderTest: Creates a full NewRelicCache with all the available configuration items and then creates some test reports for the objects in a variety of formats.

Deployment

The build artefacts are hosted in The Maven Central Repository.

Add the following dependency to include the artefact within your project:

<dependency>
  <groupId>com.opsmatters</groupId>
  <artifactId>opsmatters-core</artifactId>
  <version>1.0.2</version>
</dependency>

Built With

  • newrelic-api - Java client library for the New Relic Monitoring and Alerting REST APIs
  • docx4j - Java library for creating and manipulating Microsoft Open XML files
  • jxl - Java API enabling developers to read, write, and modify Excel spreadsheets
  • opencsv - CSV parser library for Java
  • Maven - Dependency Management
  • JUnit - Unit testing framework

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

This project use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the terms of the Apache license 2.0.

Copyright (c) 2018 opsmatters

com.opsmatters

OpsMatters

The Source for News & Information on Operational Applications & Tools

Versions

Version
1.0.2
1.0.1
1.0.0
0.9.0
0.8.0
0.7.0
0.6.0
0.5.0
0.4.0
0.3.0
0.2.0
0.1.0