mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-24 07:06:39 +00:00
set a home directory for stats output
This commit is contained in:
parent
342657e629
commit
161ed18e48
@ -1,9 +1,10 @@
|
||||
CXX=$(shell which clang++ g++ c++ 2>/dev/null | head -n 1)
|
||||
|
||||
INCLUDES?=-isystem ../ext/prometheus-cpp-lite-1.0/core/include -isystem ../ext/prometheus-cpp-lite-1.0/simpleapi/include
|
||||
INCLUDES?=-isystem ../ext/prometheus-cpp-lite-1.0/core/include -isystem ../ext/prometheus-cpp-lite-1.0/simpleapi/include -isystem ../ext/
|
||||
|
||||
OBJS=Metrics.o \
|
||||
../node/Metrics.o
|
||||
../node/Metrics.o \
|
||||
../osdep/OSUtils.o
|
||||
|
||||
CXXFLAGS=-O3 -fno-rtti $(INCLUDES) -std=c++17 -pthread -frtti
|
||||
|
||||
|
@ -42,12 +42,15 @@
|
||||
#include <vector>
|
||||
|
||||
#include "../osdep/Phy.hpp"
|
||||
#include "../osdep/OSUtils.hpp"
|
||||
|
||||
#include "Metrics.hpp"
|
||||
|
||||
#define ZT_TCP_PROXY_CONNECTION_TIMEOUT_SECONDS 300
|
||||
#define ZT_TCP_PROXY_TCP_PORT 443
|
||||
|
||||
#define HOMEDIR "/var/lib/zt-tcp-proxy"
|
||||
|
||||
using namespace ZeroTier;
|
||||
|
||||
/*
|
||||
@ -300,6 +303,17 @@ int main(int argc,char **argv)
|
||||
signal(SIGHUP,SIG_IGN);
|
||||
srand(time((time_t *)0));
|
||||
|
||||
if (!OSUtils::fileExists(HOMEDIR)) {
|
||||
if (!OSUtils::mkdir(HOMEDIR)) {
|
||||
fprintf(stderr,"%s: fatal error: unable to create %s\n",argv[0],HOMEDIR);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
prometheus::simpleapi::saver.set_registry(prometheus::simpleapi::registry_ptr);
|
||||
prometheus::simpleapi::saver.set_delay(std::chrono::seconds(5));
|
||||
prometheus::simpleapi::saver.set_out_file(HOMEDIR "/metrics.json");
|
||||
|
||||
TcpProxyService svc;
|
||||
Phy<TcpProxyService *> phy(&svc,false,true);
|
||||
svc.phy = &phy;
|
||||
|
Loading…
Reference in New Issue
Block a user