From: <abe...@us...> - 2014-12-16 00:32:54
|
Revision: 6853 http://sourceforge.net/p/astlinux/code/6853 Author: abelbeck Date: 2014-12-16 00:32:46 +0000 (Tue, 16 Dec 2014) Log Message: ----------- monit, restructure file layout, change runlevels to match darkstat, add MONIT_ rc.conf variables Modified Paths: -------------- branches/1.0/package/monit/monit.init branches/1.0/package/monit/monit.mk branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf Modified: branches/1.0/package/monit/monit.init =================================================================== --- branches/1.0/package/monit/monit.init 2014-12-14 23:03:01 UTC (rev 6852) +++ branches/1.0/package/monit/monit.init 2014-12-16 00:32:46 UTC (rev 6853) @@ -6,18 +6,73 @@ STATEFILE="/var/db/monit.state" +gen_monitrc() +{ + local i IFS + + echo "set daemon 60 +set idfile /mnt/kd/monit/monit.id +set logfile syslog facility log_daemon +set mailserver localhost + +set httpd port 2812 and + use address localhost + allow localhost +" + + unset IFS + for i in $MONIT_NOTIFY; do + echo "set alert $i not on { instance, action }" + done + + if [ -n "$MONIT_NOTIFY_FROM" ]; then + echo "set mail-format { from: $MONIT_NOTIFY_FROM }" + fi + + echo " +include /etc/monit/monit.d/*" +} + init () { - if [ -d /mnt/kd/monit ]; then - ln -snf /mnt/kd/monit /tmp/etc/monit + if [ "$MONIT_SERVER" != "yes" ]; then + if [ -f /tmp/etc/monit/monitrc ]; then + rm /tmp/etc/monit/monitrc + fi + exit fi + + if [ ! -d /mnt/kd/monit ]; then + mkdir /mnt/kd/monit + if [ -d /stat/etc/monit ]; then + cp -a /stat/etc/monit/* /mnt/kd/monit/ + fi + fi + + if [ ! -d /tmp/etc/monit ]; then + mkdir /tmp/etc/monit + ln -snf /mnt/kd/monit/monit.d /tmp/etc/monit/monit.d + fi + + if [ -f /mnt/kd/monit/monitrc ]; then + echo "## Autogenerated. Edit /mnt/kd/monit/monitrc file. +" >/tmp/etc/monit/monitrc + cat /mnt/kd/monit/monitrc >>/tmp/etc/monit/monitrc + else + # Autogenerate /etc/monit/monitrc + echo "## Autogenerated. Do not edit. +## A manually generated /etc/monit/monitrc config will use /mnt/kd/monit/monitrc if it exists. +" >/tmp/etc/monit/monitrc + gen_monitrc >>/tmp/etc/monit/monitrc + fi + chmod 600 /tmp/etc/monit/monitrc } start () { if [ -f /etc/monit/monitrc ]; then echo "Starting monit..." - chmod 600 /etc/monit/monitrc + monit -c /etc/monit/monitrc -p $PIDFILE -s $STATEFILE fi } Modified: branches/1.0/package/monit/monit.mk =================================================================== --- branches/1.0/package/monit/monit.mk 2014-12-14 23:03:01 UTC (rev 6852) +++ branches/1.0/package/monit/monit.mk 2014-12-16 00:32:46 UTC (rev 6853) @@ -33,11 +33,14 @@ define MONIT_INSTALL_TARGET_CMDS $(INSTALL) -m 0755 -D $(@D)/monit $(TARGET_DIR)/usr/sbin/monit - $(INSTALL) -m 0600 -D $(@D)/monitrc $(TARGET_DIR)/stat/etc/monit/monitrc + $(INSTALL) -m 0600 -D $(@D)/monitrc $(TARGET_DIR)/stat/etc/monit/monit.d/services + $(SED) '1,/^## Services/ d' \ + -e '/^## Includes/,$$ d' \ + $(TARGET_DIR)/stat/etc/monit/monit.d/services $(INSTALL) -m 0755 -D package/monit/monit.init $(TARGET_DIR)/etc/init.d/monit ln -sf /tmp/etc/monit $(TARGET_DIR)/etc/monit - ln -sf ../../init.d/monit $(TARGET_DIR)/etc/runlevels/default/S98monit - ln -sf ../../init.d/monit $(TARGET_DIR)/etc/runlevels/default/K01monit + ln -sf ../../init.d/monit $(TARGET_DIR)/etc/runlevels/default/S75monit + ln -sf ../../init.d/monit $(TARGET_DIR)/etc/runlevels/default/K15monit endef define MONIT_UNINSTALL_TARGET_CMDS @@ -45,8 +48,8 @@ rm -rf $(TARGET_DIR)/stat/etc/monit rm -f $(TARGET_DIR)/etc/init.d/monit rm -f $(TARGET_DIR)/etc/monit - rm -f $(TARGET_DIR)/etc/runlevels/default/S98monit - rm -f $(TARGET_DIR)/etc/runlevels/default/K01monit + rm -f $(TARGET_DIR)/etc/runlevels/default/S75monit + rm -f $(TARGET_DIR)/etc/runlevels/default/K15monit endef $(eval $(call AUTOTARGETS,package,monit)) Modified: branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf =================================================================== --- branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf 2014-12-14 23:03:01 UTC (rev 6852) +++ branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf 2014-12-16 00:32:46 UTC (rev 6853) @@ -1081,6 +1081,12 @@ #ZABBIX_PROXY_HOSTNAME="" # Unique, case sensitive Proxy name. Make sure the Proxy name is known to the server. #ZABBIX_PROXY_LISTENPORT="10051" # TCP port that zabbix_proxy listens on locally +## Monit Daemon +## Enable Monit server by setting MONIT_SERVER="yes" +#MONIT_SERVER="yes" +#MONIT_NOTIFY="no...@my..." # Notify via email, space separate multiple email addresses +#MONIT_NOTIFY_FROM="mo...@my..." # Optional, From: email address + ## BOOTPFILE ## For diskless clients, the image to use for booting. #BOOTPFILE="/pxelinux.0" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |