From 443d554f303aa910c9699df9ce5a05eefe20f9ac Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Sun, 12 Aug 2018 22:28:00 -0400 Subject: [PATCH] stap-exporter: more verbosity, fix autoconf script_dir --- stap-exporter/Makefile.am | 1 + stap-exporter/Makefile.in | 1 + stap-exporter/stap-exporter.in | 7 +++++-- systemtap.spec | 2 ++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/stap-exporter/Makefile.am b/stap-exporter/Makefile.am index acce25512..b8c7c14ed 100644 --- a/stap-exporter/Makefile.am +++ b/stap-exporter/Makefile.am @@ -10,6 +10,7 @@ man8_MANS = stap-exporter.8 install-data-local: $(MKDIR_P) "$(DESTDIR)$(sysconfdir)/systemtap/stap-exporter" + $(MKDIR_P) "$(DESTDIR)$(sysconfdir)/systemtap/stap-exporter/autostart" $(MKDIR_P) "$(DESTDIR)$(prefix)/lib/systemd/system" $(INSTALL_DATA) $(srcdir)/stap-exporter.service "$(DESTDIR)$(prefix)/lib/systemd/system" diff --git a/stap-exporter/Makefile.in b/stap-exporter/Makefile.in index 5693af5dc..437795e00 100644 --- a/stap-exporter/Makefile.in +++ b/stap-exporter/Makefile.in @@ -608,6 +608,7 @@ uninstall-man: uninstall-man8 @HAVE_PYTHON3_PROBES_TRUE@install-data-local: @HAVE_PYTHON3_PROBES_TRUE@ $(MKDIR_P) "$(DESTDIR)$(sysconfdir)/systemtap/stap-exporter" +@HAVE_PYTHON3_PROBES_TRUE@ $(MKDIR_P) "$(DESTDIR)$(sysconfdir)/systemtap/stap-exporter/autostart" @HAVE_PYTHON3_PROBES_TRUE@ $(MKDIR_P) "$(DESTDIR)$(prefix)/lib/systemd/system" @HAVE_PYTHON3_PROBES_TRUE@ $(INSTALL_DATA) $(srcdir)/stap-exporter.service "$(DESTDIR)$(prefix)/lib/systemd/system" diff --git a/stap-exporter/stap-exporter.in b/stap-exporter/stap-exporter.in index ba32c1de8..2b5907319 100644 --- a/stap-exporter/stap-exporter.in +++ b/stap-exporter/stap-exporter.in @@ -9,7 +9,7 @@ from http.server import BaseHTTPRequestHandler, HTTPServer from urllib.parse import urlparse from time import time -script_dir = "%sysconfdir%/systemtap/stap-exporter" +script_dir = "%sysconfdir%/systemtap/stap-exporter/" proc_path = "/proc/systemtap/__systemtap_exporter" @@ -24,7 +24,7 @@ class Session: def begin(self): self.process = subprocess.Popen(shlex.split(self.cmd)) - + def get_proc_path(self): return proc_path + str(self.id) + "/" + self.name @@ -52,6 +52,7 @@ class SessionMgr: self.sessions[script_name] = s s.begin() s.set_start_time() + print("Started %s via %s" % (s.name, s.cmd)) def parse_cmdline(self): p = argparse.ArgumentParser(description='Systemtap-prometheus interoperation mechanism') @@ -104,6 +105,7 @@ class HTTPHandler(BaseHTTPRequestHandler): with open(metrics_path) as metrics: self.set_headers(200, 'text/plain') self.wfile.write(bytes(metrics.read(), 'utf-8')) + # XXX: log metrics.size except: self.set_headers(501, 'text/plain') self.wfile.write(bytes('Metrics currently unavailable', 'utf-8')) @@ -131,6 +133,7 @@ if __name__ == "__main__": httpd = HTTPServer(server_address, HTTPHandler) httpd.timeout = 5 print("Exporter initialization complete") + print("Listening on port %d" % sessmgr.port) while 1: httpd.handle_request() diff --git a/systemtap.spec b/systemtap.spec index f55b7a7b4..78d5dc044 100644 --- a/systemtap.spec +++ b/systemtap.spec @@ -1243,9 +1243,11 @@ done %if %{with_python3} %files stap-exporter +%{_sysconfdir}/systemtap/stap-exporter %{_unitdir}/stap-exporter.service %{_mandir}/man8/stap-exporter.8* %{_sbindir}/stap-exporter +%{_etcdir}/stap-exporter %endif # ------------------------------------------------------------------------ -- 2.43.5