@@ -115,16 +115,19 @@ def generate(monitoring):
115
115
# Delete systemd files
116
116
if os .path .isfile (node_exporter_service_file ):
117
117
os .unlink (node_exporter_service_file )
118
+ monitoring .update ({'node_exporter_stop_required' : {}})
118
119
119
120
if not monitoring or 'frr_exporter' not in monitoring :
120
121
# Delete systemd files
121
122
if os .path .isfile (frr_exporter_service_file ):
122
123
os .unlink (frr_exporter_service_file )
124
+ monitoring .update ({'frr_exporter_stop_required' : {}})
123
125
124
126
if not monitoring or 'blackbox_exporter' not in monitoring :
125
127
# Delete systemd files
126
128
if os .path .isfile (blackbox_exporter_service_file ):
127
129
os .unlink (blackbox_exporter_service_file )
130
+ monitoring .update ({'blackbox_exporter_stop_required' : {}})
128
131
129
132
if not monitoring :
130
133
return None
@@ -173,11 +176,14 @@ def apply(monitoring):
173
176
# Reload systemd manager configuration
174
177
call ('systemctl daemon-reload' )
175
178
if not monitoring or 'node_exporter' not in monitoring :
176
- call (f'systemctl stop { node_exporter_systemd_service } ' )
179
+ if 'node_exporter_stop_required' in monitoring :
180
+ call (f'systemctl stop { node_exporter_systemd_service } ' )
177
181
if not monitoring or 'frr_exporter' not in monitoring :
178
- call (f'systemctl stop { frr_exporter_systemd_service } ' )
182
+ if 'frr_exporter_stop_required' in monitoring :
183
+ call (f'systemctl stop { frr_exporter_systemd_service } ' )
179
184
if not monitoring or 'blackbox_exporter' not in monitoring :
180
- call (f'systemctl stop { blackbox_exporter_systemd_service } ' )
185
+ if 'blackbox_exporter_stop_required' in monitoring :
186
+ call (f'systemctl stop { blackbox_exporter_systemd_service } ' )
181
187
182
188
if not monitoring :
183
189
return
0 commit comments