Coder Social home page Coder Social logo

gregger83 / grafana-pnp-datasource Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sni/grafana-pnp-datasource

0.0 0.0 0.0 2.71 MB

PNP4Nagios/RRD Datasource for Grafana

License: MIT License

JavaScript 2.17% TypeScript 89.14% Makefile 8.70%

grafana-pnp-datasource's Introduction

PNP Grafana Datasource - a Grafana backend datasource using PNP4Nagios to access RRD files

Installation

Search for pnp in the Grafana plugins directory or simply use the grafana-cli command:

%> grafana-cli plugins install sni-pnp-datasource

Also OMD-Labs comes with this datasource included, so if you use OMD-Labs, everything is setup already.

Otherwise follow these steps:

%> cd var/grafana/plugins
%> git clone -b release-1.0.7  https://github.com/sni/grafana-pnp-datasource.git
%> restart grafana

Replace release-1.0.7 with the last available release branch.

PNP API

In order to make this datasource work, you need the pnp api. This is a separate project at the moment and will be part of the official pnp in the future. You can fetch the api.php from https://github.com/lingej/pnp-metrics-api and place it in your controler folder.

In a standard PNP setup, you could basically just download the api directly into the controller folder with a simple wget:

wget "https://github.com/lingej/pnp-metrics-api/raw/master/application/controller/api.php" \
     -O /usr/share/pnp4nagios/html/application/controllers/api.php

Adjust the output path to your installation.

Create Datasource

Add a new datasource and select:

- Type 'PNP'
- Url to pnp, ex.: 'https://localhost/sitename/pnp4nagios'

Example Dashboard

This datasource ships an example dashboard which gets you started and shows the internal PNP statistics.

Queries

Simply select host, service and label in the query editor. Regular expressions are supported in the host and service field by adding slashes like /.*/.

Variables

You may use the following variables in the alias field

- $tag_host: will be replaced with the hostname
- $tag_service: will be replaced with the service name
- $tag_label: will be replaced with the label

Templating

There is basic templating variable support. There are 3 different querys available:

- $host:    hosts
- $service: services where host = /^$host$/
- $label:   labels where host = /^$host$/ and service = /^$service$/

host variables examples

Development

To test and improve the plugin you can run Grafana instance in Docker using following command (in the source directory of this plugin):

%> make grafanadev

This will expose local plugin from your machine to Grafana container. Now run make buildwatch to compile dist directory and start changes watcher:

%> make buildwatch

Create Release

How to create a new release:

%> export RELVERSION=1.0.9
%> export GRAFANA_API_KEY=...
%> vi package.json # replace version
%> vi CHANGELOG.md # add changelog entry
%> git commit -am "Release v${RELVERSION}"
%> git tag -a v${RELVERSION} -m "Create release tag v${RELVERSION}"
%> make GRAFANA_API_KEY=${GRAFANA_API_KEY} clean releasebuild
# upload zip somewhere and validate on https://plugin-validator.grafana.net/
# create release here https://github.com/sni/grafana-pnp-datasource/releases/new
# submit plugin update here https://grafana.com/orgs/sni/plugins

Changelog

see CHANGELOG.md

grafana-pnp-datasource's People

Contributors

sni avatar dependabot[bot] avatar gregger83 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.