]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/orchestrator: Add alertmanager hooks
authorKristoffer Grönlund <kgronlund@suse.com>
Wed, 26 Feb 2020 12:09:07 +0000 (13:09 +0100)
committerKristoffer Grönlund <kgronlund@suse.com>
Thu, 27 Feb 2020 08:58:16 +0000 (09:58 +0100)
Signed-off-by: Kristoffer Grönlund <kgronlund@suse.com>
src/pybind/mgr/orchestrator/_interface.py
src/pybind/mgr/orchestrator/module.py

index 6a521744d8fba37e1c6396118f7c957e1a886c1e..f904867fb0f8c79ad95c854521b5bd7167b08e87 100644 (file)
@@ -1081,6 +1081,16 @@ class Orchestrator(object):
         """Update existing a Node-Exporter daemon(s)"""
         raise NotImplementedError()
 
+    def add_alertmanager(self, spec):
+        # type: (ServiceSpec) -> Completion
+        """Create a new AlertManager service"""
+        raise NotImplementedError()
+
+    def apply_alertmanager(self, spec):
+        # type: (ServiceSpec) -> Completion
+        """Update an existing AlertManager daemon(s)"""
+        raise NotImplementedError()
+
     def upgrade_check(self, image, version):
         # type: (Optional[str], Optional[str]) -> Completion
         raise NotImplementedError()
index 4aaea608928358f5a5c4d7abff5ee5b5536a942a..a89c69d353e6ad78a37ed57fc631c5f788c1e72f 100644 (file)
@@ -616,6 +616,21 @@ Usage:
         self._orchestrator_wait([completion])
         return HandleCommandResult(stdout=completion.result_str())
 
+    @_cli_write_command(
+        'orch daemon add alertmanager',
+        'name=num,type=CephInt,req=false '
+        'name=hosts,type=CephString,n=N,req=false '
+        'name=label,type=CephString,req=false',
+        'Add alertmanager daemon(s)')
+    def _daemon_add_alertmanager(self, num=None, label=None, hosts=[]):
+        # type: (Optional[int], Optional[str], List[str]) -> HandleCommandResult
+        spec = ServiceSpec(
+            placement=PlacementSpec(label=label, hosts=hosts, count=num),
+        )
+        completion = self.add_alertmanager(spec)
+        self._orchestrator_wait([completion])
+        return HandleCommandResult(stdout=completion.result_str())
+
     @_cli_write_command(
         'orch',
         "name=action,type=CephChoices,strings=start|stop|restart|redeploy|reconfig "