@@ -19,6 +19,7 @@ class Server: # type: ignore
1919from cephadm .services .ingress import IngressSpec
2020from cephadm .ssl_cert_utils import SSLCerts
2121from cephadm .services .cephadmservice import CephExporterService
22+ from cephadm .services .nvmeof import NvmeofService
2223
2324if TYPE_CHECKING :
2425 from cephadm .module import CephadmOrchestrator
@@ -145,6 +146,7 @@ def index(self) -> str:
145146<p><a href='prometheus/sd-config?service=node-exporter'>Node exporter http sd-config</a></p>
146147<p><a href='prometheus/sd-config?service=haproxy'>HAProxy http sd-config</a></p>
147148<p><a href='prometheus/sd-config?service=ceph-exporter'>Ceph exporter http sd-config</a></p>
149+ <p><a href='prometheus/sd-config?service=nvmeof'>NVMeoF http sd-config</a></p>
148150<p><a href='prometheus/rules'>Prometheus rules</a></p>
149151</body>
150152</html>'''
@@ -163,6 +165,8 @@ def get_sd_config(self, service: str) -> List[Dict[str, Collection[str]]]:
163165 return self .haproxy_sd_config ()
164166 elif service == 'ceph-exporter' :
165167 return self .ceph_exporter_sd_config ()
168+ elif service == 'nvmeof' :
169+ return self .nvmeof_sd_config ()
166170 else :
167171 return []
168172
@@ -231,6 +235,19 @@ def ceph_exporter_sd_config(self) -> List[Dict[str, Collection[str]]]:
231235 })
232236 return srv_entries
233237
238+ def nvmeof_sd_config (self ) -> List [Dict [str , Collection [str ]]]:
239+ """Return <http_sd_config> compatible prometheus config for nvmeof service."""
240+ srv_entries = []
241+ for dd in self .mgr .cache .get_daemons_by_type ('nvmeof' ):
242+ assert dd .hostname is not None
243+ addr = dd .ip if dd .ip else self .mgr .inventory .get_addr (dd .hostname )
244+ port = NvmeofService .PROMETHEUS_PORT
245+ srv_entries .append ({
246+ 'targets' : [build_url (host = addr , port = port ).lstrip ('/' )],
247+ 'labels' : {'instance' : dd .hostname }
248+ })
249+ return srv_entries
250+
234251 @cherrypy .expose (alias = 'prometheus/rules' )
235252 def get_prometheus_rules (self ) -> str :
236253 """Return currently configured prometheus rules as Yaml."""
0 commit comments