From 342657e62948961b3edeb81b4dfb0b5af5bd4c6a Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Mon, 6 May 2024 19:11:45 -0700 Subject: [PATCH 1/7] begin adding some metrics to tcp-proxy --- tcp-proxy/Makefile | 13 +++++++++---- tcp-proxy/Metrics.cpp | 24 ++++++++++++++++++++++++ tcp-proxy/Metrics.hpp | 21 +++++++++++++++++++++ tcp-proxy/tcp-proxy.cpp | 15 +++++++++++++-- 4 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 tcp-proxy/Metrics.cpp create mode 100644 tcp-proxy/Metrics.hpp diff --git a/tcp-proxy/Makefile b/tcp-proxy/Makefile index c14ce272..62f2cb2c 100644 --- a/tcp-proxy/Makefile +++ b/tcp-proxy/Makefile @@ -1,9 +1,14 @@ CXX=$(shell which clang++ g++ c++ 2>/dev/null | head -n 1) -INCLUDES?=-I../ext/prometheus-cpp-lite-1.0/core/include -I../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 -all: - $(CXX) -O3 -fno-rtti $(INCLUDES) -std=c++11 -pthread -frtti -o tcp-proxy tcp-proxy.cpp ../node/Metrics.cpp +OBJS=Metrics.o \ + ../node/Metrics.o + +CXXFLAGS=-O3 -fno-rtti $(INCLUDES) -std=c++17 -pthread -frtti + +all: $(OBJS) tcp-proxy.o + $(CXX) -O3 -fno-rtti $(INCLUDES) -std=c++17 -pthread -frtti -o tcp-proxy tcp-proxy.o $(OBJS) clean: - rm -f *.o tcp-proxy *.dSYM + rm -f $(OBJS) tcp-proxy.o tcp-proxy *.dSYM diff --git a/tcp-proxy/Metrics.cpp b/tcp-proxy/Metrics.cpp new file mode 100644 index 00000000..e6cc68f1 --- /dev/null +++ b/tcp-proxy/Metrics.cpp @@ -0,0 +1,24 @@ +#include + + +namespace ZeroTier { + namespace Metrics { + prometheus::simpleapi::counter_metric_t udp_open_failed + {"udp_open_failed", "UDP open failed"}; + + prometheus::simpleapi::counter_metric_t tcp_opened + {"tcp_opened", "TCP opened"}; + prometheus::simpleapi::counter_metric_t tcp_closed + {"tcp_closed", "TCP closed"}; + + prometheus::simpleapi::counter_metric_t tcp_bytes_in + {"tcp_byes_in", "TCP bytes in"}; + prometheus::simpleapi::counter_metric_t tcp_bytes_out + {"tcp_byes_out", "TCP bytes out"}; + + prometheus::simpleapi::counter_metric_t udp_bytes_in + {"udp_bytes_in", "UDP bytes in"}; + prometheus::simpleapi::counter_metric_t udp_bytes_out + {"udp_bytes_out", "UDP bytes out"}; + } +} \ No newline at end of file diff --git a/tcp-proxy/Metrics.hpp b/tcp-proxy/Metrics.hpp new file mode 100644 index 00000000..4211c9b8 --- /dev/null +++ b/tcp-proxy/Metrics.hpp @@ -0,0 +1,21 @@ +#ifndef _TCP_PROXY_METRICS_H_ +#define _TCP_PROXY_METRICS_H_ + +#include "../node/Metrics.hpp" + +namespace ZeroTier { + namespace Metrics { + extern prometheus::simpleapi::counter_metric_t udp_open_failed; + + extern prometheus::simpleapi::counter_metric_t tcp_opened; + extern prometheus::simpleapi::counter_metric_t tcp_closed; + + extern prometheus::simpleapi::counter_metric_t tcp_bytes_in; + extern prometheus::simpleapi::counter_metric_t tcp_bytes_out; + + extern prometheus::simpleapi::counter_metric_t udp_bytes_in; + extern prometheus::simpleapi::counter_metric_t udp_bytes_out; + } +} + +#endif // _TCP_PROXY_METRICS_H_ \ No newline at end of file diff --git a/tcp-proxy/tcp-proxy.cpp b/tcp-proxy/tcp-proxy.cpp index 44bc5eab..31fda750 100644 --- a/tcp-proxy/tcp-proxy.cpp +++ b/tcp-proxy/tcp-proxy.cpp @@ -43,7 +43,7 @@ #include "../osdep/Phy.hpp" -#include "../node/Metrics.hpp" +#include "Metrics.hpp" #define ZT_TCP_PROXY_CONNECTION_TIMEOUT_SECONDS 300 #define ZT_TCP_PROXY_TCP_PORT 443 @@ -127,6 +127,8 @@ struct TcpProxyService if (!*uptr) return; if ((from->sa_family == AF_INET)&&(len >= 16)&&(len < 2048)) { + Metrics::udp_bytes_in += len; + Client &c = *((Client *)*uptr); c.lastActivity = time((time_t *)0); @@ -171,6 +173,7 @@ struct TcpProxyService Client &c = clients[sockN]; PhySocket *udp = getUnusedUdp((void *)&c); if (!udp) { + Metrics::udp_open_failed++; phy->close(sockN); clients.erase(sockN); printf("** TCP rejected, no more UDP ports to assign\n"); @@ -184,6 +187,7 @@ struct TcpProxyService c.newVersion = false; *uptrN = (void *)&c; printf("<< TCP from %s -> %.16llx\n",inet_ntoa(reinterpret_cast(from)->sin_addr),(unsigned long long)&c); + Metrics::tcp_opened++; } void phyOnTcpClose(PhySocket *sock,void **uptr) @@ -194,6 +198,7 @@ struct TcpProxyService phy->close(c.udp); clients.erase(sock); printf("** TCP %.16llx closed\n",(unsigned long long)*uptr); + Metrics::tcp_closed++; } void phyOnTcpData(PhySocket *sock,void **uptr,void *data,unsigned long len) @@ -201,6 +206,8 @@ struct TcpProxyService Client &c = *((Client *)*uptr); c.lastActivity = time((time_t *)0); + Metrics::tcp_bytes_in += len; + for(unsigned long i=0;i= sizeof(c.tcpReadBuf)) { phy->close(sock); @@ -246,6 +253,7 @@ struct TcpProxyService if ((ntohs(dest.sin_port) > 1024)&&(payloadLen >= 16)) { phy->udpSend(c.udp,(const struct sockaddr *)&dest,payload,payloadLen); printf(">> TCP %.16llx to %s:%d\n",(unsigned long long)*uptr,inet_ntoa(dest.sin_addr),(int)ntohs(dest.sin_port)); + Metrics::udp_bytes_out += payloadLen; } } @@ -260,6 +268,7 @@ struct TcpProxyService Client &c = *((Client *)*uptr); if (c.tcpWritePtr) { long n = phy->streamSend(sock,c.tcpWriteBuf,c.tcpWritePtr); + Metrics::tcp_bytes_out += n; if (n > 0) { memmove(c.tcpWriteBuf,c.tcpWriteBuf + n,c.tcpWritePtr -= (unsigned long)n); if (!c.tcpWritePtr) @@ -278,8 +287,10 @@ struct TcpProxyService toClose.push_back(c->second.udp); } } - for(std::vector::iterator s(toClose.begin());s!=toClose.end();++s) + for(std::vector::iterator s(toClose.begin());s!=toClose.end();++s) { phy->close(*s); + Metrics::tcp_closed++; + } } }; From 161ed18e4878cd4578d07d36ee0c4e7d1b41583e Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Mon, 6 May 2024 19:21:30 -0700 Subject: [PATCH 2/7] set a home directory for stats output --- tcp-proxy/Makefile | 5 +++-- tcp-proxy/tcp-proxy.cpp | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/tcp-proxy/Makefile b/tcp-proxy/Makefile index 62f2cb2c..f98a927b 100644 --- a/tcp-proxy/Makefile +++ b/tcp-proxy/Makefile @@ -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 diff --git a/tcp-proxy/tcp-proxy.cpp b/tcp-proxy/tcp-proxy.cpp index 31fda750..770ee02b 100644 --- a/tcp-proxy/tcp-proxy.cpp +++ b/tcp-proxy/tcp-proxy.cpp @@ -42,12 +42,15 @@ #include #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 phy(&svc,false,true); svc.phy = &phy; From 59b2f7354176f5a3b3a8c48f5e4be3cacb032d50 Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Mon, 6 May 2024 19:31:02 -0700 Subject: [PATCH 3/7] move this --- tcp-proxy/tcp-proxy.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcp-proxy/tcp-proxy.cpp b/tcp-proxy/tcp-proxy.cpp index 770ee02b..a659ccc4 100644 --- a/tcp-proxy/tcp-proxy.cpp +++ b/tcp-proxy/tcp-proxy.cpp @@ -271,8 +271,8 @@ struct TcpProxyService Client &c = *((Client *)*uptr); if (c.tcpWritePtr) { long n = phy->streamSend(sock,c.tcpWriteBuf,c.tcpWritePtr); - Metrics::tcp_bytes_out += n; if (n > 0) { + Metrics::tcp_bytes_out += n; memmove(c.tcpWriteBuf,c.tcpWriteBuf + n,c.tcpWritePtr -= (unsigned long)n); if (!c.tcpWritePtr) phy->setNotifyWritable(sock,false); From b71e7bd0ab3d07b7ab5f778326c25deeb08a3cf9 Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Wed, 8 May 2024 12:36:57 -0700 Subject: [PATCH 4/7] add metric for open tcp connections --- tcp-proxy/Metrics.cpp | 3 +++ tcp-proxy/Metrics.hpp | 2 ++ tcp-proxy/tcp-proxy.cpp | 2 ++ 3 files changed, 7 insertions(+) diff --git a/tcp-proxy/Metrics.cpp b/tcp-proxy/Metrics.cpp index e6cc68f1..db14f3a7 100644 --- a/tcp-proxy/Metrics.cpp +++ b/tcp-proxy/Metrics.cpp @@ -3,6 +3,9 @@ namespace ZeroTier { namespace Metrics { + prometheus::simpleapi::gauge_metric_t tcp_connections + {"tcp_connections", "TCP connections"}; + prometheus::simpleapi::counter_metric_t udp_open_failed {"udp_open_failed", "UDP open failed"}; diff --git a/tcp-proxy/Metrics.hpp b/tcp-proxy/Metrics.hpp index 4211c9b8..1ffe891a 100644 --- a/tcp-proxy/Metrics.hpp +++ b/tcp-proxy/Metrics.hpp @@ -5,6 +5,8 @@ namespace ZeroTier { namespace Metrics { + extern prometheus::simpleapi::gauge_metric_t tcp_connections; + extern prometheus::simpleapi::counter_metric_t udp_open_failed; extern prometheus::simpleapi::counter_metric_t tcp_opened; diff --git a/tcp-proxy/tcp-proxy.cpp b/tcp-proxy/tcp-proxy.cpp index a659ccc4..f770a42f 100644 --- a/tcp-proxy/tcp-proxy.cpp +++ b/tcp-proxy/tcp-proxy.cpp @@ -191,6 +191,7 @@ struct TcpProxyService *uptrN = (void *)&c; printf("<< TCP from %s -> %.16llx\n",inet_ntoa(reinterpret_cast(from)->sin_addr),(unsigned long long)&c); Metrics::tcp_opened++; + Metrics::tcp_connections++; } void phyOnTcpClose(PhySocket *sock,void **uptr) @@ -293,6 +294,7 @@ struct TcpProxyService for(std::vector::iterator s(toClose.begin());s!=toClose.end();++s) { phy->close(*s); Metrics::tcp_closed++; + Metrics::tcp_connections--; } } }; From aed3afdd2e328a42bf79bc5e5ebdf7db0a409c06 Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Thu, 9 May 2024 09:35:54 -0700 Subject: [PATCH 5/7] also install x64 rust in github action --- .github/workflows/build.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b983a4bc..82d0207a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,13 +43,20 @@ jobs: # git config --global core.eol lf - name: checkout uses: actions/checkout@v3 - - name: Install Rust + - name: Install Rust aarch64 uses: actions-rs/toolchain@v1 with: toolchain: stable target: aarch64-apple-darwin override: true components: rustfmt, clippy + - name: Install Rust x86_64 + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: x86_64-apple-darwin + override: true + components: rustfmt, clippy - name: Set up cargo cache uses: Swatinem/rust-cache@v2 continue-on-error: false From 219133a2c8a22422d294562d73495e5b0accebc5 Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Thu, 9 May 2024 12:21:51 -0700 Subject: [PATCH 6/7] allow setting the port to listen on via cmdline argument --- tcp-proxy/tcp-proxy.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tcp-proxy/tcp-proxy.cpp b/tcp-proxy/tcp-proxy.cpp index f770a42f..f8bc6464 100644 --- a/tcp-proxy/tcp-proxy.cpp +++ b/tcp-proxy/tcp-proxy.cpp @@ -321,11 +321,21 @@ int main(int argc,char **argv) svc.phy = &phy; svc.udpPortCounter = 1023; + uint16_t listenPort = ZT_TCP_PROXY_TCP_PORT; + if (argc > 1) { + listenPort = (uint16_t)atoi(argv[1]); + } + + if (listenPort == 0) { + fprintf(stderr,"%s: fatal error: invalid port number\n",argv[0]); + return 1; + } + { struct sockaddr_in laddr; memset(&laddr,0,sizeof(laddr)); laddr.sin_family = AF_INET; - laddr.sin_port = htons(ZT_TCP_PROXY_TCP_PORT); + laddr.sin_port = htons(listenPort); if (!phy.tcpListen((const struct sockaddr *)&laddr)) { fprintf(stderr,"%s: fatal error: unable to bind TCP port %d\n",argv[0],ZT_TCP_PROXY_TCP_PORT); return 1; From 06c634ab576b67fba66f2d47c954cd1d6a66ea1a Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Thu, 9 May 2024 12:52:57 -0700 Subject: [PATCH 7/7] comment out metrics for now --- tcp-proxy/Metrics.cpp | 32 ++++++++++++++++---------------- tcp-proxy/Metrics.hpp | 16 ++++++++-------- tcp-proxy/tcp-proxy.cpp | 38 +++++++++++++++++++------------------- 3 files changed, 43 insertions(+), 43 deletions(-) diff --git a/tcp-proxy/Metrics.cpp b/tcp-proxy/Metrics.cpp index db14f3a7..bd4c3470 100644 --- a/tcp-proxy/Metrics.cpp +++ b/tcp-proxy/Metrics.cpp @@ -3,25 +3,25 @@ namespace ZeroTier { namespace Metrics { - prometheus::simpleapi::gauge_metric_t tcp_connections - {"tcp_connections", "TCP connections"}; + // prometheus::simpleapi::gauge_metric_t tcp_connections + // {"tcp_connections", "TCP connections"}; - prometheus::simpleapi::counter_metric_t udp_open_failed - {"udp_open_failed", "UDP open failed"}; + // prometheus::simpleapi::counter_metric_t udp_open_failed + // {"udp_open_failed", "UDP open failed"}; - prometheus::simpleapi::counter_metric_t tcp_opened - {"tcp_opened", "TCP opened"}; - prometheus::simpleapi::counter_metric_t tcp_closed - {"tcp_closed", "TCP closed"}; + // prometheus::simpleapi::counter_metric_t tcp_opened + // {"tcp_opened", "TCP opened"}; + // prometheus::simpleapi::counter_metric_t tcp_closed + // {"tcp_closed", "TCP closed"}; - prometheus::simpleapi::counter_metric_t tcp_bytes_in - {"tcp_byes_in", "TCP bytes in"}; - prometheus::simpleapi::counter_metric_t tcp_bytes_out - {"tcp_byes_out", "TCP bytes out"}; + // prometheus::simpleapi::counter_metric_t tcp_bytes_in + // {"tcp_byes_in", "TCP bytes in"}; + // prometheus::simpleapi::counter_metric_t tcp_bytes_out + // {"tcp_byes_out", "TCP bytes out"}; - prometheus::simpleapi::counter_metric_t udp_bytes_in - {"udp_bytes_in", "UDP bytes in"}; - prometheus::simpleapi::counter_metric_t udp_bytes_out - {"udp_bytes_out", "UDP bytes out"}; + // prometheus::simpleapi::counter_metric_t udp_bytes_in + // {"udp_bytes_in", "UDP bytes in"}; + // prometheus::simpleapi::counter_metric_t udp_bytes_out + // {"udp_bytes_out", "UDP bytes out"}; } } \ No newline at end of file diff --git a/tcp-proxy/Metrics.hpp b/tcp-proxy/Metrics.hpp index 1ffe891a..024b688a 100644 --- a/tcp-proxy/Metrics.hpp +++ b/tcp-proxy/Metrics.hpp @@ -5,18 +5,18 @@ namespace ZeroTier { namespace Metrics { - extern prometheus::simpleapi::gauge_metric_t tcp_connections; + // extern prometheus::simpleapi::gauge_metric_t tcp_connections; - extern prometheus::simpleapi::counter_metric_t udp_open_failed; + // extern prometheus::simpleapi::counter_metric_t udp_open_failed; - extern prometheus::simpleapi::counter_metric_t tcp_opened; - extern prometheus::simpleapi::counter_metric_t tcp_closed; + // extern prometheus::simpleapi::counter_metric_t tcp_opened; + // extern prometheus::simpleapi::counter_metric_t tcp_closed; - extern prometheus::simpleapi::counter_metric_t tcp_bytes_in; - extern prometheus::simpleapi::counter_metric_t tcp_bytes_out; + // extern prometheus::simpleapi::counter_metric_t tcp_bytes_in; + // extern prometheus::simpleapi::counter_metric_t tcp_bytes_out; - extern prometheus::simpleapi::counter_metric_t udp_bytes_in; - extern prometheus::simpleapi::counter_metric_t udp_bytes_out; + // extern prometheus::simpleapi::counter_metric_t udp_bytes_in; + // extern prometheus::simpleapi::counter_metric_t udp_bytes_out; } } diff --git a/tcp-proxy/tcp-proxy.cpp b/tcp-proxy/tcp-proxy.cpp index f8bc6464..2d0e85c0 100644 --- a/tcp-proxy/tcp-proxy.cpp +++ b/tcp-proxy/tcp-proxy.cpp @@ -130,7 +130,7 @@ struct TcpProxyService if (!*uptr) return; if ((from->sa_family == AF_INET)&&(len >= 16)&&(len < 2048)) { - Metrics::udp_bytes_in += len; + // Metrics::udp_bytes_in += len; Client &c = *((Client *)*uptr); c.lastActivity = time((time_t *)0); @@ -176,7 +176,7 @@ struct TcpProxyService Client &c = clients[sockN]; PhySocket *udp = getUnusedUdp((void *)&c); if (!udp) { - Metrics::udp_open_failed++; + // Metrics::udp_open_failed++; phy->close(sockN); clients.erase(sockN); printf("** TCP rejected, no more UDP ports to assign\n"); @@ -190,8 +190,8 @@ struct TcpProxyService c.newVersion = false; *uptrN = (void *)&c; printf("<< TCP from %s -> %.16llx\n",inet_ntoa(reinterpret_cast(from)->sin_addr),(unsigned long long)&c); - Metrics::tcp_opened++; - Metrics::tcp_connections++; + // Metrics::tcp_opened++; + // Metrics::tcp_connections++; } void phyOnTcpClose(PhySocket *sock,void **uptr) @@ -202,7 +202,7 @@ struct TcpProxyService phy->close(c.udp); clients.erase(sock); printf("** TCP %.16llx closed\n",(unsigned long long)*uptr); - Metrics::tcp_closed++; + // Metrics::tcp_closed++; } void phyOnTcpData(PhySocket *sock,void **uptr,void *data,unsigned long len) @@ -210,7 +210,7 @@ struct TcpProxyService Client &c = *((Client *)*uptr); c.lastActivity = time((time_t *)0); - Metrics::tcp_bytes_in += len; + // Metrics::tcp_bytes_in += len; for(unsigned long i=0;i= sizeof(c.tcpReadBuf)) { @@ -257,7 +257,7 @@ struct TcpProxyService if ((ntohs(dest.sin_port) > 1024)&&(payloadLen >= 16)) { phy->udpSend(c.udp,(const struct sockaddr *)&dest,payload,payloadLen); printf(">> TCP %.16llx to %s:%d\n",(unsigned long long)*uptr,inet_ntoa(dest.sin_addr),(int)ntohs(dest.sin_port)); - Metrics::udp_bytes_out += payloadLen; + // Metrics::udp_bytes_out += payloadLen; } } @@ -273,7 +273,7 @@ struct TcpProxyService if (c.tcpWritePtr) { long n = phy->streamSend(sock,c.tcpWriteBuf,c.tcpWritePtr); if (n > 0) { - Metrics::tcp_bytes_out += n; + // Metrics::tcp_bytes_out += n; memmove(c.tcpWriteBuf,c.tcpWriteBuf + n,c.tcpWritePtr -= (unsigned long)n); if (!c.tcpWritePtr) phy->setNotifyWritable(sock,false); @@ -293,8 +293,8 @@ struct TcpProxyService } for(std::vector::iterator s(toClose.begin());s!=toClose.end();++s) { phy->close(*s); - Metrics::tcp_closed++; - Metrics::tcp_connections--; + // Metrics::tcp_closed++; + // Metrics::tcp_connections--; } } }; @@ -305,16 +305,16 @@ 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; - } - } + // 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"); + // 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 phy(&svc,false,true);