From a8220ab2d293bb7f4b014b79d16b2fb05090fa93 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Feb 2021 12:45:55 +0100 Subject: Adding upstream version 1.29.0. Signed-off-by: Daniel Baumann --- collectors/python.d.plugin/ipfs/README.md | 47 ++++++++++++++++++++------- collectors/python.d.plugin/ipfs/ipfs.chart.py | 37 +++++++++++++++------ collectors/python.d.plugin/ipfs/ipfs.conf | 11 +++++-- 3 files changed, 70 insertions(+), 25 deletions(-) (limited to 'collectors/python.d.plugin/ipfs') diff --git a/collectors/python.d.plugin/ipfs/README.md b/collectors/python.d.plugin/ipfs/README.md index 639631501..4d3b0ecbe 100644 --- a/collectors/python.d.plugin/ipfs/README.md +++ b/collectors/python.d.plugin/ipfs/README.md @@ -1,26 +1,49 @@ -# ipfs + -Module monitors [IPFS](https://ipfs.io) basic information. +# IPFS monitoring with Netdata -1. **Bandwidth** in kbits/s +Collects [`IPFS`](https://ipfs.io) basic information like file system bandwidth, peers and repo metrics. - - in - - out +## Charts -2. **Peers** +It produces the following charts: - - peers +- Bandwidth in `kilobits/s` +- Peers in `peers` +- Repo Size in `GiB` +- Repo Objects in `objects` -## configuration +## Configuration -Only url to IPFS server is needed. +Edit the `python.d/ipfs.conf` configuration file using `edit-config` from the Netdata [config +directory](/docs/configure/nodes.md), which is typically at `/etc/netdata`. -Sample: +```bash +cd /etc/netdata # Replace this path with your Netdata config directory, if different +sudo ./edit-config python.d/ipfs.conf +``` + +--- + +Calls to the following endpoints are disabled due to `IPFS` bugs: + +- `/api/v0/stats/repo` (https://github.com/ipfs/go-ipfs/issues/3874) +- `/api/v0/pin/ls` (https://github.com/ipfs/go-ipfs/issues/7528) + +Can be enabled in the collector configuration file. + +The configuration needs only `url` to `IPFS` server, here is an example for 2 `IPFS` instances: ```yaml localhost: - name : 'local' - url : 'http://localhost:5001' + url: 'http://localhost:5001' + +remote: + url: 'http://203.0.113.10::5001' ``` --- 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) diff --git a/collectors/python.d.plugin/ipfs/ipfs.conf b/collectors/python.d.plugin/ipfs/ipfs.conf index c7e186487..8b167b399 100644 --- a/collectors/python.d.plugin/ipfs/ipfs.conf +++ b/collectors/python.d.plugin/ipfs/ipfs.conf @@ -62,6 +62,10 @@ # Additionally to the above, ipfs also supports the following: # # url: 'URL' # URL to the IPFS API +# repoapi: no # Collect repo metrics +# # Currently defaults to disabled due to IPFS Bug +# # https://github.com/ipfs/go-ipfs/issues/7528 +# # resulting in very high CPU Usage # pinapi: no # Set status of IPFS pinned object polling # # Currently defaults to disabled due to IPFS Bug # # https://github.com/ipfs/go-ipfs/issues/3874 @@ -72,6 +76,7 @@ # only one of them will run (they have the same name) localhost: - name : 'local' - url : 'http://localhost:5001' - pinapi : no + name: 'local' + url: 'http://localhost:5001' + repoapi: no + pinapi: no -- cgit v1.2.3