@cryptotaxi247 / netdata-1 / commits / 5625d4727

python.d/ipfs: disable call to the `/api/v0/stats/repo` endpoint by default (#9687)

Ilya Mashchenko committed Aug 16, 2020 at 11:42 UTC 5625d4727f38fc1d3060ab890f18d80ea8cf7d7e
3 files changed +50 -19
collectors/python.d.plugin/ipfs/README.md
+20 -11
@@ -6,16 +6,16 @@ sidebar_label: "IPFS"
6
7 # IPFS monitoring with Netdata
8
9 -Collects [IPFS](https://ipfs.io) basic information like file system bandwidth, peers and repo metrics.
9 +Collects [`IPFS`](https://ipfs.io) basic information like file system bandwidth, peers and repo metrics.
10
11 -1. **Bandwidth** in kbits/s
11 +## Charts
12
13 - - in
14 - - out
13 +It produces the following charts:
14
16 -2. **Peers**
17 -
18 - - peers
15 +- Bandwidth in `kilobits/s`
16 +- Peers in `peers`
17 +- Repo Size in `GiB`
18 +- Repo Objects in `objects`
19
20 ## Configuration
21
@@ -27,14 +27,23 @@ cd /etc/netdata # Replace this path with your Netdata config directory, if dif
27 sudo ./edit-config python.d/ipfs.conf
28 ```
29
30 -Only url to IPFS server is needed.
30 +---
31 +
32 +Calls to the following endpoints are disabled due to `IPFS` bugs:
33
32 -Sample:
34 +- `/api/v0/stats/repo` (https://github.com/ipfs/go-ipfs/issues/3874)
35 +- `/api/v0/pin/ls` (https://github.com/ipfs/go-ipfs/issues/7528)
36 +
37 +Can be enabled in the collector configuration file.
38 +
39 +The configuration needs only `url` to `IPFS` server, here is an example for 2 `IPFS` instances:
40
41 ```yaml
42 localhost:
36 - name : 'local'
37 - url : 'http://localhost:5001'
43 + url: 'http://localhost:5001'
44 +
45 +remote:
46 + url: 'http://203.0.113.10::5001'
47 ```
48
49 ---
collectors/python.d.plugin/ipfs/ipfs.chart.py
+22 -5
@@ -65,6 +65,7 @@ class Service(UrlService):
65 self.baseurl = self.configuration.get('url', 'http://localhost:5001')
66 self.method = "POST"
67 self.do_pinapi = self.configuration.get('pinapi')
68 + self.do_repoapi = self.configuration.get('repoapi')
69 self.__storage_max = None
70
71 def _get_json(self, sub_url):
@@ -110,16 +111,32 @@ class Service(UrlService):
111 # suburl : List of (result-key, original-key, transform-func)
112 cfg = {
113 '/api/v0/stats/bw':
113 - [('in', 'RateIn', int), ('out', 'RateOut', int)],
114 + [
115 + ('in', 'RateIn', int),
116 + ('out', 'RateOut', int),
117 + ],
118 '/api/v0/swarm/peers':
115 - [('peers', 'Peers', len)],
116 - '/api/v0/stats/repo':
117 - [('size', 'RepoSize', int), ('objects', 'NumObjects', int), ('avail', 'StorageMax', self._storagemax)],
119 + [
120 + ('peers', 'Peers', len),
121 + ],
122 }
123 + if self.do_repoapi:
124 + cfg.update({
125 + '/api/v0/stats/repo':
126 + [
127 + ('size', 'RepoSize', int),
128 + ('objects', 'NumObjects', int),
129 + ('avail', 'StorageMax', self._storagemax),
130 + ],
131 + })
132 +
133 if self.do_pinapi:
134 cfg.update({
135 '/api/v0/pin/ls':
122 - [('pinned', 'Keys', len), ('recursive_pins', 'Keys', self._recursive_pins)]
136 + [
137 + ('pinned', 'Keys', len),
138 + ('recursive_pins', 'Keys', self._recursive_pins),
139 + ]
140 })
141 r = dict()
142 for suburl in cfg:
collectors/python.d.plugin/ipfs/ipfs.conf
+8 -3
@@ -62,6 +62,10 @@
62 # Additionally to the above, ipfs also supports the following:
63 #
64 # url: 'URL' # URL to the IPFS API
65 +# repoapi: no # Collect repo metrics
66 +# # Currently defaults to disabled due to IPFS Bug
67 +# # https://github.com/ipfs/go-ipfs/issues/7528
68 +# # resulting in very high CPU Usage
69 # pinapi: no # Set status of IPFS pinned object polling
70 # # Currently defaults to disabled due to IPFS Bug
71 # # https://github.com/ipfs/go-ipfs/issues/3874
@@ -72,6 +76,7 @@
76 # only one of them will run (they have the same name)
77
78 localhost:
75 - name : 'local'
76 - url : 'http://localhost:5001'
77 - pinapi : no
79 + name: 'local'
80 + url: 'http://localhost:5001'
81 + repoapi: no
82 + pinapi: no