From d54de3e4dab9697732598ebf7f5baee896a9426d Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Tue, 11 Jan 2022 10:16:09 +0100 Subject: [PATCH] TT#157951 Check for ngcp-rest-api process running under node binary goss checks the name of the *binary*, not the name of the *process*. This can be checked from a user perspective via: | $ systemctl cat ngcp-rest-api | grep ExecStart | ExecStart=/usr/bin/node --title ngcp-rest-api /usr/share/ngcp-rest-api/server | $ sudo systemctl status ngcp-rest-api | grep PID | Main PID: 327024 (node) | $ ps -p 327024 -o comm | COMMAND | node Underneath, goss looks at the cmdline and stat files inside procfs: | $ cat /proc/327024/cmdline | ngcp-rest-api | $ cat /proc/327024/stat | 327024 (node) S 1 327024 327024 0 -1 4194560 38500 0 47 0 121 13 0 0 20 0 7 0 552217 704745472 32511 18446744073709551615 1 1 0 0 0 0 0 4096 82434 0 0 0 17 0 0 0 1 0 0 0 0 0 0 0 0 0 0 Since those two don't match with each other, our ngcp-rest-api service, running under the node binary, isn't identified as such a running process. NOTE: we're already checking for goss' service named ngcp-rest-api from within templates/510_init-daemons-ngcp.yaml.tt2, but this doesn't check if the process is alive. We need to explicitly check for the expected process name, which we're doing hereby. Change-Id: Iafa63b8e9fbfeee9edb2c0d48e8ed3514da4804a --- templates/411_process-ngcp-pro.yaml.tt2 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/templates/411_process-ngcp-pro.yaml.tt2 b/templates/411_process-ngcp-pro.yaml.tt2 index 7b697b4..6a3b45b 100644 --- a/templates/411_process-ngcp-pro.yaml.tt2 +++ b/templates/411_process-ngcp-pro.yaml.tt2 @@ -61,9 +61,6 @@ process: ngcp-faxserver: running: {{if and [% is_proxy ? 1 : 0 %] .Vars.NODE_ACTIVE}} true {{else}} false {{end}} - ngcp-rest-api: - running: [% is_mgmt && rest_api.enable == 'yes' ? 'true' : 'false' %] - ngcp-snmp-agent: running: true @@ -92,3 +89,9 @@ command: stdout: [] {{end}} stderr: [] + # ngcp-rest-api runs under the node binary, so we can't use "process" for checking + "pgrep -c -n -f 'ngcp-rest-api'": + exit-status: [% is_mgmt && rest_api.enable == 'yes' ? '0' : '1' %] + stdout: + - "[% is_mgmt && rest_api.enable == 'yes' ? '1' : '0' %]" + stderr: []