Skip to contentSkip to conversation

package/watchdogd: new package

PATCH Applied Joachim Wiberg 2 participants 3 messages Oct 10, 2021 – Oct 28, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/watchdogd: new package

This patch adds support for watchdogd, a watchdog daemon with built-in process supervisor[1] as well as support for monitoring memory & file descriptor leaks, and CPU load average. When a monitored resource reaches a high watermark, a warning message is logged and when critical level is reached, the cause is saved and the system is rebooted. On reboot the reset cause can be retrieved to help locate the culprit.

Support for SysV init script in this patch, and systemd unit file is installed from the one bundled with the package. Both files supoort additional command line options in /etc/default/watchdogd.

The Config.in is slightly big, but allows for disabling or adjusting the poll interval for each resource monitor.

For more information, see https://github.com/troglobit/watchdogd

[1]: processes must have their main loop instrumented for supervision.

---
 DEVELOPERS                       |  1 +
 package/Config.in                |  1 +
 package/watchdogd/Config.in      | 69 ++++++++++++++++++++++++++++++++
 package/watchdogd/S01watchdogd   | 47 ++++++++++++++++++++++
 package/watchdogd/watchdogd.hash |  5 +++
 package/watchdogd/watchdogd.mk   | 55 +++++++++++++++++++++++++
 6 files changed, 178 insertions(+)
 create mode 100644 package/watchdogd/Config.in
 create mode 100755 package/watchdogd/S01watchdogd
 create mode 100644 package/watchdogd/watchdogd.hash
 create mode 100644 package/watchdogd/watchdogd.mk
DEVELOPERS +1 -0
index 7ebfc9234b..cf68b94685 100644
@@ -1335,6 +1335,7 @@ F:	package/mg/
 F:	package/netcalc/
 F:	package/ssdp-responder/
 F:	package/sysklogd/
+F:	package/watchdogd/
 
 N:	Joao Pinto <[email protected]>
 F:	board/synopsys/vdk/
package/Config.in +1 -0
index 9fed0ab4cb..167a6339c1 100644
@@ -2540,6 +2540,7 @@ menu "System tools"
 	source "package/unscd/Config.in"
 	source "package/util-linux/Config.in"
 	source "package/watchdog/Config.in"
+	source "package/watchdogd/Config.in"
 	source "package/xdg-dbus-proxy/Config.in"
 	source "package/xen/Config.in"
 	source "package/xvisor/Config.in"
package/watchdogd/Config.in new file +69 -0

69 lines not on this page · raw message

package/watchdogd/S01watchdogd new file +47 -0

47 lines not on this page · raw message

package/watchdogd/watchdogd.hash new file +5 -0
new file mode 100644
index 0000000000..7c1acf0820
@@ -0,0 +1,5 @@
+# Upstream .sha256 from GitHub
+sha256 f36fdea9b323534a704c4c23d9af8050480bca4bdad89cdb50d26fcac316d172  watchdogd-3.4.tar.gz
+
+# Locally calculated
+sha256 fd685e20931174308c45a26418a7ce34d66704c4e4b92ab1d8299deb255cd676  LICENSE
package/watchdogd/watchdogd.mk new file +55 -0

55 lines not on this page · raw message

Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 11 lines · Joachim Wiberg

This patch adds support for watchdogd, a watchdog daemon with built-in process supervisor[1] as well as support for monitoring memory & file descriptor leaks, and CPU load average. When a monitored resource reaches a high watermark, a warning message is logged and when critical level is reached, the cause is saved and the system is rebooted. On reboot the reset cause can be retrieved to help locate the culprit.

Support for SysV init script in this patch, and systemd unit file is installed from the one bundled with the package. Both files supoort additional command line options in /etc/default/watchdogd.

Quoted 8 lines

The Config.in is slightly big, but allows for disabling or adjusting the poll interval for each resource monitor.

For more information, see https://github.com/troglobit/watchdogd

[1]: processes must have their main loop instrumented for supervision.

Applied to master, thanks, with changes specified below.

Quoted 62 lines
---
  DEVELOPERS                       |  1 +
  package/Config.in                |  1 +
  package/watchdogd/Config.in      | 69 ++++++++++++++++++++++++++++++++
  package/watchdogd/S01watchdogd   | 47 ++++++++++++++++++++++
  package/watchdogd/watchdogd.hash |  5 +++
  package/watchdogd/watchdogd.mk   | 55 +++++++++++++++++++++++++
  6 files changed, 178 insertions(+)

create mode 100644 package/watchdogd/Config.in create mode 100755 package/watchdogd/S01watchdogd create mode 100644 package/watchdogd/watchdogd.hash create mode 100644 package/watchdogd/watchdogd.mk

DEVELOPERS +1 -0
index 7ebfc9234b..cf68b94685 100644
@@ -1335,6 +1335,7 @@ F:	package/mg/
  F:	package/netcalc/
  F:	package/ssdp-responder/
  F:	package/sysklogd/
+F:	package/watchdogd/
 
  N:	Joao Pinto <[email protected]>
  F:	board/synopsys/vdk/
package/Config.in +1 -0
index 9fed0ab4cb..167a6339c1 100644
@@ -2540,6 +2540,7 @@ menu "System tools"
  	source "package/unscd/Config.in"
  	source "package/util-linux/Config.in"
  	source "package/watchdog/Config.in"
+	source "package/watchdogd/Config.in"
  	source "package/xdg-dbus-proxy/Config.in"
  	source "package/xen/Config.in"
  	source "package/xvisor/Config.in"
package/watchdogd/Config.in new file +19 -0
new file mode 100644
index 0000000000..48abbac8fa
@@ -0,0 +1,69 @@
+config BR2_PACKAGE_WATCHDOGD
+	bool "watchdogd"
+	depends on BR2_USE_MMU # fork()
+	select BR2_PACKAGE_LIBCONFUSE
+	select BR2_PACKAGE_LIBITE
+	select BR2_PACKAGE_LIBUEV
+	help
+	  Extended version of uClinux-dist watchdogd.  Monitors loadavg,
+	  file descriptors and memory leaks, and capable of supervising
+	  your processes main loop using an instrumentation API.
+
+	  A reset reason is saved for power loss, CPU overload, or any
+	  of the monitored conditions (above).	The full capabilities
+	  are limited by the kernel watchdog driver, but even the basic
+	  "softdog" driver is supported.  See /etc/watchdogd.conf for
+	  details, and try watchdogctl for system status and available
+	  commands.
+
+	  https://github.com/troglobit/watchdogd/

package/watchdogd/Config.in line 29

Quoted 10 lines
package/watchdogd/Config.in new file +10 -0
+
+if BR2_PACKAGE_WATCHDOGD
+
+config BR2_PACKAGE_WATCHDOGD_TEST_SUITE
+	bool "Enable watchdogctl test cases"
+	default y
+	help
+	  The watchdogctl program comes with a suite of tests built-in.
+	  They can be used to verify correct operation of watchdogd and
+	  the kernel watchdog driver.

This doesn't sound like something you'd want enabled by default, so I removed
the "default y".

package/watchdogd/Config.in line 40

Quoted 11 lines
package/watchdogd/Config.in new file +11 -0
+
+	  Default: enabled
+
+config BR2_PACKAGE_WATCHDOGD_GENERIC_POLL
+	int "Generic script monitor poll interval (sec)"
+	default "300"
+	help
+	  Poll interval for generic script monitor, in seconds.  A value
+	  of zero (0) disables the monitor.
+
+	  Default: 300 seconds

We normally don't have such Default: entries in the help text. It's kind of
pointless IMHO.

[snip]

package/watchdogd/Config.in line 47

Quoted 7 lines
package/watchdogd/Config.in new file +7 -0
+define WATCHDOGD_INSTALL_INIT_SYSV
+	$(INSTALL) -D -m 0755 package/watchdogd/S01watchdogd \
+		$(TARGET_DIR)/etc/init.d/S01watchdogd
+endef
+
+define WATCHDOGD_INSTALL_INIT_SYSTEMD
+	$(INSTALL) -D -m 644 $(WATCHDOGD_PKGDIR)/watchdogd.service \

WATCHDOGD_PKGDIR is package/watchdog. You want WATCHDOGD_SRCDIR here.

Regards,
Arnout

package/watchdogd/Config.in line 51

Quoted 5 lines
package/watchdogd/Config.in new file +4 -0
+		$(TARGET_DIR)/usr/lib/systemd/system/watchdogd.service
+endef
+
+$(eval $(autotools-package))

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw
Quoted 3 lines · Arnout Vandecappelle
Quoted 1 line · Joachim Wiberg

[snip]

 Applied to master, thanks, with changes specified below.

Awesome, thank you! :)

Quoted 6 lines
Quoted 4 lines

[snip]
+config BR2_PACKAGE_WATCHDOGD_TEST_SUITE
+    bool "Enable watchdogctl test cases"
+    default y

 This doesn't sound like something you'd want enabled by default, so I removed the "default y".

Of course, sorry about that! I was sure I had filtered out all of our old cruft from the $DAYJOB packaging.

Quoted 10 lines

package/watchdogd/Config.in line 40

Quoted 8 lines
package/watchdogd/Config.in new file +8 -0
+config BR2_PACKAGE_WATCHDOGD_GENERIC_POLL
+    int "Generic script monitor poll interval (sec)"
+    default "300"
+    help
+      Poll interval for generic script monitor, in seconds.  A value
+      of zero (0) disables the monitor.
+
+      Default: 300 seconds

 We normally don't have such Default: entries in the help text. It's kind of pointless IMHO.

Ack! I'm still getting accustomed to the nice new kconfig build system. So shiny :)

Quoted 9 lines

[snip]

package/watchdogd/watchdogd.mk line 51

Quoted 7 lines
package/watchdogd/watchdogd.mk new file +7 -0
+define WATCHDOGD_INSTALL_INIT_SYSV
+    $(INSTALL) -D -m 0755 package/watchdogd/S01watchdogd \
+        $(TARGET_DIR)/etc/init.d/S01watchdogd
+endef
+
+define WATCHDOGD_INSTALL_INIT_SYSTEMD
+    $(INSTALL) -D -m 644 $(WATCHDOGD_PKGDIR)/watchdogd.service \

 WATCHDOGD_PKGDIR is package/watchdog. You want WATCHDOGD_SRCDIR here.

Love your attention to detail. Much appreciated you took the time to clean up my mess!

Best regards
/Joachim

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot