Skip to content

Commit fff8b9d

Browse files
authored
Merge pull request #25 from tjespers/fix-queue-len-not-working-as-expected
Fix queue-len related options
2 parents bbf2d50 + 0c87505 commit fff8b9d

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ $ echo $?
116116
And you can also check if you have more than `10` processes in the queue:
117117

118118
```console
119-
$ php-fpm-healthcheck --accepted-conn=3000 --listen-queue-len=10
119+
$ php-fpm-healthcheck --accepted-conn=3000 --listen-queue=10
120120
$ echo $?
121121
0
122122
```
@@ -155,7 +155,7 @@ More and more people are looking for health checks on kubernetes for php-fpm, he
155155
exec:
156156
command:
157157
- php-fpm-healthcheck
158-
- --listen-queue-len=10 # fails if there are more than 10 processes waiting in the fpm queue
158+
- --listen-queue=10 # fails if there are more than 10 processes waiting in the fpm queue
159159
- --accepted-conn=5000 # fails after fpm has served more than 5k requests, this will force the pod to reset, use with caution
160160
initialDelaySeconds: 0
161161
periodSeconds: 10

php-fpm-healthcheck

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ get_fpm_status() {
7777
check_fpm_health_by() {
7878
OPTION=$(echo "$1" | sed 's/--//g; s/-/ /g;')
7979
VALUE_EXPECTED="$2";
80-
VALUE_ACTUAL=$(echo "$FPM_STATUS" | grep "^$OPTION" | cut -d: -f2 | sed 's/ //g')
80+
VALUE_ACTUAL=$(echo "$FPM_STATUS" | grep "^$OPTION:" | cut -d: -f2 | sed 's/ //g')
8181

8282
if test "$VERBOSE" = 1; then printf "'%s' value '%s' and expected is less than '%s'\\n" "$OPTION" "$VALUE_ACTUAL" "$VALUE_EXPECTED"; fi;
8383

test/testinfra/test_metrics.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,11 @@ def test_metric_accepted_conn(host):
2222
assert "Trying to connect to php-fpm via:" in cmd.stdout
2323
assert "status output:" in cmd.stdout
2424
assert "pool:" in cmd.stdout
25+
26+
@pytest.mark.php_fpm
27+
def test_listen_queue_len_and_listen_queue_vars_are_parsed_correctly(host):
28+
cmd = host.run("php-fpm-healthcheck --verbose --listen-queue=5 --listen-queue-len=256")
29+
assert cmd.rc == 0
30+
assert "Trying to connect to php-fpm via:" in cmd.stdout
31+
assert "'listen queue' value '0' and expected is less than '5" in cmd.stdout
32+
assert "'listen queue len' value '128' and expected is less than '256'" in cmd.stdout

0 commit comments

Comments
 (0)