Skip to content

Instantly share code, notes, and snippets.

@iMilnb iMilnb/collectd.conf
Last active Oct 10, 2018

What would you like to do?
collectd-python plugin to read data from
<Plugin python>
ModulePath "/home/imil/collectd"
Import "ethermine"
<Module ethermine>
wallet "0xf00f00f00"
interval "300"
url ""
from __future__ import division
import requests
import collectd
cfg = {
'wallet': '0xf00b',
'interval': '300',
'url': 'http://localhost'
def readconf(config):
for node in config.children:
for k in ['wallet', 'interval', 'url']:
if node.key == k:
cfg[k] = node.values[0]'{0} set to: {1}'.format(k, cfg[k]))
cfg['url'] = '{0}/{1}'.format(cfg['url'], cfg['wallet'][2:])
def readvals():'calling {0}'.format(cfg['url']))
j = requests.get(cfg['url']).json()
except ValueError, e:
val = [
'k': 'reportedHashRate',
'v': j['reportedHashRate'].split()[0],
't': 'gauge'
'k': 'unpaid',
'v': float(j['unpaid']) / 1000000000000000000,
't': 'gauge'
{ 'k': 'usdPerMin', 'v': j['usdPerMin'], 't': 'gauge' }
for v in val:
c = collectd.Values(type = v['t'])
c.plugin = v['k']
c.dispatch(values = [v['v']])
collectd.register_read(readvals, int(cfg['interval']))

This comment has been minimized.

Copy link
Owner Author

iMilnb commented Jun 20, 2017

Feel free to send your appreciation to Ξ 0x7144ddbe4c3B43F892534d0B73549e87933FE7bc ;)


This comment has been minimized.

Copy link

jedimstr commented Jun 24, 2017

Having some trouble getting this working...
collectd to influxdb is working since I can see system measurements showing up in my collectd_db, but none of this plugin's measurements are showing up.

I verified that the python plugin is loaded and I see the ethermin.pyc file being generated after restarting collectd so plugin is at least executed.
I also added the measurement keys to my influxdb's types.db file for collectd.

Wallet and URL are the valid values, and even inserted them in both the py and the Plugin def in the conf to be sure.

Ultimately I want to add individual worker measurements, but hitting a roadblock with just the initial setup of the base measurements.

Don't know what step I missed here.


This comment has been minimized.

Copy link
Owner Author

iMilnb commented Jul 17, 2017

@jedimstr did you have a look to the logs? Usually collectd logs to syslog and has pretty comprehensive output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.