Commit 48bc0cd1 authored by Alessandro Rubini's avatar Alessandro Rubini

Merge branch 'adam-monit'

This adds monit, a simple monitoring tool. It currently monitors
snmpd alone, but it will monitor more things as we proceed (but we
first need to make ppsi rtud and hal independently restartable.
parents 66eebbb3 3bf2e09b
......@@ -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
......@@ -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
......
......@@ -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
......
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
#!/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
#!/bin/sh
# start monit
/usr/bin/monit
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"
###############################################################################
## 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/*
#
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment