Open serge-r opened 1 month ago
Does the http endpoint still work?
Does the http endpoint still work?
It doesn't work
[root@ip-10-111-248-242 ~]# curl -I -XGET -H "X-ZT1-Auth: $(sudo cat /var/lib/zerotier-one/metricstoken.secret)" http://localhost:9993/metrics
HTTP/1.1 200 OK
Content-Length: 0
Content-Type: text/plain
Keep-Alive: timeout=5, max=5
Because if I understand right the file metrics.prom
is a source for http endpoint metrics
https://github.com/zerotier/ZeroTierOne/blob/a681fbf5337e63721f869cebae12d5e1a92f1238/service/OneService.cpp#L2268-L2277
hmm does this mean it doesn't work on any type of redhat
Probably, I don't have any other Red Hat nodes for testing. On Ubuntu VMs, we don't have such a problem.
Hello, I have found a problem with ZeroTier metrics when zerotier-one daemon runs with the -d parameter.
Here is my current configuration:
ZeroTier was installed via the standard method:
The metrics file is empty:
You can also reproduce this issue simply by running
/usr/sbin/zerotier-one -d
Upon investigating further, I found that on AL2, you are using an init.d script that runs zerotier-one with the -d parameter. This flag initiates the fork() method and shuts down the main process as seen here: https://github.com/zerotier/ZeroTierOne/blob/a681fbf5337e63721f869cebae12d5e1a92f1238/one.cpp#L2300
This action triggers the execution of the destructor of the SaveToFile class, defined here: https://github.com/zerotier/ZeroTierOne/blob/a681fbf5337e63721f869cebae12d5e1a92f1238/ext/prometheus-cpp-lite-1.0/core/include/prometheus/save_to_file.h#L53
The execution of the destructor sets the global variable must_die to true. Since you are using fork() syscall, all processes share the same memory, so the worker_function thread stops before any metrics can be written.
Here is an example of a GDB session:
As a result, prometheus::SaveToFile::save_data() would never be called in this case.