diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-02-07 11:49:00 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-02-07 12:42:05 +0000 |
commit | 2e85f9325a797977eea9dfea0a925775ddd211d9 (patch) | |
tree | 452c7f30d62fca5755f659b99e4e53c7b03afc21 /collectors/python.d.plugin/ipfs/ipfs.chart.py | |
parent | Releasing debian version 1.19.0-4. (diff) | |
download | netdata-2e85f9325a797977eea9dfea0a925775ddd211d9.tar.xz netdata-2e85f9325a797977eea9dfea0a925775ddd211d9.zip |
Merging upstream version 1.29.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'collectors/python.d.plugin/ipfs/ipfs.chart.py')
-rw-r--r-- | collectors/python.d.plugin/ipfs/ipfs.chart.py | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/collectors/python.d.plugin/ipfs/ipfs.chart.py b/collectors/python.d.plugin/ipfs/ipfs.chart.py index 8c89b4be1..abfc9c492 100644 --- a/collectors/python.d.plugin/ipfs/ipfs.chart.py +++ b/collectors/python.d.plugin/ipfs/ipfs.chart.py @@ -7,7 +7,6 @@ import json from bases.FrameworkServices.UrlService import UrlService - ORDER = [ 'bandwidth', 'peers', @@ -64,7 +63,9 @@ class Service(UrlService): self.order = ORDER self.definitions = CHARTS self.baseurl = self.configuration.get('url', 'http://localhost:5001') + self.method = "POST" self.do_pinapi = self.configuration.get('pinapi') + self.do_repoapi = self.configuration.get('repoapi') self.__storage_max = None def _get_json(self, sub_url): @@ -89,7 +90,7 @@ class Service(UrlService): if store_max.endswith('b'): val, units = store_max[:-2], store_max[-2] if units in SI_zeroes: - val += '0'*SI_zeroes[units] + val += '0' * SI_zeroes[units] store_max = val try: store_max = int(store_max) @@ -110,17 +111,33 @@ class Service(UrlService): # suburl : List of (result-key, original-key, transform-func) cfg = { '/api/v0/stats/bw': - [('in', 'RateIn', int), ('out', 'RateOut', int)], + [ + ('in', 'RateIn', int), + ('out', 'RateOut', int), + ], '/api/v0/swarm/peers': - [('peers', 'Peers', len)], - '/api/v0/stats/repo': - [('size', 'RepoSize', int), ('objects', 'NumObjects', int), ('avail', 'StorageMax', self._storagemax)], + [ + ('peers', 'Peers', len), + ], } + if self.do_repoapi: + cfg.update({ + '/api/v0/stats/repo': + [ + ('size', 'RepoSize', int), + ('objects', 'NumObjects', int), + ('avail', 'StorageMax', self._storagemax), + ], + }) + if self.do_pinapi: - cfg.update({ - '/api/v0/pin/ls': - [('pinned', 'Keys', len), ('recursive_pins', 'Keys', self._recursive_pins)] - }) + cfg.update({ + '/api/v0/pin/ls': + [ + ('pinned', 'Keys', len), + ('recursive_pins', 'Keys', self._recursive_pins), + ] + }) r = dict() for suburl in cfg: in_json = self._get_json(suburl) |