-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[inputs.php-fpm] Adding full metrics #14421
Comments
Hi, Is this something you plan on contributing? If not, could you share what that URL looks like to aid in someone implementing this? We would need to consider if a different metric name also makes sense to distinguish the current metrics any new things we collect. |
HI @powersj, Thank you, so fast! I can help to test if needed but cannot really help on go :/ Here is a template of the output: {
"pool": "www",
"process manager": "static",
"start time": 1702044927,
"start since": 4901,
"accepted conn": 3879,
"listen queue": 0,
"max listen queue": 0,
"listen queue len": 0,
"idle processes": 9,
"active processes": 1,
"total processes": 10,
"max active processes": 3,
"max children reached": 0,
"slow requests": 0,
"processes": [
{
"pid": 583,
"state": "Running",
"start time": 1702044927,
"start since": 4901,
"requests": 386,
"request duration": 159,
"request method": "GET",
"request uri": "/fpm-status?json&full",
"content length": 0,
"user": "-",
"script": "-",
"last request cpu": 0,
"last request memory": 0
},
{
"pid": 584,
"state": "Idle",
"start time": 1702044927,
"start since": 4901,
"requests": 390,
"request duration": 174,
"request method": "GET",
"request uri": "/fpm-status",
"content length": 0,
"user": "-",
"script": "-",
"last request cpu": 0,
"last request memory": 2097152
},
{
"pid": 585,
"state": "Idle",
"start time": 1702044927,
"start since": 4901,
"requests": 389,
"request duration": 9530,
"request method": "GET",
"request uri": "/index.php",
"content length": 0,
"user": "-",
"script": "script.php",
"last request cpu": 104.93,
"last request memory": 2097152
},
{
"pid": 586,
"state": "Idle",
"start time": 1702044927,
"start since": 4901,
"requests": 399,
"request duration": 127,
"request method": "GET",
"request uri": "/ping",
"content length": 0,
"user": "-",
"script": "-",
"last request cpu": 0,
"last request memory": 2097152
},
{
"pid": 587,
"state": "Idle",
"start time": 1702044927,
"start since": 4901,
"requests": 382,
"request duration": 9713,
"request method": "GET",
"request uri": "/index.php",
"content length": 0,
"user": "-",
"script": "script.php",
"last request cpu": 0,
"last request memory": 2097152
},
{
"pid": 588,
"state": "Idle",
"start time": 1702044927,
"start since": 4901,
"requests": 383,
"request duration": 133,
"request method": "GET",
"request uri": "/ping",
"content length": 0,
"user": "-",
"script": "-",
"last request cpu": 0,
"last request memory": 2097152
},
{
"pid": 589,
"state": "Idle",
"start time": 1702044927,
"start since": 4901,
"requests": 381,
"request duration": 154,
"request method": "GET",
"request uri": "/fpm-status?json",
"content length": 0,
"user": "-",
"script": "-",
"last request cpu": 0,
"last request memory": 2097152
},
{
"pid": 590,
"state": "Idle",
"start time": 1702044927,
"start since": 4901,
"requests": 397,
"request duration": 108,
"request method": "GET",
"request uri": "/ping",
"content length": 0,
"user": "-",
"script": "-",
"last request cpu": 0,
"last request memory": 2097152
},
{
"pid": 591,
"state": "Idle",
"start time": 1702044927,
"start since": 4901,
"requests": 381,
"request duration": 9068,
"request method": "GET",
"request uri": "/index.php",
"content length": 0,
"user": "-",
"script": "script.php",
"last request cpu": 110.28,
"last request memory": 2097152
},
{
"pid": 592,
"state": "Idle",
"start time": 1702044927,
"start since": 4901,
"requests": 391,
"request duration": 15559,
"request method": "GET",
"request uri": "/index.php",
"content length": 0,
"user": "-",
"script": "script.php",
"last request cpu": 64.27,
"last request memory": 2097152
}
]
} For information, just need to do a GET on the fpm status (path can change depending of configuration) via these parameters: |
Does the current plugin work with JSON output? It looks like we currently parse any output line by line. Does 127.0.0.1/fpm-status?full produce the same data you provided, but not in JSON? Can you give the artifacts in #14423 a try? I have added everything missing as a field for now. Thanks! |
@powersj indeed, it use well line by line but I througt json was better to parse. You can see here an example with the line by line (each process are separated by **** line):
|
Were you able to try the artifacts from PR? I agree that the JSON would be easier, but it looks like the current plugin expects the flat layout for now. We can look to change this down the road, but would need to ensure users understand that the URL needs to provide JSON or have a fallback mechanism. |
Just tried with this config:
Results:
Seems not good :/ |
Ah thanks for the full output. I now see what is going on. I am going to have to rethink this a bit, since we will need new metric for each of these requested URIs/PIDs as this is a bit more than adding some missing fields. |
ok new PR: #14421 if you could give that a shot in 20-30mins once new artifacts are attached. You will need to 1) use the JSON URL and 2) a new config option to specify the new metrics. [[inputs.phpfpm]]
urls = ["http://127.0.0.1/fpm-status?json&full"]
format = "status" Technically you could probably do this with the JSON parser or XPATH parsers... but this isn't too hard to add. |
@powersj no output anymore with:
If I remove the format = "status" + json, I have the original output. Telegraf 1.30.0-0c0ea62c (git: pull/14430@0c0ea62c) |
Ugh my bad, it should be |
At the time I didn't even make the connection -_- But yep, I confirm that all is good, thank you! Was so fast! |
ok thanks! Let me clean up the readme and verify unit tests, and I'll get this ready for review. Thank you for all the data and for trying that out so quickly as well! |
Use Case
Add support to per process monitoring (full status page) for php-fpm input plugin
It allow to get some metrics to be able to follow consumption of memory/cpu/etc by request/uri/script.
Expected behavior
Actual behavior
Additional info
Full info in json mode can be found via the path 127.0.0.1/fpm-status?full&json
Related to previous closed ticket: #5737
The text was updated successfully, but these errors were encountered: