nginxinc/nginx-prometheus-exporter

Exit status

n-rodriguez opened this issue · 3 comments

When the container/nginx_exporter is stopped the exit status is 1 :

-----> Checking services presence
-----> Nginx is unavailable - sleeping
-----> Nginx is unavailable - sleeping
-----> Nginx is unavailable - sleeping
-----> Nginx is unavailable - sleeping
-----> Nginx is unavailable - sleeping
-----> Nginx is unavailable - sleeping
-----> Nginx is unavailable - sleeping
-----> Nginx is unavailable - sleeping
-----> Nginx is unavailable - sleeping
-----> Nginx is unavailable - sleeping
-----> Nginx is unavailable - sleeping
-----> Nginx is unavailable - sleeping
-----> Nginx is unavailable - sleeping
-----> Nginx is unavailable - sleeping
=====> Nginx is up
=====> Executing command: nginx_exporter
NGINX Prometheus Exporter version=0.11.0 commit=e4a6810d4f0b776f7fde37fea1d84e4c7284b72a date=2022-09-07T21:09:51Z, dirty=false, arch=linux/arm64, go=go1.19
2023/04/07 02:58:49 Starting...
2023/04/07 02:58:49 Listening on :9113
2023/04/07 02:58:49 NGINX Prometheus Exporter has successfully started
2023/04/07 03:12:29 Signal received: terminated. Exiting...
2023/04/07 03:12:29 http: Server closed
[INFO  tini (1)] Spawned child process 'docker-entrypoint' with pid '7'
[DEBUG tini (1)] Passing signal: 'Terminated'
[DEBUG tini (1)] Received SIGCHLD
[DEBUG tini (1)] Reaped child with pid: '7'
[INFO  tini (1)] Main child exited normally (with status '1')

IMHO it should be 0 or 143 : https://komodor.com/learn/exit-codes-in-containers-and-kubernetes-the-complete-guide/

Thank you!

Note: I use exec in docker-entrypoint

nonroot@a4edf2bc1f5c:/app$ ps faux
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
nonroot     2699  1.0  0.0   4164  3284 pts/0    Ss   03:41   0:00 bash
nonroot     2706  0.0  0.0   6760  2856 pts/0    R+   03:41   0:00  \_ ps faux
nonroot        1  0.0  0.0   2380   572 ?        Ss   02:33   0:00 tini -w -- docker-entrypoint nginx_exporter
nonroot        7  0.0  0.0 722376 21980 ?        Sl   02:33   0:01 nginx_exporter -nginx.scrape-uri=http://nginx:9090/nginx-status

The same goes locally:

nicolas@MBP-de-Nicolas:~/go/src/github.com/n-rodriguez/nginx-prometheus-exporter$ ./nginx-prometheus-exporter -nginx.scrape-uri http://127.0.0.1:9090/nginx-status
NGINX Prometheus Exporter version=0.11.0 commit=d2b813e79edbdd89a8f318be4d7ef7ebbd9c5707 date=2023-04-18T23:49:43Z, dirty=false, arch=darwin/amd64, go=go1.20.2
2023/04/23 21:48:47 Starting...
2023/04/23 21:48:47 Listening on :9113
2023/04/23 21:48:47 NGINX Prometheus Exporter has successfully started
^C2023/04/23 21:48:50 Signal received: interrupt. Exiting...
2023/04/23 21:48:50 http: Server closed
nicolas@MBP-de-Nicolas:~/go/src/github.com/n-rodriguez/nginx-prometheus-exporter$ echo $?
1

Hi there! Any news?