github.com/netdata/go.d.plugin@v0.58.1/modules/phpdaemon/integrations/phpdaemon.md (about) 1 <!--startmeta 2 custom_edit_url: "https://github.com/netdata/go.d.plugin/edit/master/modules/phpdaemon/README.md" 3 meta_yaml: "https://github.com/netdata/go.d.plugin/edit/master/modules/phpdaemon/metadata.yaml" 4 sidebar_label: "phpDaemon" 5 learn_status: "Published" 6 learn_rel_path: "Data Collection/APM" 7 most_popular: False 8 message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE COLLECTOR'S metadata.yaml FILE" 9 endmeta--> 10 11 # phpDaemon 12 13 14 <img src="https://netdata.cloud/img/php.svg" width="150"/> 15 16 17 Plugin: go.d.plugin 18 Module: phpdaemon 19 20 <img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" /> 21 22 ## Overview 23 24 This collector monitors phpDaemon instances. 25 26 27 28 29 This collector is supported on all platforms. 30 31 This collector supports collecting metrics from multiple instances of this integration, including remote instances. 32 33 34 ### Default Behavior 35 36 #### Auto-Detection 37 38 This integration doesn't support auto-detection. 39 40 #### Limits 41 42 The default configuration for this integration does not impose any limits on data collection. 43 44 #### Performance Impact 45 46 The default configuration for this integration is not expected to impose a significant performance impact on the system. 47 48 49 ## Metrics 50 51 Metrics grouped by *scope*. 52 53 The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels. 54 55 56 57 ### Per phpDaemon instance 58 59 These metrics refer to the entire monitored application. 60 61 This scope has no labels. 62 63 Metrics: 64 65 | Metric | Dimensions | Unit | 66 |:------|:----------|:----| 67 | phpdaemon.workers | alive, shutdown | workers | 68 | phpdaemon.alive_workers | idle, busy, reloading | workers | 69 | phpdaemon.idle_workers | preinit, init, initialized | workers | 70 | phpdaemon.uptime | time | seconds | 71 72 73 74 ## Alerts 75 76 There are no alerts configured by default for this integration. 77 78 79 ## Setup 80 81 ### Prerequisites 82 83 #### Enable phpDaemon's HTTP server 84 85 Statistics expected to be in JSON format. 86 87 <details> 88 <summary>phpDaemon configuration</summary> 89 90 Instruction from [@METAJIJI](https://github.com/METAJIJI). 91 92 To enable `phpd` statistics on http, you must enable the http server and write an application. 93 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`. 94 95 ```php 96 // /opt/phpdaemon/conf/phpd.conf 97 98 path /opt/phpdaemon/conf/AppResolver.php; 99 Pool:HTTPServer { 100 privileged; 101 listen '127.0.0.1'; 102 port 8509; 103 } 104 ``` 105 106 ```php 107 // /opt/phpdaemon/conf/AppResolver.php 108 109 <?php 110 111 class MyAppResolver extends \PHPDaemon\Core\AppResolver { 112 public function getRequestRoute($req, $upstream) { 113 if (preg_match('~^/(ServerStatus|FullStatus)/~', $req->attrs->server['DOCUMENT_URI'], $m)) { 114 return $m[1]; 115 } 116 } 117 } 118 119 return new MyAppResolver; 120 ``` 121 122 ```php 123 /opt/phpdaemon/conf/PHPDaemon/Applications/FullStatus.php 124 125 <?php 126 namespace PHPDaemon\Applications; 127 128 class FullStatus extends \PHPDaemon\Core\AppInstance { 129 public function beginRequest($req, $upstream) { 130 return new FullStatusRequest($this, $upstream, $req); 131 } 132 } 133 ``` 134 135 ```php 136 // /opt/phpdaemon/conf/PHPDaemon/Applications/FullStatusRequest.php 137 138 <?php 139 namespace PHPDaemon\Applications; 140 141 use PHPDaemon\Core\Daemon; 142 use PHPDaemon\HTTPRequest\Generic; 143 144 class FullStatusRequest extends Generic { 145 public function run() { 146 $stime = microtime(true); 147 $this->header('Content-Type: application/javascript; charset=utf-8'); 148 149 $stat = Daemon::getStateOfWorkers(); 150 $stat['uptime'] = time() - Daemon::$startTime; 151 echo json_encode($stat); 152 } 153 } 154 ``` 155 156 </details> 157 158 159 160 ### Configuration 161 162 #### File 163 164 The configuration file name for this integration is `go.d/phpdaemon.conf`. 165 166 167 You can edit the configuration file using the `edit-config` script from the 168 Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md#the-netdata-config-directory). 169 170 ```bash 171 cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata 172 sudo ./edit-config go.d/phpdaemon.conf 173 ``` 174 #### Options 175 176 The following options can be defined globally: update_every, autodetection_retry. 177 178 179 <details><summary>Config options</summary> 180 181 | Name | Description | Default | Required | 182 |:----|:-----------|:-------|:--------:| 183 | update_every | Data collection frequency. | 1 | no | 184 | autodetection_retry | Recheck interval in seconds. Zero means no recheck will be scheduled. | 0 | no | 185 | url | Server URL. | http://127.0.0.1:8509/FullStatus | yes | 186 | timeout | HTTP request timeout. | 2 | no | 187 | username | Username for basic HTTP authentication. | | no | 188 | password | Password for basic HTTP authentication. | | no | 189 | proxy_url | Proxy URL. | | no | 190 | proxy_username | Username for proxy basic HTTP authentication. | | no | 191 | proxy_password | Password for proxy basic HTTP authentication. | | no | 192 | method | HTTP request method. | GET | no | 193 | body | HTTP request body. | | no | 194 | headers | HTTP request headers. | | no | 195 | not_follow_redirects | Redirect handling policy. Controls whether the client follows redirects. | no | no | 196 | tls_skip_verify | Server certificate chain and hostname validation policy. Controls whether the client performs this check. | no | no | 197 | tls_ca | Certification authority that the client uses when verifying the server's certificates. | | no | 198 | tls_cert | Client TLS certificate. | | no | 199 | tls_key | Client TLS key. | | no | 200 201 </details> 202 203 #### Examples 204 205 ##### Basic 206 207 A basic example configuration. 208 209 <details><summary>Config</summary> 210 211 ```yaml 212 jobs: 213 - name: local 214 url: http://127.0.0.1:8509/FullStatus 215 216 ``` 217 </details> 218 219 ##### HTTP authentication 220 221 HTTP authentication. 222 223 <details><summary>Config</summary> 224 225 ```yaml 226 jobs: 227 - name: local 228 url: http://127.0.0.1:8509/FullStatus 229 username: username 230 password: password 231 232 ``` 233 </details> 234 235 ##### HTTPS with self-signed certificate 236 237 HTTPS with self-signed certificate. 238 239 <details><summary>Config</summary> 240 241 ```yaml 242 jobs: 243 - name: local 244 url: http://127.0.0.1:8509/FullStatus 245 tls_skip_verify: yes 246 247 ``` 248 </details> 249 250 ##### Multi-instance 251 252 > **Note**: When you define multiple jobs, their names must be unique. 253 254 Collecting metrics from local and remote instances. 255 256 257 <details><summary>Config</summary> 258 259 ```yaml 260 jobs: 261 - name: local 262 url: http://127.0.0.1:8509/FullStatus 263 264 - name: remote 265 url: http://192.0.2.1:8509/FullStatus 266 267 ``` 268 </details> 269 270 271 272 ## Troubleshooting 273 274 ### Debug Mode 275 276 To troubleshoot issues with the `phpdaemon` collector, run the `go.d.plugin` with the debug option enabled. The output 277 should give you clues as to why the collector isn't working. 278 279 - Navigate to the `plugins.d` directory, usually at `/usr/libexec/netdata/plugins.d/`. If that's not the case on 280 your system, open `netdata.conf` and look for the `plugins` setting under `[directories]`. 281 282 ```bash 283 cd /usr/libexec/netdata/plugins.d/ 284 ``` 285 286 - Switch to the `netdata` user. 287 288 ```bash 289 sudo -u netdata -s 290 ``` 291 292 - Run the `go.d.plugin` to debug the collector: 293 294 ```bash 295 ./go.d.plugin -d -m phpdaemon 296 ``` 297 298