Skip to content

Commit 4194303

Browse files
authored
Merge pull request ceph#58440 from jmolmo/tls_4_exporter
exporter: Added https(TLSv13) support Reviewed-by: Ernesto Puerta <[email protected]> Reviewed-by: Avan Thakkar <[email protected]>
2 parents 1e2414e + cb660d2 commit 4194303

File tree

7 files changed

+307
-178
lines changed

7 files changed

+307
-178
lines changed

src/common/options/ceph-exporter.yaml.in

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,20 @@ options:
2525
default: 9926
2626
services:
2727
- ceph-exporter
28+
- name: exporter_cert_file
29+
type: str
30+
level: advanced
31+
desc: Certificate file for TLS.
32+
default:
33+
services:
34+
- ceph-exporter
35+
- name: exporter_key_file
36+
type: str
37+
level: advanced
38+
desc: Key certificate file for TLS.
39+
default:
40+
services:
41+
- ceph-exporter
2842
- name: exporter_prio_limit
2943
type: int
3044
level: advanced

src/exporter/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
set(exporter_srcs
22
ceph_exporter.cc
33
DaemonMetricCollector.cc
4-
http_server.cc
4+
web_server.cc
55
util.cc
66
)
77
add_executable(ceph-exporter ${exporter_srcs})
88
target_link_libraries(ceph-exporter
9-
global-static ceph-common)
9+
global-static
10+
ceph-common
11+
OpenSSL::SSL)
1012
install(TARGETS ceph-exporter DESTINATION bin)

src/exporter/ceph_exporter.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "common/ceph_argparse.h"
22
#include "common/config.h"
33
#include "exporter/DaemonMetricCollector.h"
4-
#include "exporter/http_server.h"
4+
#include "exporter/web_server.h"
55
#include "global/global_init.h"
66
#include "global/global_context.h"
77

@@ -18,6 +18,8 @@ static void usage() {
1818
" --sock-dir: The path to ceph daemons socket files dir\n"
1919
" --addrs: Host ip address where exporter is deployed\n"
2020
" --port: Port to deploy exporter on. Default is 9926\n"
21+
" --cert-file: Path to the certificate file to use https\n"
22+
" --key-file: Path to the certificate key file to use https\n"
2123
" --prio-limit: Only perf counters greater than or equal to prio-limit are fetched. Default: 5\n"
2224
" --stats-period: Time to wait before sending requests again to exporter server (seconds). Default: 5s"
2325
<< std::endl;
@@ -48,6 +50,10 @@ int main(int argc, char **argv) {
4850
cct->_conf.set_val("exporter_addr", val);
4951
} else if (ceph_argparse_witharg(args, i, &val, "--port", (char *)NULL)) {
5052
cct->_conf.set_val("exporter_http_port", val);
53+
} else if (ceph_argparse_witharg(args, i, &val, "--cert-file", (char *)NULL)) {
54+
cct->_conf.set_val("exporter_cert_file", val);
55+
} else if (ceph_argparse_witharg(args, i, &val, "--key-file", (char *)NULL)) {
56+
cct->_conf.set_val("exporter_key_file", val);
5157
} else if (ceph_argparse_witharg(args, i, &val, "--prio-limit", (char *)NULL)) {
5258
cct->_conf.set_val("exporter_prio_limit", val);
5359
} else if (ceph_argparse_witharg(args, i, &val, "--stats-period", (char *)NULL)) {
@@ -58,7 +64,7 @@ int main(int argc, char **argv) {
5864
}
5965
common_init_finish(g_ceph_context);
6066

61-
boost::thread server_thread(http_server_thread_entrypoint);
67+
boost::thread server_thread(web_server_thread_entrypoint);
6268
DaemonMetricCollector &collector = collector_instance();
6369
collector.main();
6470
server_thread.join();

src/exporter/http_server.cc

Lines changed: 0 additions & 169 deletions
This file was deleted.

src/exporter/http_server.h

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)