summaryrefslogtreecommitdiffstats
path: root/src/cephadm
diff options
context:
space:
mode:
authorAdam King <47704447+adk3798@users.noreply.github.com>2024-04-30 21:23:59 +0200
committerGitHub <noreply@github.com>2024-04-30 21:23:59 +0200
commitdfbc73961128c89cbe5951f64402fca1526f9c71 (patch)
tree4ed01f4a29e9a4a605495d6b04f2114438543deb /src/cephadm
parentMerge PR #57044 into main (diff)
parentcephadm: allow passing custom prometheus alerts to bootstrap (diff)
downloadceph-dfbc73961128c89cbe5951f64402fca1526f9c71.tar.xz
ceph-dfbc73961128c89cbe5951f64402fca1526f9c71.zip
Merge pull request #56487 from adk3798/bootstrap-custom-alerts
cephadm: allow passing custom prometheus alerts to bootstrap Reviewed-by: John Mulligan <jmulligan@redhat.com>
Diffstat (limited to 'src/cephadm')
-rwxr-xr-xsrc/cephadm/cephadm.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/cephadm/cephadm.py b/src/cephadm/cephadm.py
index 0a8292c5f00..3cab1644f18 100755
--- a/src/cephadm/cephadm.py
+++ b/src/cephadm/cephadm.py
@@ -2776,6 +2776,11 @@ def command_bootstrap(ctx):
except PermissionError:
raise Error(f'Unable to create {dirname} due to permissions failure. Retry with root, or sudo or preallocate the directory.')
+ if getattr(ctx, 'custom_prometheus_alerts', None):
+ ctx.custom_prometheus_alerts = os.path.abspath(ctx.custom_prometheus_alerts)
+ if not os.path.isfile(ctx.custom_prometheus_alerts):
+ raise Error(f'No custom prometheus alerts file found at {ctx.custom_prometheus_alerts}')
+
(user_conf, _) = get_config_and_keyring(ctx)
if ctx.ssh_user != 'root':
@@ -2848,6 +2853,8 @@ def command_bootstrap(ctx):
admin_keyring.name: '/etc/ceph/ceph.client.admin.keyring:z',
tmp_config.name: '/etc/ceph/ceph.conf:z',
}
+ if getattr(ctx, 'custom_prometheus_alerts', None):
+ mounts[ctx.custom_prometheus_alerts] = '/etc/ceph/custom_alerts.yml:z'
for k, v in extra_mounts.items():
mounts[k] = v
timeout = timeout or ctx.timeout
@@ -2992,6 +2999,9 @@ def command_bootstrap(ctx):
if getattr(ctx, 'deploy_cephadm_agent', None):
cli(['config', 'set', 'mgr', 'mgr/cephadm/use_agent', 'true'])
+ if getattr(ctx, 'custom_prometheus_alerts', None):
+ cli(['orch', 'prometheus', 'set-custom-alerts', '-i', '/etc/ceph/custom_alerts.yml'])
+
return ctx.error_code
##################################
@@ -5394,6 +5404,9 @@ def _get_parser():
'--deploy-cephadm-agent',
action='store_true',
help='deploy the cephadm-agent')
+ parser_bootstrap.add_argument(
+ '--custom-prometheus-alerts',
+ help='provide a file with custom prometheus alerts')
parser_deploy = subparsers.add_parser(
'deploy', help='deploy a daemon')