Griesbacher / nagflux

A connector which copies performancedata from Nagios / Icinga(2) / Naemon to InfluxDB
GNU General Public License v2.0
66 stars 32 forks source link
golang grafana icinga influxdb livestatus naemon nagios omd

GoDoc Go Report Card Circle CI Coverage Status

Nagflux

A connector which transforms performancedata from Nagios/Icinga(2)/Naemon to InfluxDB/Elasticsearch

Nagflux collects data from the NagiosSpoolfileFolder and adds informations from Livestatus. This data is sent to an InfluxDB, to get displayed by Grafana. Therefor is the tool Histou gives you the possibility to add Templates to Grafana.

Nagflux can be seen as the process_perfdata.pl script from PNP4Nagios.

Dependencies

Golang 1.5+

Install

go get -u github.com/griesbacher/nagflux
go build github.com/griesbacher/nagflux

A x86-64 Linux binary will be added to the releases. Here the link to the latest Release.

Configure

Here are some of the important config-options:

Section Config-Key Meaning
main NagiosSpoolfileFolder This is the folder where nagios/icinga writes its spoolfiles. Icinga2: /var/spool/icinga2/perfdata
main NagfluxSpoolfileFolder In this folder you can dump files with InfluxDBs linequery syntax, the will be shipped to the InfluxDB, the timestamp has to be in ms
main FieldSeperator This char is used to separate the logical parts of the tablenames. This char has to be an char which is not allowed in one of those: host-, servicename, command, perfdata
main FileBufferSize This is the size of the buffer which is used to read files from disk, if you have huge checks or a lot of them you maybe recive error messages that your buffer is too small and that's the point to change it
Log MinSeverity INFO is default an enough for the most. DEBUG give you a lot more data but it's mostly just spamming
InfluxDBGlobal Version Currentliy the only supported Version of InfluxDB is 0.9+
Influx "name" Address The URL of the InfluxDB-API
Influx "name" Arguments Here you can set your user name and password as well as the database. The precision has to be ms!
Influx "name" NastyString/NastyStringToReplace These keys are to avoid a bug in InfluxDB and should disappear when the bug is fixed
Influx "name" StopPullingDataIfDown This is used to tell Nagflux, if this Influxdb is down to stop reading new data. That's useful if you're using spoolfiles. But if you're using gearman set this always to false because by default gearman will not buffer the data endlessly

Start

If the configfile is in the same folder as the executable:

./nagflux

else:

./nagflux -configPath=/path/to/config.gcfg

Debugging

Dataflow

There are basically two ways for Nagflux to receive data:

Targets can be:

Dataflow Image

OMD

Nagflux is fully integrated in OMD-Labs, as well as Histou is. Therefor if you wanna try it out, it's maybe easier to install OMD-Labs.

Perfdata Template

Nagflux supports a couple of Perfdata templates (see main_test.go for some supported formats). By default it assumes you have the OMD formattemplate. If you are setting this up manually (not using OMD) please ensure your perfdata template is as follows:

Host

DATATYPE::HOSTPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tHOSTPERFDATA::$HOSTPERFDATA$\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$

Service

DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$

If you are using Nagios the default templates will not work. Use the above templates with config host_perfdata_file_template and service_perfdata_file_template, respectively.

DEMO

This Dockercontainer contains OMD and everything is preconfigured to use Nagflux/Histou/Grafana/InfluxDB: https://github.com/Griesbacher/docker-omd-grafana

Presentations