diff --git a/build/download-info b/build/download-info index bcbe8326ca1a744d14dc14b81c48dbec79820e98..08326e89edec1eb44952ea3bfdabdabbd92b568d 100644 --- a/build/download-info +++ b/build/download-info @@ -168,3 +168,6 @@ uClibc-0.9.32.tar.bz2 cfcb6c25d8ebe12817499d8749ee8ae1 \ zlib-1.2.5.tar.bz2 be1e89810e66150f5b0327984d8625a0 \ http://kent.dl.sourceforge.net/sourceforge/libpng/zlib-1.2.5.tar.bz2 + +monit-5.10.tar.gz 5b5b5cc7939b975bbbef73bd6426750a \ + http://mmonit.com/monit/dist/monit-5.10.tar.gz diff --git a/build/scripts/wrs_build_wraprootfs b/build/scripts/wrs_build_wraprootfs index d5c59cfabd1441f2f91232391bfd29302789e479..68f9a02cfa9b742bf228fdbcb7ac44789bb437cd 100755 --- a/build/scripts/wrs_build_wraprootfs +++ b/build/scripts/wrs_build_wraprootfs @@ -105,6 +105,9 @@ ln -s ../tmp $TMPFS/usr/tmp # mv ubi commands to /sbin: they are needed for boot time mv $TMPFS/usr/sbin/ubi* $TMPFS/sbin +#set permisions for monitrc +chmod 600 $TMPFS/etc/monitrc + # copy /etc to /usr/etc, where it can be edited (boot sequence copies back) cp -a $TMPFS/etc $TMPFS/usr/etc diff --git a/configs/buildroot/wrs_release_br2_config b/configs/buildroot/wrs_release_br2_config index 84225e07c6c08146607002463cd2726e76a93b8b..887c46139ad2b0639a70f6cac0bf56210467a77a 100644 --- a/configs/buildroot/wrs_release_br2_config +++ b/configs/buildroot/wrs_release_br2_config @@ -1062,6 +1062,7 @@ BR2_PACKAGE_SCREEN=y # # BR2_PACKAGE_HTOP is not set # BR2_PACKAGE_MODULE_INIT_TOOLS is not set +BR2_PACKAGE_MONIT=y BR2_PACKAGE_PROCPS=y # BR2_PACKAGE_PSMISC is not set BR2_PACKAGE_RSYSLOG=y diff --git a/patches/buildroot/0004-add-monit.patch b/patches/buildroot/0004-add-monit.patch new file mode 100644 index 0000000000000000000000000000000000000000..364167850b23b13a74e0e13cb448076bcf532154 --- /dev/null +++ b/patches/buildroot/0004-add-monit.patch @@ -0,0 +1,129 @@ +From efe1355563ac28c2f1a1ac689d6f5001bef627b0 Mon Sep 17 00:00:00 2001 +From: Adam Wujek <adam.wujek@cern.ch> +Date: Thu, 13 Nov 2014 13:48:13 +0100 +Subject: [PATCH] add monit + +Commit based on patches from buildroot + +Signed-off-by: Adam Wujek <adam.wujek@cern.ch> +--- + package/Config.in | 3 ++ + package/monit/Config.in | 15 ++++++++++ + package/monit/monit-0001-no-force-static.patch | 20 +++++++++++++ + package/monit/monit.mk | 41 ++++++++++++++++++++++++++ + 4 files changed, 79 insertions(+) + create mode 100644 package/monit/Config.in + create mode 100644 package/monit/monit-0001-no-force-static.patch + create mode 100644 package/monit/monit.mk + +diff --git a/package/Config.in b/package/Config.in +index 4b5e5d8..d767060 100644 +--- a/package/Config.in ++++ b/package/Config.in +@@ -529,6 +529,9 @@ endif + source "package/htop/Config.in" + if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS + source "package/module-init-tools/Config.in" ++endif ++source "package/monit/Config.in" ++if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS + source "package/procps/Config.in" + source "package/psmisc/Config.in" + source "package/rsyslog/Config.in" +diff --git a/package/monit/Config.in b/package/monit/Config.in +new file mode 100644 +index 0000000..794ef76 +--- /dev/null ++++ b/package/monit/Config.in +@@ -0,0 +1,15 @@ ++config BR2_PACKAGE_MONIT ++ bool "monit" ++ depends on BR2_TOOLCHAIN_HAS_THREADS ++ depends on BR2_USE_MMU # fork() ++ help ++ Monit is a free open source utility for managing and ++ monitoring, processes, programs, files, directories and ++ filesystems on a UNIX system. Monit conducts automatic ++ maintenance and repair and can execute meaningful causal ++ actions in error situations. ++ ++ http://mmonit.com/monit/ ++ ++comment "monit requires a toolchain with threads support" ++ depends on !BR2_TOOLCHAIN_HAS_THREADS +diff --git a/package/monit/monit-0001-no-force-static.patch b/package/monit/monit-0001-no-force-static.patch +new file mode 100644 +index 0000000..edb619b +--- /dev/null ++++ b/package/monit/monit-0001-no-force-static.patch +@@ -0,0 +1,20 @@ ++Do not force building a statically-linked binary ++ ++Statically-linked binary do not work well with glibc, because it ++still dlopen()s the NSS libraries. ++ ++Reported-by: Peter Kümmel <syntheticpp@gmx.net> ++Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> ++ ++diff -durN monit-5.7.orig/Makefile.am monit-5.7/Makefile.am ++--- monit-5.7.orig/Makefile.am 2014-02-20 09:00:42.000000000 +0100 +++++ monit-5.7/Makefile.am 2014-09-05 12:49:43.711104001 +0200 ++@@ -85,7 +85,7 @@ ++ src/process/sysdep_@ARCH@.c ++ ++ monit_LDADD = libmonit/libmonit.la ++-monit_LDFLAGS = -static $(EXTLDFLAGS) +++monit_LDFLAGS = $(EXTLDFLAGS) ++ ++ man_MANS = monit.1 ++ +diff --git a/package/monit/monit.mk b/package/monit/monit.mk +new file mode 100644 +index 0000000..ef70a7a +--- /dev/null ++++ b/package/monit/monit.mk +@@ -0,0 +1,41 @@ ++############################################################# ++# ++# monit ++# ++############################################################# ++ ++MONIT_VERSION = 5.10 ++MONIT_SITE = http://mmonit.com/monit/dist/ ++MONIT_LICENSE = AGPLv3 with OpenSSL exception ++MONIT_LICENSE_FILES = COPYING ++# ++# Touching Makefile.am: ++MONIT_AUTORECONF = YES ++ ++# Missing m4/ directory in the source tree ++define MONIT_M4 ++ mkdir -p $(@D)/m4 ++endef ++MONIT_POST_PATCH_HOOKS += MONIT_M4 ++ ++MONIT_CONF_ENV = \ ++ libmonit_cv_setjmp_available=yes \ ++ libmonit_cv_vsnprintf_c99_conformant=yes ++ ++MONIT_CONF_OPT += \ ++ --without-pam --enable-optimized ++ ++ifeq ($(BR2_PACKAGE_OPENSSL),y) ++MONIT_CONF_OPT += --with-ssl=$(STAGING_DIR)/usr ++MONIT_DEPENDENCIES += openssl ++else ++MONIT_CONF_OPT += --without-ssl ++endif ++ ++ifeq ($(BR2_LARGEFILE),y) ++MONIT_CONF_OPT += --with-largefiles ++else ++MONIT_CONF_OPT += --without-largefiles ++endif ++ ++$(eval $(call AUTOTARGETS)) +-- +1.9.1 + diff --git a/userspace/rootfs_override/etc/init.d/S80snmp b/userspace/rootfs_override/etc/init.d/S80snmp index 633c4ee5f76aea18b74f5c27b52ab6390b49d8ec..a05c7de55d5de4877efe37a212115922cf54ef8c 100755 --- a/userspace/rootfs_override/etc/init.d/S80snmp +++ b/userspace/rootfs_override/etc/init.d/S80snmp @@ -1,4 +1,40 @@ #!/bin/sh -# Log to syslog at daemon level. Amd log source address (-a) -snmpd -Lsd -p /var/run/snmpd.pid -a -c /wr/etc/snmpd.conf +SNMP_PID=/var/run/snmpd.pid +SNMP_CONF=/wr/etc/snmpd.conf + +start() { + # Log to syslog at daemon level. And log source address (-a) + snmpd -Lsd -p $SNMP_PID -a -c $SNMP_CONF +} + +stop() { + if pidof snmpd > /dev/null; then + echo -n "Stopping snmpd: " + start-stop-daemon -K -q -p $SNMP_PID + echo "OK" + fi +} +restart() { + stop + start +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|reload) + restart + ;; + "") + start + ;; + *) + echo $"Usage: $0 {start|stop|restart}" + exit 1 + ;; +esac diff --git a/userspace/rootfs_override/etc/init.d/S95monit.sh b/userspace/rootfs_override/etc/init.d/S95monit.sh new file mode 100755 index 0000000000000000000000000000000000000000..10441176c28b4c0b331393cf439f06d1cb8b6525 --- /dev/null +++ b/userspace/rootfs_override/etc/init.d/S95monit.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +# start monit +/usr/bin/monit diff --git a/userspace/rootfs_override/etc/monit.d/snmp.conf b/userspace/rootfs_override/etc/monit.d/snmp.conf new file mode 100644 index 0000000000000000000000000000000000000000..313f9e78bc0578cb5c6efe7f03ea9cef740244cb --- /dev/null +++ b/userspace/rootfs_override/etc/monit.d/snmp.conf @@ -0,0 +1,5 @@ + check process snmpd with pidfile /var/run/snmpd.pid + start program = "/etc/init.d/S80snmp start" + stop program = "/etc/init.d/S80snmp stop" +# if failed host localhost port 161 type udp then restart +# if 5 restarts within 10 then exec "/sbin/reboot" diff --git a/userspace/rootfs_override/etc/monitrc b/userspace/rootfs_override/etc/monitrc new file mode 100644 index 0000000000000000000000000000000000000000..ff839168658dfd5a70cb6789022e426eddfd41c8 --- /dev/null +++ b/userspace/rootfs_override/etc/monitrc @@ -0,0 +1,58 @@ +############################################################################### +## Monit control file +############################################################################### +## +## Comments begin with a '#' and extend through the end of the line. Keywords +## are case insensitive. All path's MUST BE FULLY QUALIFIED, starting with '/'. +## +## Below you will find examples of some frequently used statements. For +## information about the control file and a complete list of statements and +## options, please have a look in the Monit manual. +## +## +############################################################################### +## Global section +############################################################################### +## +## Start Monit in the background (run as a daemon): +# +set daemon 10 # check services at 10 seconds intervals +# with start delay 240 # optional: delay the first check by 4-minutes (by +# # default Monit check immediately after Monit start) +# +# +## Set syslog logging with the 'daemon' facility. If the FACILITY option is +## omitted, Monit will use 'user' facility by default. If you want to log to +## a standalone log file instead, specify the full path to the log file +# +# set logfile syslog facility log_daemon +# +# +## Set the location of the Monit lock file which stores the process id of the +## running Monit instance. By default this file is stored in $HOME/.monit.pid +# +set pidfile /var/run/monit.pid +# +## Set the location of the Monit id file which stores the unique id for the +## Monit instance. The id is generated and stored on first Monit start. By +## default the file is placed in $HOME/.monit.id. +# +set idfile /var/monit/monit.id +# +## Set the location of the Monit state file which saves monitoring states +## on each cycle. By default the file is placed in $HOME/.monit.state. If +## the state file is stored on a persistent filesystem, Monit will recover +## the monitoring state across reboots. If it is on temporary filesystem, the +## state will be lost on reboot which may be convenient in some situations. +# +set statefile /var/monit/monit.state + +############################################################################### +## Includes +############################################################################### +## +## It is possible to include additional configuration parts from other files or +## directories. +# +include /etc/monit.d/* +# diff --git a/userspace/rootfs_override/var/monit/.gitignore b/userspace/rootfs_override/var/monit/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391