18
0
Fork 0
wiki/HowtoInfluxDB.md

5.5 KiB

collectd

USE collectd Using database collectd SHOW MEASUREMENTS name: measurements name


cpu_value disk_value load_longterm load_midterm load_shortterm snmp_rx snmp_tx tcpconns_value

SELECT * FROM snmp_rx,snmp_tx LIMIT 5 name: snmp_rx time host type type_instance value


1527610980434511472 Switch if_packets machine A 4241766500 1527611039463879536 Switch if_octets machine B 9414616763688 1527611039463903506 Switch if_octets machine C 59780133577 1527611039463953500 Switch if_octets machine D 109232798624 1527611039556165882 Switch if_packets machine B 7925165702

name: snmp_tx time host type type_instance value


1527610980434511472 Switch if_packets machine A 11434830808 1527611039463879536 Switch if_octets machine B 174654547558 1527611039463903506 Switch if_octets machine C 135392659943 1527611039463953500 Switch if_octets machine D 9179809568001 1527611039556165882 Switch if_packets machine B 396998647


### Supprimer des mesures

On peut vouloir supprimer une mesure particulière, par exemple dans le cas où une machine n'est plus sur le switch :

SHOW SERIES FROM snmp_rx,snmp_tx WHERE type_instance='machine A' key


snmp_rx,host=Switch,type=if_octets,type_instance=machine\ A snmp_rx,host=Switch,type=if_packets,type_instance=machine\ A snmp_tx,host=Switch,type=if_octets,type_instance=machine\ A snmp_tx,host=Switch,type=if_packets,type_instance=machine\ A

DROP SERIES FROM snmp_rx,snmp_tx WHERE type_instance='machine A'


### Rétention

Par défaut, les données sont gardées sur une durée illimitée, et l'intervalle de vérification de la rétention est de 30 minutes.

Si on ne souhaite pas utiliser la rétention, on peut la désactiver :

[retention]

Determines whether retention policy enforcement enabled.

enabled = false


Si au contraire, on veut avoir une rétention d'un an, il faut modifier la politique :

influx

use collectd SHOW RETENTION POLICIES name duration shardGroupDuration replicaN default


autogen 0s 168h0m0s 1 true

ALTER RETENTION POLICY "autogen" ON "collectd" DURATION 52w REPLICATION 1 DEFAULT SHOW RETENTION POLICIES name duration shardGroupDuration replicaN default


autogen 8736h0m0s 168h0m0s 1 true


Et on peut augmenter l'intervalle de vérification de la rétention :

[retention]

Determines whether retention policy enforcement enabled.

enabled = false

The interval of time when retention policy enforcement checks run.

check-interval = "24h"