diff options
author | Ilya Mashchenko <ilya@netdata.cloud> | 2020-08-16 11:42:26 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-16 11:42:26 +0300 |
commit | 5625d4727f38fc1d3060ab890f18d80ea8cf7d7e (patch) | |
tree | 61f6a23aa46b0e7732d5e2eb2a3d063a9ab7b43c /collectors/python.d.plugin | |
parent | 46376468129172ddfa3f13c2b4652c3fc9d86da9 (diff) |
python.d/ipfs: disable call to the `/api/v0/stats/repo` endpoint by default (#9687)
Diffstat (limited to 'collectors/python.d.plugin')
-rw-r--r-- | collectors/python.d.plugin/ipfs/README.md | 31 | ||||
-rw-r--r-- | collectors/python.d.plugin/ipfs/ipfs.chart.py | 27 | ||||
-rw-r--r-- | collectors/python.d.plugin/ipfs/ipfs.conf | 11 |
3 files changed, 50 insertions, 19 deletions
diff --git a/collectors/python.d.plugin/ipfs/README.md b/collectors/python.d.plugin/ipfs/README.md index 6cd588061d..a209bb670f 100644 --- a/collectors/python.d.plugin/ipfs/README.md +++ b/collectors/python.d.plugin/ipfs/README.md @@ -6,16 +6,16 @@ sidebar_label: "IPFS" # IPFS monitoring with Netdata -Collects [IPFS](https://ipfs.io) basic information like file system bandwidth, peers and repo metrics. +Collects [`IPFS`](https://ipfs.io) basic information like file system bandwidth, peers and repo metrics. -1. **Bandwidth** in kbits/s +## Charts - - in - - out +It produces the following charts: -2. **Peers** - - - peers +- Bandwidth in `kilobits/s` +- Peers in `peers` +- Repo Size in `GiB` +- Repo Objects in `objects` ## Configuration @@ -27,14 +27,23 @@ cd /etc/netdata # Replace this path with your Netdata config directory, if dif sudo ./edit-config python.d/ipfs.conf ``` -Only url to IPFS server is needed. +--- + +Calls to the following endpoints are disabled due to `IPFS` bugs: -Sample: +- `/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 cc34ee711b..abfc9c4924 100644 --- a/collectors/python.d.plugin/ipfs/ipfs.chart.py +++ b/collectors/python.d.plugin/ipfs/ipfs.chart.py @@ -65,6 +65,7 @@ class Service(UrlService): 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): @@ -110,16 +111,32 @@ 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)] + [ + ('pinned', 'Keys', len), + ('recursive_pins', 'Keys', self._recursive_pins), + ] }) r = dict() for suburl in cfg: diff --git a/collectors/python.d.plugin/ipfs/ipfs.conf b/collectors/python.d.plugin/ipfs/ipfs.conf index c7e186487d..8b167b3995 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 |