lordgamez commented on code in PR #1587:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1587#discussion_r1235332846


##########
docker/test/integration/cluster/checkers/PrometheusChecker.py:
##########
@@ -18,7 +18,16 @@
 
 class PrometheusChecker:
     def __init__(self):
-        self.prometheus_client = 
PrometheusConnect(url="http://localhost:9090";, disable_ssl=True)
+        self.use_ssl = False
+
+    def enable_ssl(self):
+        self.use_ssl = True
+
+    def _getClient(self):
+        if self.use_ssl:
+            return PrometheusConnect(url="https://localhost:9090";, 
disable_ssl=True)

Review Comment:
   We don't want to use SSL verification for the python client when connecting 
from this checker. We only need SSL verification between the MiNiFi and the 
Prometheus server.



##########
docker/test/integration/cluster/containers/MinifiContainer.py:
##########
@@ -109,12 +110,16 @@ def _create_properties(self):
             if not self.options.enable_provenance:
                 
f.write("nifi.provenance.repository.class.name=NoOpRepository\n")
 
-            if self.options.enable_prometheus:
+            if self.options.enable_prometheus or 
self.options.enable_prometheus_with_ssl:
                 f.write("nifi.metrics.publisher.agent.identifier=Agent1\n")
                 
f.write("nifi.metrics.publisher.class=PrometheusMetricsPublisher\n")
                 
f.write("nifi.metrics.publisher.PrometheusMetricsPublisher.port=9936\n")
                 
f.write("nifi.metrics.publisher.metrics=RepositoryMetrics,QueueMetrics,PutFileMetrics,processorMetrics/Get.*,FlowInformation,DeviceInfoNode,AgentStatus\n")
 
+            if self.options.enable_prometheus_with_ssl:
+                
f.write("nifi.metrics.publisher.PrometheusMetricsPublisher.certificate=/tmp/resources/prometheus-ssl/minifi-cpp-flow.crt\n")
+                
f.write("nifi.metrics.publisher.PrometheusMetricsPublisher.ca.certificate=/tmp/resources/prometheus-ssl/root-ca.pem\n")

Review Comment:
   In this case MiNiFi works as a web server as it exposes metrics through a 
CivetWeb server implemented by the prometheus cpp library. Civetweb requires a 
merged crt+key file. For communication over SSL the Prometheus server also 
needs to be configured with a separate key and a certificate pair.



##########
extensions/prometheus/PrometheusMetricsPublisher.cpp:
##########
@@ -33,18 +33,28 @@ 
PrometheusMetricsPublisher::PrometheusMetricsPublisher(const std::string &name,
 void PrometheusMetricsPublisher::initialize(const std::shared_ptr<Configure>& 
configuration, const std::shared_ptr<state::response::ResponseNodeLoader>& 
response_node_loader) {
   state::MetricsPublisher::initialize(configuration, response_node_loader);
   if (!exposer_) {
-    exposer_ = std::make_unique<PrometheusExposerWrapper>(readPort());
+    exposer_ = std::make_unique<PrometheusExposerWrapper>(readExposerConfig());
   }
   loadAgentIdentifier();
 }
 
-uint32_t PrometheusMetricsPublisher::readPort() {
+PrometheusExposerConfig PrometheusMetricsPublisher::readExposerConfig() const {
   gsl_Expects(configuration_);
+  PrometheusExposerConfig config;
   if (auto port = 
configuration_->get(Configuration::nifi_metrics_publisher_prometheus_metrics_publisher_port))
 {
-    return std::stoul(*port);
+    config.port = std::stoul(*port);

Review Comment:
   Updated in 7a0581681d7938a60feb31944baa96415abb4d64



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to