From: Sage Weil Date: Tue, 4 Feb 2020 19:13:55 +0000 (-0600) Subject: mgr/orch: add prom hooks X-Git-Tag: v15.1.1~412^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9c20e3961f4066f85fa90257f486bac988b7ce4c;p=ceph.git mgr/orch: add prom hooks Signed-off-by: Sage Weil --- diff --git a/src/pybind/mgr/orchestrator.py b/src/pybind/mgr/orchestrator.py index 6a6ae9959612..f098cf759d1d 100644 --- a/src/pybind/mgr/orchestrator.py +++ b/src/pybind/mgr/orchestrator.py @@ -1011,6 +1011,16 @@ class Orchestrator(object): """Update RGW cluster""" raise NotImplementedError() + def add_prometheus(self, spec): + # type: (ServiceSpec) -> Completion + """Create new prometheus daemon""" + raise NotImplementedError() + + def apply_prometheus(self, spec): + # type: (ServiceSpec) -> Completion + """Update prometheus cluster""" + raise NotImplementedError() + def upgrade_check(self, image, version): # type: (Optional[str], Optional[str]) -> Completion raise NotImplementedError() diff --git a/src/pybind/mgr/orchestrator_cli/module.py b/src/pybind/mgr/orchestrator_cli/module.py index 09762d21b660..204a6638b989 100644 --- a/src/pybind/mgr/orchestrator_cli/module.py +++ b/src/pybind/mgr/orchestrator_cli/module.py @@ -500,6 +500,21 @@ Usage: orchestrator.raise_if_exception(completion) return HandleCommandResult(stdout=completion.result_str()) + @orchestrator._cli_write_command( + 'orch daemon add prometheus', + 'name=num,type=CephInt,req=false ' + 'name=hosts,type=CephString,n=N,req=false ' + 'name=label,type=CephString,req=false', + 'Add prometheus daemon(s)') + def _daemon_add_prometheus(self, num=None, label=None, hosts=[]): + # type: (Optional[int], Optional[str], List[str]) -> HandleCommandResult + spec = orchestrator.ServiceSpec( + placement=orchestrator.PlacementSpec(label=label, hosts=hosts, count=num), + ) + completion = self.add_prometheus(spec) + self._orchestrator_wait([completion]) + return HandleCommandResult(stdout=completion.result_str()) + @orchestrator._cli_write_command( 'orch', "name=action,type=CephChoices,strings=start|stop|restart|redeploy|reconfig " @@ -668,6 +683,21 @@ Usage: self._orchestrator_wait([completion]) return HandleCommandResult(stdout=completion.result_str()) + @orchestrator._cli_write_command( + 'orch apply prometheus', + 'name=num,type=CephInt,req=false ' + 'name=hosts,type=CephString,n=N,req=false ' + 'name=label,type=CephString,req=false', + 'Scale prometheus service') + def _apply_prometheus(self, num=None, label=None, hosts=[]): + # type: (Optional[int], Optional[str], List[str]) -> HandleCommandResult + spec = orchestrator.ServiceSpec( + placement=orchestrator.PlacementSpec(label=label, hosts=hosts, count=num), + ) + completion = self.apply_prometheus(spec) + self._orchestrator_wait([completion]) + return HandleCommandResult(stdout=completion.result_str()) + @orchestrator._cli_write_command( 'orch set backend', "name=module_name,type=CephString,req=true",