mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-06 12:33:44 +02:00
set a home directory for stats output
This commit is contained in:
parent
342657e629
commit
161ed18e48
2 changed files with 17 additions and 2 deletions
|
@ -1,9 +1,10 @@
|
||||||
CXX=$(shell which clang++ g++ c++ 2>/dev/null | head -n 1)
|
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 \
|
OBJS=Metrics.o \
|
||||||
../node/Metrics.o
|
../node/Metrics.o \
|
||||||
|
../osdep/OSUtils.o
|
||||||
|
|
||||||
CXXFLAGS=-O3 -fno-rtti $(INCLUDES) -std=c++17 -pthread -frtti
|
CXXFLAGS=-O3 -fno-rtti $(INCLUDES) -std=c++17 -pthread -frtti
|
||||||
|
|
||||||
|
|
|
@ -42,12 +42,15 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "../osdep/Phy.hpp"
|
#include "../osdep/Phy.hpp"
|
||||||
|
#include "../osdep/OSUtils.hpp"
|
||||||
|
|
||||||
#include "Metrics.hpp"
|
#include "Metrics.hpp"
|
||||||
|
|
||||||
#define ZT_TCP_PROXY_CONNECTION_TIMEOUT_SECONDS 300
|
#define ZT_TCP_PROXY_CONNECTION_TIMEOUT_SECONDS 300
|
||||||
#define ZT_TCP_PROXY_TCP_PORT 443
|
#define ZT_TCP_PROXY_TCP_PORT 443
|
||||||
|
|
||||||
|
#define HOMEDIR "/var/lib/zt-tcp-proxy"
|
||||||
|
|
||||||
using namespace ZeroTier;
|
using namespace ZeroTier;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -300,6 +303,17 @@ int main(int argc,char **argv)
|
||||||
signal(SIGHUP,SIG_IGN);
|
signal(SIGHUP,SIG_IGN);
|
||||||
srand(time((time_t *)0));
|
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;
|
TcpProxyService svc;
|
||||||
Phy<TcpProxyService *> phy(&svc,false,true);
|
Phy<TcpProxyService *> phy(&svc,false,true);
|
||||||
svc.phy = &phy;
|
svc.phy = &phy;
|
||||||
|
|
Loading…
Add table
Reference in a new issue