Plugins 〉PNP
PNP
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
- $tag_perflabel: same as label
All standard variables will also do.
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$/
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 Cloud Free
- Free tier: Limited to 3 users
- Paid plans: $55 / user / month above included usage
- Access to all Enterprise Plugins
- Fully managed service (not available to self-manage)
Self-hosted Grafana Enterprise
- Access to all Enterprise plugins
- All Grafana Enterprise features
- Self-manage on your own infrastructure
Grafana Cloud Free
- Free tier: Limited to 3 users
- Paid plans: $55 / user / month above included usage
- Access to all Enterprise Plugins
- Fully managed service (not available to self-manage)
Self-hosted Grafana Enterprise
- Access to all Enterprise plugins
- All Grafana Enterprise features
- Self-manage on your own infrastructure
Grafana Cloud Free
.h4 . .mb-0 }
- Free tier: Limited to 3 users
- Paid plans: $55 / user / month above included usage
- Access to all Enterprise Plugins
- Fully managed service (not available to self-manage)
Self-hosted Grafana Enterprise
- Access to all Enterprise plugins
- All Grafana Enterprise features
- Self-manage on your own infrastructure
Grafana Cloud Free
- Free tier: Limited to 3 users
- Paid plans: $55 / user / month above included usage
- Access to all Enterprise Plugins
- Fully managed service (not available to self-manage)
Self-hosted Grafana Enterprise
- Access to all Enterprise plugins
- All Grafana Enterprise features
- Self-manage on your own infrastructure
Grafana Cloud Free
- Free tier: Limited to 3 users
- Paid plans: $55 / user / month above included usage
- Access to all Enterprise Plugins
- Fully managed service (not available to self-manage)
Self-hosted Grafana Enterprise
- Access to all Enterprise plugins
- All Grafana Enterprise features
- Self-manage on your own infrastructure
Installing PNP on Grafana Cloud:
Installing plugins on a Grafana Cloud instance is a one-click install; same with updates. Cool, right?
Note that it could take up to 1 minute to see the plugin show up in your Grafana.
Installing plugins on a Grafana Cloud instance is a one-click install; same with updates. Cool, right?
Note that it could take up to 1 minute to see the plugin show up in your Grafana.
Installing plugins on a Grafana Cloud instance is a one-click install; same with updates. Cool, right?
Note that it could take up to 1 minute to see the plugin show up in your Grafana.
Installing plugins on a Grafana Cloud instance is a one-click install; same with updates. Cool, right?
Note that it could take up to 1 minute to see the plugin show up in your Grafana.
Installing plugins on a Grafana Cloud instance is a one-click install; same with updates. Cool, right?
Note that it could take up to 1 minute to see the plugin show up in your Grafana.
Installing plugins on a Grafana Cloud instance is a one-click install; same with updates. Cool, right?
Note that it could take up to 1 minute to see the plugin show up in your Grafana.
Installing plugins on a Grafana Cloud instance is a one-click install; same with updates. Cool, right?
Note that it could take up to 1 minute to see the plugin show up in your Grafana.
For more information, visit the docs on plugin installation.
Installing on a local Grafana:
For local instances, plugins are installed and updated via a simple CLI command. Plugins are not updated automatically, however you will be notified when updates are available right within your Grafana.
1. Install the Data Source
Use the grafana-cli tool to install PNP from the commandline:
grafana-cli plugins install
The plugin will be installed into your grafana plugins directory; the default is /var/lib/grafana/plugins. More information on the cli tool.
Alternatively, you can manually download the .zip file for your architecture below and unpack it into your grafana plugins directory.
Alternatively, you can manually download the .zip file and unpack it into your grafana plugins directory.
2. Configure the Data Source
Accessed from the Grafana main menu, newly installed data sources can be added immediately within the Data Sources section.
Next, click the Add data source button in the upper right. The data source will be available for selection in the Type select box.
To see a list of installed data sources, click the Plugins item in the main menu. Both core data sources and installed data sources will appear.
Changelog
2.0.2 2023-05-30 - fix using factor - fix using variables in query editor suggestions - fix using variables to repeat rows - replace All with .* in multi-option dropdowns - make query editor input fields clearable
2.0.1 2022-11-18 - fix label query - improve error reporting when editing template queries
2.0.0 2022-09-26 - rebuild with react for grafana 9
1.0.8 2021-01-04 - sign plugin - switch package builds to yarn
1.0.7 2020-09-11 - improve packaging
1.0.6 2020-06-29 - improve datasource error details - fix plugin beeing loaded twice (#17) - fix dashboard export
1.0.5 2017-11-20 - fix template query parsing
1.0.4 2017-09-29 - add mathematical factor option - fix template variables with latest grafana 4.5.2 - fix replacing template variables in repeated panels
1.0.3 2017-08-18 - add support for host / service / label templating variables
1.0.2 2017-08-16 - add support for warning / critical thresholds - fix accesing series containing spaces
1.0.1 2017-03-13 - plugin id changed according to guidelines - add fallback to pnp name if label does not exist
1.0.0 2017-03-02 - inital release