Grafana

https://www.claudiokuenzler.com/blog/749/icinga2-graphing-influxdb-grafana#.W19_ddJKg2x

Install:

 apt-get install grafana grafana-data
 netstat -lntup | grep grafana

Configuration:

/etc/grafana/grafana.ini

protocol = https
domain = mydnsname.local
cert_file = /etc/grafana/mydnsname.local.crt
cert_key = /etc/grafana/mydnsname.local.key

Influx DB

Install:

apt-get install influxdb influxdb-client 
netstat -lntup | grep influx

Configuration:

/etc/influxdb/influxdb.conf
/var/lib/influxdb/

Configuration to work with Icinga2:

/etc/icinga2/features-enabled/influxdb.conf

Example:

object InfluxdbWriter "influxdb" {
  host = "127.0.0.1"
  port = 8086
  database = "icinga2"
  username = "icinga2"
  password = "icinga2"
  host_template = {
    measurement = "$host.check_command$"
    tags = {
      hostname = "$host.name$"
    }
  }
  service_template = {
    measurement = "$service.check_command$"
    tags = {
      hostname = "$host.name$"
      service = "$service.name$"
    }
  }
}

Check also

https://grafana.com/grafana/dashboards/381

RETENTION POLICY

SHOW RETENTION POLICIES
CREATE RETENTION POLICY "8weeks" ON "icinga2" DURATION 8w REPLICATION 1 default
SHOW RETENTION POLICIES ON "icinga2"
DROP RETENTION POLICY "default" ON "icinga2"

commands

create database icinga2;
CREATE USER icinga2 WITH PASSWORD 'secret'
GRANT ALL ON icinga2 TO icinga2
SHOW GRANTS FOR icinga2
use icinga2
select * from "P3/SENSOR"
select * from "P3/SENSOR" where time > '2021-02-23'
DROP MEASUREMENT "P3/SENSOR"
DROP MEASUREMENT "ping4"
show MEASUREMENTS
show series
show SERVERS
show tag keys from ping4
influxd version
exit

shell commands

influx -database nodered -execute 'show MEASUREMENTS'
influx -database nodered -execute 'DROP MEASUREMENT "sensorname/topic"'  
influx -precision rfc3339 -database nodered -execute 'select * from "P3/SENSOR"'                   #show entries with readable timestamp format

Backup & Recovery

influxd backup -portable -database mydatabase -host <remote-node-IP>:8088 /tmp/backup_mydatabase    #          
influxd backup -portable /tmp/backup_ex                                                             #To backup all databases
influxd restore -portable /tmp/backup_ex                                                            #To restore the backup
monitoring/grafana.txt · Last modified: 2024/11/08 20:35 by tmade
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 4.0 International
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki