diff options
4 files changed, 216 insertions, 0 deletions
diff --git a/recipes-extended/nagios/nagios-nsca/0001-Fix-missing-argument-in-open-calls.patch b/recipes-extended/nagios/nagios-nsca/0001-Fix-missing-argument-in-open-calls.patch new file mode 100644 index 00000000..6b39fec5 --- /dev/null +++ b/recipes-extended/nagios/nagios-nsca/0001-Fix-missing-argument-in-open-calls.patch | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | From da37e6ce2a8cc315845440488cd2f8dab0a17bfe Mon Sep 17 00:00:00 2001 | ||
| 2 | From: "John C. Frickson" <jfrickson@nagios.com> | ||
| 3 | Date: Wed, 7 Oct 2015 14:06:58 -0500 | ||
| 4 | Subject: [PATCH] Fix missing argument in open calls | ||
| 5 | |||
| 6 | Commit b9f2c08dfdf31430f972a48781fc115c4af13cfe | ||
| 7 | from https://github.com/NagiosEnterprises/nsca | ||
| 8 | |||
| 9 | Fix for issue http://tracker.nagios.org/view.php?id=286 | ||
| 10 | |||
| 11 | Upstream-Status: Backport | ||
| 12 | |||
| 13 | Singed-off-by: John C. Frickson <jfrickson@nagios.com> | ||
| 14 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
| 15 | [MA: Context updated to allow application to older version] | ||
| 16 | Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> | ||
| 17 | --- | ||
| 18 | Changelog | 4 ++++ | ||
| 19 | src/nsca.c | 2 +- | ||
| 20 | 2 files changed, 5 insertions(+), 1 deletion(-) | ||
| 21 | |||
| 22 | diff --git a/Changelog b/Changelog | ||
| 23 | index 3a7edd4..00ea11e 100644 | ||
| 24 | --- a/Changelog | ||
| 25 | +++ b/Changelog | ||
| 26 | @@ -2,6 +2,10 @@ | ||
| 27 | NSCA Changelog | ||
| 28 | ************** | ||
| 29 | |||
| 30 | +2.9.x - xx/xx/xxxx | ||
| 31 | +------------------ | ||
| 32 | +- Fix missing argument in open calls (Xavier Bachelot / John Frickson) | ||
| 33 | + | ||
| 34 | 2.9.1 - 01/27/2012 | ||
| 35 | ------------------ | ||
| 36 | - Applied patch to allow packets arriving with a future time stamp (Daniel Wittenberg) | ||
| 37 | diff --git a/src/nsca.c b/src/nsca.c | ||
| 38 | index 6b0e436..0e70b8b 100644 | ||
| 39 | --- a/src/nsca.c | ||
| 40 | +++ b/src/nsca.c | ||
| 41 | @@ -477,7 +477,7 @@ static int read_config_file(char *filename){ | ||
| 42 | int checkresult_test_fd=-1; | ||
| 43 | char *checkresult_test=NULL; | ||
| 44 | asprintf(&checkresult_test,"%s/nsca.test.%i",check_result_path,getpid()); | ||
| 45 | - checkresult_test_fd=open(checkresult_test,O_WRONLY|O_CREAT); | ||
| 46 | + checkresult_test_fd=open(checkresult_test,O_WRONLY|O_CREAT,S_IWUSR); | ||
| 47 | if (checkresult_test_fd>0){ | ||
| 48 | unlink(checkresult_test); | ||
| 49 | } | ||
| 50 | -- | ||
| 51 | 2.11.0 | ||
| 52 | |||
diff --git a/recipes-extended/nagios/nagios-nsca/init-script.in b/recipes-extended/nagios/nagios-nsca/init-script.in new file mode 100644 index 00000000..a76b34ed --- /dev/null +++ b/recipes-extended/nagios/nagios-nsca/init-script.in | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # | ||
| 3 | # Last Modified 01-07-2003 Ethan Galstad (nagios@nagios.org) | ||
| 4 | # Notes | ||
| 5 | # This script takes care of starting and stopping the NSCA daemon. | ||
| 6 | # Modeled after init script for NRPE written by jaclu@grm.se | ||
| 7 | # | ||
| 8 | # chkconfig: 2345 80 30 | ||
| 9 | # description: nsca is a daemon for accepting service check results \ | ||
| 10 | # from applications running on other hosts. | ||
| 11 | # processname: nsca | ||
| 12 | # config: /usr/local/nagios/etc/nsca.cfg | ||
| 13 | |||
| 14 | ### BEGIN INIT INFO | ||
| 15 | # Provides: nsca | ||
| 16 | # Required-Start: $remote_fs $syslog | ||
| 17 | # Required-Stop: $remote_fs $syslog | ||
| 18 | # Default-Start: 2 3 4 5 | ||
| 19 | # Default-Stop: 0 1 6 | ||
| 20 | # Short-Description: start and stop nagios nsca daemon | ||
| 21 | # Description: start and stop nagios nsca daemon | ||
| 22 | ### END INIT INFO | ||
| 23 | |||
| 24 | |||
| 25 | # Source function library | ||
| 26 | if [ -f /etc/rc.d/init.d/functions ]; then | ||
| 27 | . /etc/rc.d/init.d/functions | ||
| 28 | elif [ -f /etc/init.d/functions ]; then | ||
| 29 | . /etc/init.d/functions | ||
| 30 | elif [ -f /etc/rc.d/functions ]; then | ||
| 31 | . /etc/rc.d/functions | ||
| 32 | fi | ||
| 33 | |||
| 34 | NscaBin=@bindir@/nsca | ||
| 35 | NscaCfg=@sysconfdir@/nsca.cfg | ||
| 36 | LockFile=/var/lock/nsca | ||
| 37 | |||
| 38 | # See how we were called. | ||
| 39 | case "$1" in | ||
| 40 | start) | ||
| 41 | # Start daemons. | ||
| 42 | echo -n "Starting nsca: " | ||
| 43 | start-stop-daemon --start --exec $NscaBin -- -s -c $NscaCfg | ||
| 44 | RETVAL=$? | ||
| 45 | echo | ||
| 46 | touch $LockFile | ||
| 47 | ;; | ||
| 48 | stop) | ||
| 49 | # Stop daemons. | ||
| 50 | echo -n "Shutting down nsca: " | ||
| 51 | start-stop-daemon --stop --exec $NscaBin | ||
| 52 | echo | ||
| 53 | rm -f $LockFile | ||
| 54 | ;; | ||
| 55 | restart) | ||
| 56 | $0 stop | ||
| 57 | $0 start | ||
| 58 | ;; | ||
| 59 | status) | ||
| 60 | status nsca | ||
| 61 | ;; | ||
| 62 | *) | ||
| 63 | echo "Usage: nsca {start|stop|restart|status}" | ||
| 64 | exit 1 | ||
| 65 | esac | ||
| 66 | |||
| 67 | exit 0 | ||
diff --git a/recipes-extended/nagios/nagios-nsca/nagios-nsca.service b/recipes-extended/nagios/nagios-nsca/nagios-nsca.service new file mode 100644 index 00000000..aa38b7f2 --- /dev/null +++ b/recipes-extended/nagios/nagios-nsca/nagios-nsca.service | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | [Unit] | ||
| 2 | Description=Nagios nsca plugin | ||
| 3 | After=syslog.target network.target | ||
| 4 | |||
| 5 | [Service] | ||
| 6 | Type=forking | ||
| 7 | ExecStart=/usr/bin/nsca -s -c /etc/nagios/nsca.cfg | ||
| 8 | PIDFile=/var/run/nsca.pid | ||
| 9 | TimeoutSec=60 | ||
| 10 | |||
| 11 | [Install] | ||
| 12 | WantedBy=multi-user.target | ||
diff --git a/recipes-extended/nagios/nagios-nsca_2.9.1.bb b/recipes-extended/nagios/nagios-nsca_2.9.1.bb new file mode 100644 index 00000000..f53a47a0 --- /dev/null +++ b/recipes-extended/nagios/nagios-nsca_2.9.1.bb | |||
| @@ -0,0 +1,85 @@ | |||
| 1 | require nagios-common.inc | ||
| 2 | |||
| 3 | DESCRIPTION = "Nagios Service Check Acceptor" | ||
| 4 | HOMEPAGE = "http://exchange.nagios.org" | ||
| 5 | SECTION = "console/network" | ||
| 6 | PRIORITY = "optional" | ||
| 7 | LICENSE = "GPLv2" | ||
| 8 | |||
| 9 | LIC_FILES_CHKSUM = "file://src/nsca.c;beginline=1;endline=16;md5=c1bd17485c5c1dd42f664fe8b3528674" | ||
| 10 | |||
| 11 | SRCNAME = "nsca" | ||
| 12 | |||
| 13 | SRC_URI = "http://prdownloads.sourceforge.net/sourceforge/nagios/${SRCNAME}-${PV}.tar.gz \ | ||
| 14 | file://init-script.in \ | ||
| 15 | file://nagios-nsca.service \ | ||
| 16 | file://0001-Fix-missing-argument-in-open-calls.patch \ | ||
| 17 | " | ||
| 18 | |||
| 19 | SRC_URI[md5sum] = "3fe2576a8cc5b252110a93f4c8d978c6" | ||
| 20 | SRC_URI[sha256sum] = "fb12349e50838c37954fe896ba6a026c09eaeff2f9408508ad7ede53e9ea9580" | ||
| 21 | |||
| 22 | S = "${WORKDIR}/${SRCNAME}-${PV}" | ||
| 23 | |||
| 24 | inherit update-rc.d autotools-brokensep systemd dos2unix | ||
| 25 | |||
| 26 | DEPENDS = "libmcrypt" | ||
| 27 | |||
| 28 | EXTRA_OECONF += "--with-nsca-user=${NAGIOS_USER} \ | ||
| 29 | --with-nsca-group=${NAGIOS_GROUP} \ | ||
| 30 | --with-libmcrypt-prefix=${STAGING_DIR_HOST} \ | ||
| 31 | ac_cv_path_LIBMCRYPT_CONFIG=${STAGING_BINDIR_CROSS}/libmcrypt-config \ | ||
| 32 | ac_cv_lib_wrap_main=no \ | ||
| 33 | ac_cv_path_PERL=${bindir}/perl \ | ||
| 34 | " | ||
| 35 | |||
| 36 | do_configure() { | ||
| 37 | cp ${WORKDIR}/init-script.in ${S}/init-script.in | ||
| 38 | oe_runconf || die "make failed" | ||
| 39 | } | ||
| 40 | |||
| 41 | do_install() { | ||
| 42 | CONF_DIR=${D}${NAGIOS_CONF_DIR} | ||
| 43 | |||
| 44 | install -d ${CONF_DIR} | ||
| 45 | install -d ${D}${sysconfdir}/init.d | ||
| 46 | install -d ${D}${bindir} | ||
| 47 | |||
| 48 | install -m 755 ${S}/sample-config/nsca.cfg ${CONF_DIR} | ||
| 49 | install -m 755 ${S}/sample-config/send_nsca.cfg ${CONF_DIR} | ||
| 50 | install -m 755 ${S}/init-script ${D}${sysconfdir}/init.d/nsca | ||
| 51 | |||
| 52 | install -m 755 ${S}/src/nsca ${D}${bindir} | ||
| 53 | install -m 755 ${S}/src/send_nsca ${D}${bindir} | ||
| 54 | |||
| 55 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then | ||
| 56 | install -d ${D}${systemd_unitdir}/system | ||
| 57 | install -m 644 ${WORKDIR}/nagios-nsca.service ${D}${systemd_unitdir}/system/ | ||
| 58 | fi | ||
| 59 | } | ||
| 60 | |||
| 61 | PACKAGES = "${PN}-dbg ${PN}-daemon ${PN}-client" | ||
| 62 | |||
| 63 | FILES_${PN}-daemon = "${sysconfdir}/init.d \ | ||
| 64 | ${NAGIOS_CONF_DIR}/nsca.cfg \ | ||
| 65 | ${bindir}/nsca \ | ||
| 66 | " | ||
| 67 | |||
| 68 | FILES_${PN}-client = "${NAGIOS_CONF_DIR}/send_nsca.cfg \ | ||
| 69 | ${bindir}/send_nsca \ | ||
| 70 | " | ||
| 71 | |||
| 72 | RDEPENDS_${PN}-daemon += "libmcrypt \ | ||
| 73 | nagios-base \ | ||
| 74 | " | ||
| 75 | RDEPENDS_${PN}-client += "libmcrypt \ | ||
| 76 | nagios-base \ | ||
| 77 | " | ||
| 78 | |||
| 79 | SYSTEMD_PACKAGES = "${PN}-daemon" | ||
| 80 | SYSTEMD_SERVICE_${PN}-daemon = "nagios-nsca.service" | ||
| 81 | SYSTEMD_AUTO_ENABLE_${PN}-daemon = "enable" | ||
| 82 | |||
| 83 | INITSCRIPT_PACKAGES = "${PN}-daemon" | ||
| 84 | INITSCRIPT_NAME_${PN}-daemon = "nsca" | ||
| 85 | INITSCRIPT_PARAMS_${PN}-daemon = "defaults" | ||
