diff options
author | Daniil Baturin <daniil@vyos.io> | 2025-07-08 15:48:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-08 15:48:23 +0100 |
commit | 2fa5d19d86c82f4519bd6aa05ba0c7d571172f3a (patch) | |
tree | f1ad8d2b87dea6c45bf62a48e8f38bd346552119 /src | |
parent | 6e07126620f75307704b9f6239c5d1f7c54af1e8 (diff) | |
parent | c3d79b704b327c4605e6a3d65a56e48ade8c6b98 (diff) | |
download | vyos-1x-2fa5d19d86c82f4519bd6aa05ba0c7d571172f3a.tar.gz vyos-1x-2fa5d19d86c82f4519bd6aa05ba0c7d571172f3a.zip |
Merge pull request #4594 from sever-sever/T7528-monitoring
T7528: Fix service monitoring prometheus stops services
Diffstat (limited to 'src')
-rwxr-xr-x | src/conf_mode/service_monitoring_prometheus.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/conf_mode/service_monitoring_prometheus.py b/src/conf_mode/service_monitoring_prometheus.py index f8442c392..b02f9f154 100755 --- a/src/conf_mode/service_monitoring_prometheus.py +++ b/src/conf_mode/service_monitoring_prometheus.py @@ -23,6 +23,7 @@ from vyos.configdict import is_node_changed from vyos.configverify import verify_vrf from vyos.template import render from vyos.utils.process import call +from vyos.utils.process import is_systemd_service_active from vyos import ConfigError from vyos import airbag @@ -173,11 +174,14 @@ def apply(monitoring): # Reload systemd manager configuration call('systemctl daemon-reload') if not monitoring or 'node_exporter' not in monitoring: - call(f'systemctl stop {node_exporter_systemd_service}') + if is_systemd_service_active(node_exporter_systemd_service): + call(f'systemctl stop {node_exporter_systemd_service}') if not monitoring or 'frr_exporter' not in monitoring: - call(f'systemctl stop {frr_exporter_systemd_service}') + if is_systemd_service_active(frr_exporter_systemd_service): + call(f'systemctl stop {frr_exporter_systemd_service}') if not monitoring or 'blackbox_exporter' not in monitoring: - call(f'systemctl stop {blackbox_exporter_systemd_service}') + if is_systemd_service_active(blackbox_exporter_systemd_service): + call(f'systemctl stop {blackbox_exporter_systemd_service}') if not monitoring: return |