@@ -0,0 +1,1872 @@
+#!/usr/bin/env python2.7%0A%0Aimport collectd%0Aimport json%0Aimport xmlrpclib%0A%0Apybmurl = %22%22%0Aapi = %22%22%0A%0Adef init_callback():%0A    global api%0A    api = xmlrpclib.ServerProxy(pybmurl)%0A    collectd.info('pybitmessagestatus.py init done')%0A%0Adef config_callback(ObjConfiguration):%0A    global pybmurl%0A    apiUsername = %22%22%0A    apiPassword = %22%22%0A    apiInterface = %22127.0.0.1%22%0A    apiPort = 8445%0A    for node in ObjConfiguration.children:%0A        key = node.key.lower()%0A        if key.lower() == %22apiusername%22 and node.values:%0A            apiUsername = node.values%5B0%5D%0A        elif key.lower() == %22apipassword%22 and node.values:%0A            apiPassword = node.values%5B0%5D%0A        elif key.lower() == %22apiinterface%22 and node.values:%0A            apiInterface = node.values%5B0%5D%0A        elif key.lower() == %22apiport%22 and node.values:%0A            apiPort = node.values%5B0%5D%0A    pybmurl = %22http://%22 + apiUsername + %22:%22 + apiPassword + %22@%22 + apiInterface+ %22:%22 + str(int(apiPort)) + %22/%22%0A    collectd.info('pybitmessagestatus.py config done')%0A%0Adef read_callback():%0A    try:%0A        clientStatus = json.loads(api.clientStatus())%0A    except:%0A        collectd.info(%22Exception loading or parsing JSON%22)%0A        return%0A%0A    for i in %5B%22networkConnections%22, %22numberOfPubkeysProcessed%22, %22numberOfMessagesProcessed%22, %22numberOfBroadcastsProcessed%22%5D:%0A        metric = collectd.Values()%0A        metric.plugin = %22pybitmessagestatus%22%0A        if i%5B0:6%5D == %22number%22:%0A            metric.type = 'counter'%0A        else:%0A            metric.type = 'gauge'%0A        metric.type_instance = i.lower()%0A        try:%0A            metric.values = %5BclientStatus%5Bi%5D%5D%0A        except:%0A            collectd.info(%22Value for %25s missing%22 %25 (i))%0A        metric.dispatch()%0A%0Aif __name__ == %22__main__%22:%0A    main()%0Aelse:%0A    collectd.register_init(init_callback)%0A    collectd.register_config(config_callback)%0A    collectd.register_read(read_callback)%0A

Add collectd monitoring script