Skip to content

Commit ca98e37

Browse files
authored
Disable docker service health file by default. (librenms#17444)
* Disable docker service health file by default. * fix whitespace
1 parent 4a967bf commit ca98e37

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

LibreNMS/service.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def __init__(self, workers, frequency, calculate=None):
105105

106106
watchdog_enabled = False
107107
watchdog_logfile = "logs/librenms.log"
108-
health_file = "/tmp/librenms.health"
108+
health_file = "" # disabled by default
109109

110110
def populate(self):
111111
config = LibreNMS.get_config_data(self.BASE_DIR)
@@ -415,8 +415,11 @@ def __init__(self):
415415
)
416416
else:
417417
logger.info("Watchdog is disabled.")
418-
with open(self.config.health_file, "a") as f:
419-
utime(self.config.health_file)
418+
if self.config.health_file:
419+
with open(self.config.health_file, "a") as f:
420+
utime(self.config.health_file)
421+
else:
422+
logger.info("Service health file disabled.")
420423
self.systemd_watchdog_timer = LibreNMS.RecurringTimer(
421424
10, self.systemd_watchdog, "systemd-watchdog"
422425
)
@@ -920,7 +923,8 @@ def log_performance_stats(self):
920923
)
921924

922925
def systemd_watchdog(self):
923-
utime(self.config.health_file)
926+
if self.config.health_file:
927+
utime(self.config.health_file)
924928
if "systemd.daemon" in sys.modules:
925929
notify("WATCHDOG=1")
926930

app/Console/Commands/HealthCheck.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ public function handle(): int
5656
if (getenv('SIDECAR_DISPATCHER')) {
5757
// check dispatcher
5858
$health_file = \LibreNMS\Config::get('service_health_file');
59+
60+
if (! $health_file) {
61+
$this->warn('Dispatcher service health file not enabled, set service_health_file');
62+
63+
return 0;
64+
}
65+
5966
if (! file_exists($health_file)) {
6067
$this->error('Dispatcher service not started yet');
6168

misc/config_definitions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6150,7 +6150,7 @@
61506150
"units": "seconds"
61516151
},
61526152
"service_health_file": {
6153-
"default": "/tmp/librenms.health",
6153+
"default": "",
61546154
"group": "poller",
61556155
"section": "distributed",
61566156
"order": 29,

0 commit comments

Comments
 (0)