DevProjects/Newts

From OpenNMS
Jump to navigation Jump to search

Warning.png Page has moved

The initial development for this project has been completed project and this page is only kept here as a reference. Please refer to the documentation associated with your release for installation and usage notes.

Newts Integration

Newts-logo.png

Overview

Newts is a time-series data store based on Apache Cassandra.

The Newts integration branch contains an implementation of the Newts persistence strategy, that can be used an an alternative to JRobin or RRDtool.

This branch was developed for in order to:

  1. Identify the changes required in the OpenNMS code based to accommodate alternative persistence strategies
    Many of these changes have already been merged into develop for 17.0.0, however some still remain. See #Known_issues bellow
  2. Identify the changes required in the Newts code base
  3. Perform functional and non-functional testing

Source Code

The OpenNMS integration is available in the features/newts branch.

The bulk of the code lives in the opennms-rrd/opennms-rrd-newts folder.

Getting started

Here is a guide to get OpenNMS and Newts up and running if you're interested in trying it for yourself.

Setup OpenNMS (from the features/newts branch)

Download pre-compiled packages for your system, or try building this branch from source.

On Debian:

deb http://debian.opennms.org branches/features-newts main

On Redhat/Fedora:

http://yum.opennms.org/branches/features-newts/common

Setup Cassandra

This solution does not require to have the Newts service running. It does however require a Cassandra instance (or cluster) initialized with the newts keyspace.

You can follow the instructions in the Newts Wiki or use the Vagrant box.

Before continuing, make sure you are able to login to Cassandra via cqlsh and issue the following:

use newts;
describe table terms;
describe table samples;

Configure OpenNMS

Once you have both OpenNMS and Cassandra up and running, make the following changes to the OpenNMS configuration files to enable the Newts integration.

Set the following properties in etc/opennms.properties:

org.opennms.rrd.storeByGroup=true
org.opennms.rrd.storeByForeignSource=true
org.opennms.timeseries.strategy=newts
org.opennms.newts.config.hostname=$ipaddress$
org.opennms.newts.config.keyspace=newts
org.opennms.newts.config.port=9042

Restart OpenNMS.

NOTE: Due to system performance-affecting reasons, it is highly recommended to disable Statsd in service-configuration.xml for Newts deployment of any size.

How it works

Here we assume that you are already familiar with the Newts Data Model.

Resource IDs

The Newts strategy mimics the existing resource tree by mapping file system paths to resource ids.

For example, metrics that were traditionally stored in stored in:

/opt/opennms/share/rrd/snmp/fs/NODES/1424038123222/opennms-jvm/FreeMemory.rrd

are now stored in:

snmp:fs:nodes:1424038123222:opennms-jvm:FreeMemory

While this makes the transition easier, it may not be the ideal way to structure resources going forward.

Optimizations

Remove unused data collection groups

Data collection groups (maintained in etc/datacollection/) may contain one or more resource type definitions. When determining which resources are present on a given node, the resource provider must verify whether or not resources of every type are present. The more types there are, the longer this process takes.

In order to speed up resource look-ups, references to unused data collection packages should be removed from the etc/datacollection-config.xml, and their corresponding files removed from etc/datacollection/. The last part, removing them from etc/datacollection, will no longer be necessary once NMS-7816 is fixed.

Useful commands

Cluster status

nodetool status

Exporting samples to CSV

cqlsh> USE newts;
cqlsh:newts> COPY samples (partition, resource, collected_at, metric_name, attributes, value) TO 'samples.csv';

Importing samples from CSV

cqlsh> USE newts;
cqlsh:newts> COPY samples (partition, resource, collected_at, metric_name, attributes, value) FROM 'samples.csv';

Updating the replication factor

cqlsh> ALTER KEYSPACE newts WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 2 };

Remaining tasks

Add support for monitoring Cassandra clusters to OpenNMS
Evaluate service polling, JMX data collection and any relevant event source
Provide a utility within the OpenNMS root for setting up the key space
The utility should use the configured properties for communicating with Cassandra
Provide a utility for migrating existing .jrb or .rrd metrics to Newts
The https://github.com/opennms-forge/jrobin-to-rrdtool-converter could be a good starting point
Create a Newts data source for Grafana
The data source should interface via the ReST API provided by Newts, allowing us to inspect the data independently of OpenNMS
Expose the MetricRegistry used in the Newts APIs via JMX
Newts uses Dropwizard Metrics for keeping track of internal statistics (i.e. cache hits, number of queries, etc..)

Known issues

  • Statsd does not work
  • Graphs in Jasper reports do not work