master
yaml 313 lines 10.6 KB
Raw
1 plugin_name: go.d.plugin
2 modules:
3 - meta:
4 id: collector-go.d.plugin-phpdaemon
5 plugin_name: go.d.plugin
6 module_name: phpdaemon
7 monitored_instance:
8 name: phpDaemon
9 link: https://github.com/kakserpom/phpdaemon
10 icon_filename: php.svg
11 categories:
12 - data-collection.applications
13 keywords:
14 - phpdaemon
15 - php
16 related_resources:
17 integrations:
18 list: []
19 info_provided_to_referring_integrations:
20 description: ""
21 overview:
22 data_collection:
23 metrics_description: |
24 This collector monitors phpDaemon instances.
25 method_description: ""
26 supported_platforms:
27 include: []
28 exclude: []
29 multi_instance: true
30 additional_permissions:
31 description: ""
32 default_behavior:
33 auto_detection:
34 description: ""
35 limits:
36 description: ""
37 performance_impact:
38 description: ""
39 setup:
40 prerequisites:
41 list:
42 - title: Enable phpDaemon's HTTP server
43 description: |
44 Statistics expected to be in JSON format.
45
46 <details>
47 <summary>phpDaemon configuration</summary>
48
49 Instruction from [@METAJIJI](https://github.com/METAJIJI).
50
51 To enable `phpd` statistics on http, you must enable the http server and write an application.
52 Application is important, because standalone application [ServerStatus.php](https://github.com/kakserpom/phpdaemon/blob/master/PHPDaemon/Applications/ServerStatus.php) provides statistics in html format and unusable for `netdata`.
53
54 ```php
55 // /opt/phpdaemon/conf/phpd.conf
56
57 path /opt/phpdaemon/conf/AppResolver.php;
58 Pool:HTTPServer {
59 privileged;
60 listen '127.0.0.1';
61 port 8509;
62 }
63 ```
64
65 ```php
66 // /opt/phpdaemon/conf/AppResolver.php
67
68 <?php
69
70 class MyAppResolver extends \PHPDaemon\Core\AppResolver {
71 public function getRequestRoute($req, $upstream) {
72 if (preg_match('~^/(ServerStatus|FullStatus)/~', $req->attrs->server['DOCUMENT_URI'], $m)) {
73 return $m[1];
74 }
75 }
76 }
77
78 return new MyAppResolver;
79 ```
80
81 ```php
82 /opt/phpdaemon/conf/PHPDaemon/Applications/FullStatus.php
83
84 <?php
85 namespace PHPDaemon\Applications;
86
87 class FullStatus extends \PHPDaemon\Core\AppInstance {
88 public function beginRequest($req, $upstream) {
89 return new FullStatusRequest($this, $upstream, $req);
90 }
91 }
92 ```
93
94 ```php
95 // /opt/phpdaemon/conf/PHPDaemon/Applications/FullStatusRequest.php
96
97 <?php
98 namespace PHPDaemon\Applications;
99
100 use PHPDaemon\Core\Daemon;
101 use PHPDaemon\HTTPRequest\Generic;
102
103 class FullStatusRequest extends Generic {
104 public function run() {
105 $stime = microtime(true);
106 $this->header('Content-Type: application/javascript; charset=utf-8');
107
108 $stat = Daemon::getStateOfWorkers();
109 $stat['uptime'] = time() - Daemon::$startTime;
110 echo json_encode($stat);
111 }
112 }
113 ```
114
115 </details>
116 configuration:
117 file:
118 name: go.d/phpdaemon.conf
119 options:
120 description: |
121 The following options can be defined globally: update_every, autodetection_retry.
122 folding:
123 title: Config options
124 enabled: true
125 list:
126 - name: update_every
127 description: Data collection interval (seconds).
128 default_value: 1
129 required: false
130 group: Collection
131 - name: autodetection_retry
132 description: Autodetection retry interval (seconds). Set 0 to disable.
133 default_value: 0
134 required: false
135 group: Collection
136
137 - name: url
138 description: Target endpoint URL.
139 default_value: http://127.0.0.1:8509/FullStatus
140 required: true
141 group: Target
142 - name: timeout
143 description: HTTP request timeout (seconds).
144 default_value: 1
145 required: false
146 group: Target
147
148 - name: username
149 description: Username for Basic HTTP authentication.
150 default_value: ""
151 required: false
152 group: HTTP Auth
153 - name: password
154 description: Password for Basic HTTP authentication.
155 default_value: ""
156 required: false
157 group: HTTP Auth
158 - name: bearer_token_file
159 description: "Path to a file containing a bearer token (used for `Authorization: Bearer`)."
160 default_value: ""
161 required: false
162 group: HTTP Auth
163
164 - name: tls_skip_verify
165 description: Skip TLS certificate and hostname verification (insecure).
166 default_value: no
167 required: false
168 group: TLS
169 - name: tls_ca
170 description: Path to CA bundle used to validate the server certificate.
171 default_value: ""
172 required: false
173 group: TLS
174 - name: tls_cert
175 description: Path to client TLS certificate (for mTLS).
176 default_value: ""
177 required: false
178 group: TLS
179 - name: tls_key
180 description: Path to client TLS private key (for mTLS).
181 default_value: ""
182 required: false
183 group: TLS
184
185 - name: proxy_url
186 description: HTTP proxy URL.
187 default_value: ""
188 required: false
189 group: Proxy
190 - name: proxy_username
191 description: Username for proxy Basic HTTP authentication.
192 default_value: ""
193 required: false
194 group: Proxy
195 - name: proxy_password
196 description: Password for proxy Basic HTTP authentication.
197 default_value: ""
198 required: false
199 group: Proxy
200
201 - name: method
202 description: HTTP method to use.
203 default_value: "GET"
204 required: false
205 group: Request
206 - name: body
207 description: Request body (e.g., for POST/PUT).
208 default_value: ""
209 required: false
210 group: Request
211 - name: headers
212 description: "Additional HTTP headers (one per line as key: value)."
213 default_value: ""
214 required: false
215 group: Request
216 - name: not_follow_redirects
217 description: Do not follow HTTP redirects.
218 default_value: no
219 required: false
220 group: Request
221 - name: force_http2
222 description: Force HTTP/2 (including h2c over TCP).
223 default_value: no
224 required: false
225 group: Request
226
227 - name: vnode
228 description: Associates this data collection job with a [Virtual Node](https://learn.netdata.cloud/docs/netdata-agent/configuration/organize-systems-metrics-and-alerts#virtual-nodes).
229 default_value: ""
230 required: false
231 group: Virtual Node
232 examples:
233 folding:
234 title: Config
235 enabled: true
236 list:
237 - name: Basic
238 description: A basic example configuration.
239 config: |
240 jobs:
241 - name: local
242 url: http://127.0.0.1:8509/FullStatus
243 - name: HTTP authentication
244 description: HTTP authentication.
245 config: |
246 jobs:
247 - name: local
248 url: http://127.0.0.1:8509/FullStatus
249 username: username
250 password: password
251 - name: HTTPS with self-signed certificate
252 description: HTTPS with self-signed certificate.
253 config: |
254 jobs:
255 - name: local
256 url: http://127.0.0.1:8509/FullStatus
257 tls_skip_verify: yes
258 - name: Multi-instance
259 description: |
260 > **Note**: When you define multiple jobs, their names must be unique.
261
262 Collecting metrics from local and remote instances.
263 config: |
264 jobs:
265 - name: local
266 url: http://127.0.0.1:8509/FullStatus
267
268 - name: remote
269 url: http://192.0.2.1:8509/FullStatus
270 troubleshooting:
271 problems:
272 list: []
273 alerts: []
274 metrics:
275 folding:
276 title: Metrics
277 enabled: false
278 description: ""
279 availability: []
280 scopes:
281 - name: global
282 description: These metrics refer to the entire monitored application.
283 labels: []
284 metrics:
285 - name: phpdaemon.workers
286 description: Workers
287 unit: workers
288 chart_type: line
289 dimensions:
290 - name: alive
291 - name: shutdown
292 - name: phpdaemon.alive_workers
293 description: Alive Workers State
294 unit: workers
295 chart_type: line
296 dimensions:
297 - name: idle
298 - name: busy
299 - name: reloading
300 - name: phpdaemon.idle_workers
301 description: Idle Workers State
302 unit: workers
303 chart_type: line
304 dimensions:
305 - name: preinit
306 - name: init
307 - name: initialized
308 - name: phpdaemon.uptime
309 description: Uptime
310 unit: seconds
311 chart_type: line
312 dimensions:
313 - name: time