def _create_node_exporter(self, daemon_id, host):
return self._create_daemon('node-exporter', daemon_id, host)
+ def add_grafana(self, spec):
+ # type: (orchestrator.ServiceSpec) -> AsyncCompletion
+ return self._add_daemon('grafana', spec, self._create_grafana)
+
+ def apply_grafana(self, spec):
+ # type: (orchestrator.ServiceSpec) -> AsyncCompletion
+ return self._apply_service('grafana', spec, self.add_grafana)
+
+ @async_map_completion
+ def _create_grafana(self, daemon_id, host):
+ return self._create_daemon('grafana', daemon_id, host)
+
def _get_container_image_id(self, image_name):
# pick a random host...
host = None
[out] = wait(cephadm_module, c)
match_glob(out, "Deployed node-exporter.* on host 'test'")
+ @mock.patch("cephadm.module.CephadmOrchestrator._run_cephadm", _run_cephadm('{}'))
+ @mock.patch("cephadm.module.CephadmOrchestrator.send_command")
+ @mock.patch("cephadm.module.CephadmOrchestrator.mon_command", mon_command)
+ @mock.patch("cephadm.module.CephadmOrchestrator._get_connection")
+ @mock.patch("cephadm.module.HostCache.save_host")
+ @mock.patch("cephadm.module.HostCache.rm_host")
+ def test_grafana(self, _send_command, _get_connection, _save_host, _rm_host, cephadm_module):
+ # type: (mock.Mock, mock.Mock, mock.Mock, mock.Mock, CephadmOrchestrator) -> None
+ with self._with_host(cephadm_module, 'test'):
+ ps = PlacementSpec(hosts=['test'], count=1)
+
+ c = cephadm_module.add_grafana(ServiceSpec(placement=ps))
+ [out] = wait(cephadm_module, c)
+ match_glob(out, "Deployed grafana.* on host 'test'")
+
@mock.patch("cephadm.module.CephadmOrchestrator._run_cephadm", _run_cephadm('{}'))
@mock.patch("cephadm.module.CephadmOrchestrator.send_command")
@mock.patch("cephadm.module.CephadmOrchestrator.mon_command", mon_command)