2017-01-26 8 views
0

Nous avons un environnement de test avec collectd et InfluxDB sur la même machine. Tout fonctionne bien jusqu'à ce que nous ajoutions un plugin Python Collectd. Lorsqu'un plug-in Python expédie les valeurs suivantes nous obtenons le journal des erreurs de InfluxDB:InfluxDB: collectd Erreur d'analyse: service de données non valide = collectd

Jan 26 10:00:24 influxdb influxd: [I] 2017-01-26T09:00:24Z Collectd parse error: invalid data service=collect 

Notre configuration: collectd 5.6 InfluxDB 1.2.

collectd Python config plugin:

<LoadPlugin python> 
    Globals true 
</LoadPlugin> 

<Plugin python> 
    ModulePath "/opt/python-collectd" 
    LogTraces true 
    Interactive false 
    Import "randomtest" 
</Plugin> 

collectd config réseau:

LoadPlugin network 

<Plugin network> 
     Server "localhost" "25826" 
</Plugin> 

Source de "randomtest"

import collectd 
import random  

def configer(confObj): 
    collectd.info('config called') 

def init_fun(): 
    collectd.info('init called') 

def reader(input_data=None): 
     value = collectd.Values() 
     value.plugin = 'test_plugin' 
     value.host = 'test-host' 
     value.interval = 10 
     value.type = 'absolute' 
     value.type_instance = 'test' 
     value.values = [random.randint(0,10)] 
     value.dispatch()  

collectd.register_config(configer) 
collectd.register_init(init_fun) 
collectd.register_read(reader) 

InfluxDB collectd config:

[[collectd]] 
    enabled = true 
    bind-address = ":25826" 
    database = "collectd" 
    retention-policy = "" 
    typesdb = "/usr/share/collectd/types.db" 

    # These next lines control how batching works. You should have this enabled 
    # otherwise you could get dropped metrics or poor performance. Batching 
    # will buffer points in memory if you have many coming in. 

    # Flush if this many points get buffered 
    batch-size = 5000 

    # Number of batches that may be pending in memory 
    batch-pending = 10 

    # Flush at least this often even if we haven't hit buffer limit 
    batch-timeout = "10s" 

    # UDP Read buffer size, 0 means OS default. UDP listener will fail if set above OS max. 
    read-buffer = 0 

Juste pour préciser: Si je commente l'importation « randomtest » dans le tout config python collectd semble bien fonctionner à nouveau. Nous avons également examiné tcpdumps mais nous n'avons pas pu constater de différence entre les plugins Python Collectd et les autres plugins Collectd.

Répondre