forked from librenms/librenms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PHP-FPM app update to handle multiple pools (librenms#16122)
* checkpoint work for now * polling should be good now * re-work php-fpm some more * re-work the php-fpm app page * add php-fpm_v1_combined.inc.php * add more graphs * more work * add last request cpu * fix stats for pools * more graph work * update the docs for php-fpm * more graph work * more graph stuff * graph stuff now done * some style fixes * another style fix * remove a unneeded use line * add new tests * add some missing items to the test * json fix * remove start time and add data
- Loading branch information
Showing
23 changed files
with
731 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
$name = 'php-fpm'; | ||
$ds = 'data'; | ||
|
||
if (isset($vars['phpfpm_pool'])) { | ||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id, 'pools___' . $vars['phpfpm_pool'] . '___' . $stat]); | ||
} else { | ||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id, 'totals___' . $stat]); | ||
} |
87 changes: 87 additions & 0 deletions
87
includes/html/graphs/application/php-fpm_overview_combined.inc.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<?php | ||
|
||
$name = 'php-fpm'; | ||
$unit_text = 'Totals'; | ||
$colours = 'psychedelic'; | ||
$dostack = 0; | ||
$printtotal = 0; | ||
$descr_len = 20; | ||
$addarea = 1; | ||
$transparency = 15; | ||
|
||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id, 'totals___max_active_processes']); | ||
|
||
if (Rrd::checkRrdExists($filename)) { | ||
$rrd_list = []; | ||
|
||
$proc_stats = [ | ||
'max_active_processes' => 'Max Active Processes', | ||
'active_processes' => 'Active Processes', | ||
'idle_processes' => 'Idle Processes', | ||
'max_listen_queue' => 'Max Listen Queue', | ||
'listen_queue' => 'Listen Queue', | ||
'listen_queue_len' => 'Listen Queue Len', | ||
'listen_queue' => 'Listen Queue', | ||
]; | ||
|
||
foreach ($proc_stats as $stat => $descr) { | ||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id, 'totals___' . $stat]); | ||
if (Rrd::checkRrdExists($filename)) { | ||
$rrd_list[] = [ | ||
'filename' => $filename, | ||
'descr' => $descr, | ||
'ds' => 'data', | ||
]; | ||
} | ||
} | ||
} else { | ||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id]); | ||
if (Rrd::checkRrdExists($filename)) { | ||
$rrd_list = [ | ||
[ | ||
'filename' => $filename, | ||
'descr' => 'Listen Queue', | ||
'ds' => 'lq', | ||
], | ||
[ | ||
'filename' => $filename, | ||
'descr' => 'Max Listen Queue', | ||
'ds' => 'mlq', | ||
], | ||
[ | ||
'filename' => $filename, | ||
'descr' => 'Idle Procs', | ||
'ds' => 'ip', | ||
], | ||
[ | ||
'filename' => $filename, | ||
'descr' => 'Active Procs', | ||
'ds' => 'ap', | ||
], | ||
[ | ||
'filename' => $filename, | ||
'descr' => 'Total Procs', | ||
'ds' => 'tp', | ||
], | ||
[ | ||
'filename' => $filename, | ||
'descr' => 'Max Active Procs', | ||
'ds' => 'map', | ||
], | ||
[ | ||
'filename' => $filename, | ||
'descr' => 'Max Children Reached', | ||
'ds' => 'mcr', | ||
], | ||
[ | ||
'filename' => $filename, | ||
'descr' => 'Slow Reqs', | ||
'ds' => 'sr', | ||
], | ||
]; | ||
} else { | ||
echo 'file missing: ' . $filename; | ||
} | ||
} | ||
|
||
require 'includes/html/graphs/generic_multi_line.inc.php'; |
19 changes: 19 additions & 0 deletions
19
includes/html/graphs/application/php-fpm_overview_max_children_reached.inc.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
$name = 'php-fpm'; | ||
|
||
$descr = 'Max Chldrn Reached'; | ||
$unit_text = 'Per Second'; | ||
$ds = 'data'; | ||
|
||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id, 'totals___max_children_reached']); | ||
|
||
if (! Rrd::checkRrdExists($filename)) { | ||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id]); | ||
$ds = 'mcr'; | ||
if (! Rrd::checkRrdExists($filename)) { | ||
echo 'file missing: ' . $filename; | ||
} | ||
} | ||
|
||
require 'includes/html/graphs/generic_stats.inc.php'; |
20 changes: 20 additions & 0 deletions
20
includes/html/graphs/application/php-fpm_overview_slow_requests.inc.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
$name = 'php-fpm'; | ||
|
||
$descr = 'Slow Requests'; | ||
$stat = 'slow_requests'; | ||
$unit_text = 'Requests/S'; | ||
$ds = 'data'; | ||
|
||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id, 'totals___slow_requests']); | ||
|
||
if (! Rrd::checkRrdExists($filename)) { | ||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id]); | ||
$ds = 'sr'; | ||
if (! Rrd::checkRrdExists($filename)) { | ||
echo 'file missing: ' . $filename; | ||
} | ||
} | ||
|
||
require 'includes/html/graphs/generic_stats.inc.php'; |
13 changes: 13 additions & 0 deletions
13
includes/html/graphs/application/php-fpm_v1_accepted_conn.inc.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
$descr = 'Accepted Conns'; | ||
$stat = 'accepted_conn'; | ||
$unit_text = 'Conns/S'; | ||
|
||
require 'php-fpm-include.php'; | ||
|
||
if (Rrd::checkRrdExists($filename)) { | ||
d_echo('RRD "' . $filename . '" not found'); | ||
} | ||
|
||
require 'includes/html/graphs/generic_stats.inc.php'; |
12 changes: 12 additions & 0 deletions
12
includes/html/graphs/application/php-fpm_v1_active_processes.inc.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
$descr = 'Active Procs'; | ||
$stat = 'active_processes'; | ||
|
||
require 'php-fpm-include.php'; | ||
|
||
if (Rrd::checkRrdExists($filename)) { | ||
d_echo('RRD "' . $filename . '" not found'); | ||
} | ||
|
||
require 'includes/html/graphs/generic_stats.inc.php'; |
39 changes: 39 additions & 0 deletions
39
includes/html/graphs/application/php-fpm_v1_combined.inc.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
$name = 'php-fpm'; | ||
$unit_text = 'Totals'; | ||
$colours = 'psychedelic'; | ||
$dostack = 0; | ||
$printtotal = 0; | ||
$descr_len = 20; | ||
$addarea = 1; | ||
$transparency = 15; | ||
|
||
$rrd_list = []; | ||
|
||
$proc_stats = [ | ||
'max_active_processes' => 'Max Active Processes', | ||
'active_processes' => 'Active Processes', | ||
'idle_processes' => 'Idle Processes', | ||
'max_listen_queue' => 'Max Listen Queue', | ||
'listen_queue' => 'Listen Queue', | ||
'listen_queue_len' => 'Listen Queue Len', | ||
'listen_queue' => 'Listen Queue', | ||
]; | ||
|
||
foreach ($proc_stats as $stat => $descr) { | ||
if (isset($vars['phpfpm_pool'])) { | ||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id, 'pools___' . $vars['phpfpm_pool'] . '___' . $stat]); | ||
} else { | ||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id, 'totals___' . $stat]); | ||
} | ||
if (Rrd::checkRrdExists($filename)) { | ||
$rrd_list[] = [ | ||
'filename' => $filename, | ||
'descr' => $descr, | ||
'ds' => 'data', | ||
]; | ||
} | ||
} | ||
|
||
require 'includes/html/graphs/generic_multi_line.inc.php'; |
12 changes: 12 additions & 0 deletions
12
includes/html/graphs/application/php-fpm_v1_idle_processes.inc.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
$descr = 'Idle Procs'; | ||
$stat = 'idle_processes'; | ||
|
||
require 'php-fpm-include.php'; | ||
|
||
if (Rrd::checkRrdExists($filename)) { | ||
d_echo('RRD "' . $filename . '" not found'); | ||
} | ||
|
||
require 'includes/html/graphs/generic_stats.inc.php'; |
12 changes: 12 additions & 0 deletions
12
includes/html/graphs/application/php-fpm_v1_last_request_cpu.inc.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
$descr = 'CPU Time %'; | ||
$stat = 'last_request_cpu'; | ||
|
||
require 'php-fpm-include.php'; | ||
|
||
if (Rrd::checkRrdExists($filename)) { | ||
d_echo('RRD "' . $filename . '" not found'); | ||
} | ||
|
||
require 'includes/html/graphs/generic_stats.inc.php'; |
12 changes: 12 additions & 0 deletions
12
includes/html/graphs/application/php-fpm_v1_listen_queue.inc.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
$descr = 'Listen Queue'; | ||
$stat = 'listen_queue'; | ||
|
||
require 'php-fpm-include.php'; | ||
|
||
if (Rrd::checkRrdExists($filename)) { | ||
d_echo('RRD "' . $filename . '" not found'); | ||
} | ||
|
||
require 'includes/html/graphs/generic_stats.inc.php'; |
12 changes: 12 additions & 0 deletions
12
includes/html/graphs/application/php-fpm_v1_listen_queue_len.inc.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
$descr = 'Listen Queue Len'; | ||
$stat = 'listen_queue_len'; | ||
|
||
require 'php-fpm-include.php'; | ||
|
||
if (Rrd::checkRrdExists($filename)) { | ||
d_echo('RRD "' . $filename . '" not found'); | ||
} | ||
|
||
require 'includes/html/graphs/generic_stats.inc.php'; |
12 changes: 12 additions & 0 deletions
12
includes/html/graphs/application/php-fpm_v1_max_active_processes.inc.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
$descr = 'Max Act Procs'; | ||
$stat = 'max_active_processes'; | ||
|
||
require 'php-fpm-include.php'; | ||
|
||
if (Rrd::checkRrdExists($filename)) { | ||
d_echo('RRD "' . $filename . '" not found'); | ||
} | ||
|
||
require 'includes/html/graphs/generic_stats.inc.php'; |
13 changes: 13 additions & 0 deletions
13
includes/html/graphs/application/php-fpm_v1_max_children_reached.inc.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
$descr = 'Max Children Reached'; | ||
$stat = 'max_children_reached'; | ||
$unit_text = 'Per Second'; | ||
|
||
require 'php-fpm-include.php'; | ||
|
||
if (Rrd::checkRrdExists($filename)) { | ||
d_echo('RRD "' . $filename . '" not found'); | ||
} | ||
|
||
require 'includes/html/graphs/generic_stats.inc.php'; |
12 changes: 12 additions & 0 deletions
12
includes/html/graphs/application/php-fpm_v1_max_listen_queue.inc.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
$descr = 'Max Listen Queue'; | ||
$stat = 'max_listen_queue'; | ||
|
||
require 'php-fpm-include.php'; | ||
|
||
if (Rrd::checkRrdExists($filename)) { | ||
d_echo('RRD "' . $filename . '" not found'); | ||
} | ||
|
||
require 'includes/html/graphs/generic_stats.inc.php'; |
13 changes: 13 additions & 0 deletions
13
includes/html/graphs/application/php-fpm_v1_slow_requests.inc.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
$descr = 'Slow Requests'; | ||
$stat = 'slow_requests'; | ||
$unit_text = 'Requests/S'; | ||
|
||
require 'php-fpm-include.php'; | ||
|
||
if (Rrd::checkRrdExists($filename)) { | ||
d_echo('RRD "' . $filename . '" not found'); | ||
} | ||
|
||
require 'includes/html/graphs/generic_stats.inc.php'; |
15 changes: 15 additions & 0 deletions
15
includes/html/graphs/application/php-fpm_v1_start_since.inc.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
$descr = 'Uptime'; | ||
$stat = 'start_since'; | ||
|
||
$munge = true; | ||
$unit_text = 'days'; | ||
|
||
require 'php-fpm-include.php'; | ||
|
||
if (Rrd::checkRrdExists($filename)) { | ||
d_echo('RRD "' . $filename . '" not found'); | ||
} | ||
|
||
require 'includes/html/graphs/generic_stats.inc.php'; |
12 changes: 12 additions & 0 deletions
12
includes/html/graphs/application/php-fpm_v1_total_processes.inc.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
$descr = 'Total Procs'; | ||
$stat = 'total_processes'; | ||
|
||
require 'php-fpm-include.php'; | ||
|
||
if (Rrd::checkRrdExists($filename)) { | ||
d_echo('RRD "' . $filename . '" not found'); | ||
} | ||
|
||
require 'includes/html/graphs/generic_stats.inc.php'; |
Oops, something went wrong.