Skip to content

Commit

Permalink
monit: new package
Browse files Browse the repository at this point in the history
Signed-off-by: Joris Offouga <[email protected]>
Signed-off-by: Khem Raj <[email protected]>
  • Loading branch information
jorisoffouga authored and kraj committed Mar 5, 2020
1 parent c39747b commit 76073b9
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 0 deletions.
42 changes: 42 additions & 0 deletions meta-oe/recipes-support/monit/monit/monit
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#! /bin/sh
#
# This is an init script for openembedded
# Copy it to /etc/init.d/monit and type
# > update-rc.d monit defaults 89
#
monit=/usr/bin/monit
pidfile=/var/run/monit.pid
monit_args="-c /etc/monitrc"

test -x "$monit" || exit 0

case "$1" in
start)
echo -n "Starting Monit"
start-stop-daemon --start --quiet --exec $monit -- $monit_args
RETVAL=$?
echo "."
;;
stop)
echo -n "Stopping Monit"
start-stop-daemon --stop --quiet --pidfile $pidfile
RETVAL=$?
echo "."
;;
restart)
$0 stop
$0 start
RETVAL=$?
;;
status)
$monit $monit_args status
RETVAL=$?
echo "."
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac

exit $RETVAL

44 changes: 44 additions & 0 deletions meta-oe/recipes-support/monit/monit/monitrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
###############################################################################
## 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 30 # check services at 30 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. If you want to log to a standalone log file instead,
## specify the full path to the log file
#
set log syslog

set httpd port 2812
allow 0.0.0.0/0 # allow localhost to connect to the server and
allow admin:monit # require user 'admin' with password 'monit'
#with ssl { # enable SSL/TLS and set path to server certificate
# pemfile: /etc/ssl/certs/monit.pem
#}

###############################################################################
## Includes
###############################################################################
##
## It is possible to include additional configuration parts from other files or
## directories.
#
include /etc/monit.d/*

53 changes: 53 additions & 0 deletions meta-oe/recipes-support/monit/monit_5.26.0.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
DESCRIPTION = "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."

HOMEPAGE = "http://mmonit.com/monit/"

LICENSE = "AGPL-3.0"
LIC_FILES_CHKSUM = "file://COPYING;md5=ea116a7defaf0e93b3bb73b2a34a3f51 \
file://libmonit/COPYING;md5=2405f1c59ed1bf3714cebdb40162ce92"

SRC_URI = " \
https://mmonit.com/monit/dist/monit-${PV}.tar.gz \
file://monit \
file://monitrc \
"

SRC_URI[md5sum] = "9f7dc65e902c103e4c5891354994c3df"
SRC_URI[sha256sum] = "87fc4568a3af9a2be89040efb169e3a2e47b262f99e78d5ddde99dd89f02f3c2"

DEPENDS = "zlib bison-native libnsl2 flex-native openssl virtual/crypt"

inherit autotools-brokensep systemd update-rc.d

PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}"
PACKAGECONFIG[pam] = "--with-pam,--without-pam,libpam"

EXTRA_OECONF = "\
libmonit_cv_setjmp_available=no \
libmonit_cv_vsnprintf_c99_conformant=no \
--with-ssl-lib-dir=${STAGING_LIBDIR} \
--with-ssl-incl-dir=${STAGING_INCDIR} \
"

SYSTEMD_SERVICE_${PN} = "monit.service"
SYSTEMD_AUTO_ENABLE = "enable"

INITSCRIPT_PACKAGES = "${PN}"
INITSCRIPT_NAME_${PN} = "monit"
INITSCRIPT_PARAMS_${PN} = "defaults 89"

do_install_append() {

# Configuration file
install -Dm 0600 ${WORKDIR}/monitrc ${D}${sysconfdir}/monitrc

# SystemD
install -Dm 0644 ${S}/system/startup/monit.service.in ${D}${systemd_system_unitdir}/monit.service
sed -i -e 's,@prefix@,${exec_prefix},g' ${D}${systemd_unitdir}/system/monit.service

# SysV
install -Dm 0755 ${WORKDIR}/monit ${D}${sysconfdir}/init.d/monit
}

0 comments on commit 76073b9

Please sign in to comment.