Skip to contentSkip to conversation

nagios-core: add recipe with latest stable version 4.4.2

PATCH In review Chen Qi 2 participants 7 messages Sep 6, 2018

lore
Share & tools
lore

Chen Qi

author
#0 lore raw

PATCH v2 1/6 nagios-core: add recipe with latest stable version 4.4.2

---
 recipes-extended/nagios/nagios-common.inc          |  26 ++++
 .../nagios-core/0001-fix-autoheader-error.patch    |  63 +++++++++
 ...0001-fix-compile-error-of-missing-headers.patch |  75 ++++++++++
 .../nagios-core/0001-fix-segment-fault.patch       |  54 ++++++++
 .../nagios-core/eventhandlers_nagioscmd_path.patch |  73 ++++++++++
 .../nagios-core/nagios-core-systemd-volatile.conf  |   2 +
 .../nagios/nagios-core/nagios-core.service         |  18 +++
 recipes-extended/nagios/nagios-core/volatiles      |   2 +
 recipes-extended/nagios/nagios-core_4.4.2.bb       | 151 +++++++++++++++++++++
 9 files changed, 464 insertions(+)
 create mode 100644 recipes-extended/nagios/nagios-common.inc
 create mode 100644 recipes-extended/nagios/nagios-core/0001-fix-autoheader-error.patch
 create mode 100644 recipes-extended/nagios/nagios-core/0001-fix-compile-error-of-missing-headers.patch
 create mode 100644 recipes-extended/nagios/nagios-core/0001-fix-segment-fault.patch
 create mode 100644 recipes-extended/nagios/nagios-core/eventhandlers_nagioscmd_path.patch
 create mode 100644 recipes-extended/nagios/nagios-core/nagios-core-systemd-volatile.conf
 create mode 100644 recipes-extended/nagios/nagios-core/nagios-core.service
 create mode 100644 recipes-extended/nagios/nagios-core/volatiles
 create mode 100644 recipes-extended/nagios/nagios-core_4.4.2.bb
recipes-extended/nagios/nagios-common.inc new file +26 -0
new file mode 100644
index 0000000..c173041
@@ -0,0 +1,26 @@
+NAGIOS_CONF_DIR = "${sysconfdir}/nagios"
+NAGIOS_PLUGIN_DIR = "${libdir}/nagios/plugins"
+NAGIOS_PLUGIN_CONF_DIR = "${NAGIOS_CONF_DIR}/plugins"
+NAGIOS_STATE_DIR = "${localstatedir}/nagios"
+
+NAGIOS_USER = "nagios"
+NAGIOS_GROUP = "nagios"
+
+EXTRA_OECONF += "--sysconfdir=${NAGIOS_CONF_DIR} \
+                 --libexecdir=${NAGIOS_PLUGIN_DIR} \
+                 --localstatedir=${NAGIOS_STATE_DIR} \
+"
+
+FILES_${PN}-dbg += "${NAGIOS_PLUGIN_DIR}/.debug"
+
+DEPENDS = "nagios-core"
+
+COMPATIBLE_HOST_aarch64 = "null"
+
+inherit useradd
+
+USERADD_PACKAGES = "${PN}"
+GROUPADD_PARAM_${PN} = "-r ${NAGIOS_GROUP}; -r nagcmd"
+USERADD_PARAM_${PN} = "-r -M -g ${NAGIOS_GROUP} ${NAGIOS_USER}"
+
+FILESYSTEM_PERMS_TABLES_append = " files/fs-perms-nagios.txt"
recipes-extended/nagios/nagios-core/0001-fix-autoheader-error.patch new file +63 -0

63 lines not on this page · raw message

recipes-extended/nagios/nagios-core/0001-fix-compile-error-of-missing-headers.patch new file +75 -0

75 lines not on this page · raw message

recipes-extended/nagios/nagios-core/0001-fix-segment-fault.patch new file +54 -0

54 lines not on this page · raw message

recipes-extended/nagios/nagios-core/eventhandlers_nagioscmd_path.patch new file +73 -0

73 lines not on this page · raw message

recipes-extended/nagios/nagios-core/nagios-core-systemd-volatile.conf new file +2 -0
new file mode 100644
index 0000000..134fb85
@@ -0,0 +1,2 @@
+d /var/nagios 0755 nagios nagios -
+d /var/run/nagios 0755 nagios nagios -
recipes-extended/nagios/nagios-core/nagios-core.service new file +18 -0
new file mode 100644
index 0000000..61fda3f
@@ -0,0 +1,18 @@
+[Unit]
+Description=Nagios core
+After=network.target local-fs.target
+
+[Service]
+Type=forking
+User=nagios
+Group=nagios
+PIDFile=/var/run/nagios/nagios.pid
+# Verify Nagios config before start as upstream suggested
+ExecStartPre=/usr/bin/nagios -v /etc/nagios/nagios.cfg
+ExecStart=/usr/bin/nagios -d /etc/nagios/nagios.cfg
+ExecStop=/bin/kill -TERM ${MAINPID}
+ExecStopPost=/bin/rm -f /var/spool/nagios/cmd/nagios.cmd
+ExecReload=/bin/kill -HUP ${MAINPID}
+
+[Install]
+WantedBy=multi-user.target
recipes-extended/nagios/nagios-core/volatiles new file +2 -0
new file mode 100644
index 0000000..e9bb768
@@ -0,0 +1,2 @@
+d nagios nagios 0755 /var/nagios none
+d nagios nagios 0755 /var/run/nagios none
recipes-extended/nagios/nagios-core_4.4.2.bb new file +151 -0

151 lines not on this page · raw message

Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v2 2/6 nagios-nrpe: add recipe with latest stable version 3.2.1

---
 recipes-extended/nagios/nagios-nrpe/check_nrpe.cfg |  11 +++
 .../nagios-nrpe/fix-compile-without-openssl.patch  |  43 +++++++++
 .../fix-configure-uses-host-openssl.patch          |  52 +++++++++++
 .../nagios/nagios-nrpe/nagios-nrpe.service         |  10 +++
 recipes-extended/nagios/nagios-nrpe_3.2.1.bb       | 100 +++++++++++++++++++++
 5 files changed, 216 insertions(+)
 create mode 100644 recipes-extended/nagios/nagios-nrpe/check_nrpe.cfg
 create mode 100644 recipes-extended/nagios/nagios-nrpe/fix-compile-without-openssl.patch
 create mode 100644 recipes-extended/nagios/nagios-nrpe/fix-configure-uses-host-openssl.patch
 create mode 100644 recipes-extended/nagios/nagios-nrpe/nagios-nrpe.service
 create mode 100644 recipes-extended/nagios/nagios-nrpe_3.2.1.bb
recipes-extended/nagios/nagios-nrpe/check_nrpe.cfg new file +11 -0
new file mode 100644
index 0000000..48f3fa5
@@ -0,0 +1,11 @@
+# this command runs a program $ARG1$ with arguments $ARG2$
+define command {
+    command_name    check_nrpe
+    command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$
+}
+
+# this command runs a program $ARG1$ with no arguments
+define command {
+    command_name    check_nrpe_1arg
+    command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
+}
recipes-extended/nagios/nagios-nrpe/fix-compile-without-openssl.patch new file +43 -0

43 lines not on this page · raw message

recipes-extended/nagios/nagios-nrpe/fix-configure-uses-host-openssl.patch new file +52 -0

52 lines not on this page · raw message

recipes-extended/nagios/nagios-nrpe/nagios-nrpe.service new file +10 -0
new file mode 100644
index 0000000..c5a0bda
@@ -0,0 +1,10 @@
+[Unit]
+Description=Nagios nrpe plugin
+After=syslog.target network.target
+
+[Service]
+ExecStart=/usr/bin/nrpe -c /etc/nagios/nrpe.cfg -f
+TimeoutSec=60
+
+[Install]
+WantedBy=multi-user.target
recipes-extended/nagios/nagios-nrpe_3.2.1.bb new file +100 -0

100 lines not on this page · raw message

Signature · 1 line
2.7.4
author
#2 lore raw

PATCH v2 3/6 nagios-nsca: add recipe with latest stable version 2.9.1

In reply to Chen Qi
---
 .../0001-Fix-missing-argument-in-open-calls.patch  | 52 +++++++++++++
 recipes-extended/nagios/nagios-nsca/init-script.in | 67 +++++++++++++++++
 .../nagios/nagios-nsca/nagios-nsca.service         | 12 +++
 recipes-extended/nagios/nagios-nsca_2.9.1.bb       | 85 ++++++++++++++++++++++
 4 files changed, 216 insertions(+)
 create mode 100644 recipes-extended/nagios/nagios-nsca/0001-Fix-missing-argument-in-open-calls.patch
 create mode 100644 recipes-extended/nagios/nagios-nsca/init-script.in
 create mode 100644 recipes-extended/nagios/nagios-nsca/nagios-nsca.service
 create mode 100644 recipes-extended/nagios/nagios-nsca_2.9.1.bb
recipes-extended/nagios/nagios-nsca/0001-Fix-missing-argument-in-open-calls.patch new file +52 -0
new file mode 100644
index 0000000..6b39fec
@@ -0,0 +1,52 @@
+From da37e6ce2a8cc315845440488cd2f8dab0a17bfe Mon Sep 17 00:00:00 2001
+From: "John C. Frickson" <[email protected]>
+Date: Wed, 7 Oct 2015 14:06:58 -0500
+Subject: [PATCH] Fix missing argument in open calls
+
+Commit b9f2c08dfdf31430f972a48781fc115c4af13cfe
+from https://github.com/NagiosEnterprises/nsca
+
+Fix for issue http://tracker.nagios.org/view.php?id=286
+
+Upstream-Status: Backport
+
+Singed-off-by: John C. Frickson <[email protected]>
+Signed-off-by: Chen Qi <[email protected]>
+[MA: Context updated to allow application to older version]
+Signed-off-by: Mark Asselstine <[email protected]>
+---
+ Changelog  | 4 ++++
+ src/nsca.c | 2 +-
+ 2 files changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/Changelog b/Changelog
+index 3a7edd4..00ea11e 100644
+--- a/Changelog
++++ b/Changelog
+@@ -2,6 +2,10 @@
+ NSCA Changelog
+ **************
+ 
++2.9.x - xx/xx/xxxx
++------------------
++- Fix missing argument in open calls (Xavier Bachelot / John Frickson)
++
+ 2.9.1 - 01/27/2012
+ ------------------
+ - Applied patch to allow packets arriving with a future time stamp (Daniel Wittenberg)
+diff --git a/src/nsca.c b/src/nsca.c
+index 6b0e436..0e70b8b 100644
+--- a/src/nsca.c
++++ b/src/nsca.c
+@@ -477,7 +477,7 @@ static int read_config_file(char *filename){
+                             int checkresult_test_fd=-1;
+                             char *checkresult_test=NULL;
+                             asprintf(&checkresult_test,"%s/nsca.test.%i",check_result_path,getpid());
+-                            checkresult_test_fd=open(checkresult_test,O_WRONLY|O_CREAT);
++                            checkresult_test_fd=open(checkresult_test,O_WRONLY|O_CREAT,S_IWUSR);
+                             if (checkresult_test_fd>0){
+                                     unlink(checkresult_test);
+                                     }
+-- 
+2.11.0
+
recipes-extended/nagios/nagios-nsca/init-script.in new file +67 -0

67 lines not on this page · raw message

recipes-extended/nagios/nagios-nsca/nagios-nsca.service new file +12 -0
new file mode 100644
index 0000000..aa38b7f
@@ -0,0 +1,12 @@
+[Unit]
+Description=Nagios nsca plugin
+After=syslog.target network.target
+
+[Service]
+Type=forking
+ExecStart=/usr/bin/nsca -s -c /etc/nagios/nsca.cfg
+PIDFile=/var/run/nsca.pid
+TimeoutSec=60
+
+[Install]
+WantedBy=multi-user.target
recipes-extended/nagios/nagios-nsca_2.9.1.bb new file +85 -0

85 lines not on this page · raw message

Signature · 1 line
2.7.4
author
#3 lore raw

PATCH v2 4/6 nagios-plugins: add recipe with latest stable version 2.2.1

In reply to Chen Qi
---
 recipes-extended/nagios/nagios-plugins_2.2.1.bb | 73 +++++++++++++++++++++++++
 1 file changed, 73 insertions(+)
 create mode 100644 recipes-extended/nagios/nagios-plugins_2.2.1.bb
recipes-extended/nagios/nagios-plugins_2.2.1.bb new file +73 -0
new file mode 100644
index 0000000..0793365
@@ -0,0 +1,73 @@
+require nagios-common.inc
+
+DESCRIPTION = "A host/service/network monitoring and management system plugins"
+HOMEPAGE = "http://www.nagios-plugins.org"
+SECTION = "console/network"
+PRIORITY = "optional"
+LICENSE = "GPLv3"
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
+
+SRC_URI = "https://www.nagios-plugins.org/download/${BPN}-${PV}.tar.gz \
+"
+
+SRC_URI[md5sum] = "fb521d5c05897f165b0b1862c1e5cb27"
+SRC_URI[sha256sum] = "647c0ba4583d891c965fc29b77c4ccfeccc21f409fdf259cb8af52cb39c21e18"
+
+S = "${WORKDIR}/${BPN}-${PV}"
+
+inherit autotools gettext
+
+EXTRA_OECONF += "--with-sysroot=${STAGING_DIR_HOST} \
+                 --with-nagios-user=${NAGIOS_USER} \
+                 --with-nagios-group=${NAGIOS_GROUP} \
+                 --without-apt-get-command \
+                 --with-trusted-path=/bin:/sbin:/usr/bin:/usr/sbin \
+                 ac_cv_path_PERL=${bindir}/perl \
+"
+
+# IPv6
+PACKAGECONFIG[ipv6] = "--with-ipv6,--without-ipv6,,"
+
+# Enable check_ldaps, check_http --ssl, check_tcp --ssl
+PACKAGECONFIG[ssl] = "--with-openssl=${STAGING_DIR_HOST},--without-openssl,openssl,libssl"
+
+# Enable check_ldaps
+PACKAGECONFIG[ldap] = "--with-ldap,--without-ldap,openldap"
+
+# Enable check_smtp --starttls
+PACKAGECONFIG[gnutls] = "--with-gnutls=${STAGING_DIR_HOST},--without-gnutls,gnutls,gnutls"
+
+# Enable check_pgsql
+PACKAGECONFIG[pgsql] = "--with-pgsql=${STAGING_DIR_HOST},--without-pgsql,postgresql,libpq"
+
+# Enable check_mysql, check_mysql_query
+PACKAGECONFIG[mysql] = "--with-mysql=${STAGING_DIR_HOST},--without-mysql,mysql5,libmysqlclient"
+
+# Enable check_snmp
+PACKAGECONFIG[snmp] = "\
+    --with-snmpget-command=${bindir}/snmpget --with-snmpgetnext-command=${bindir}/snmpgetnext, \
+    --without-snmpget-command --without-snmpgetnext-command, \
+    , net-snmp-utils \
+"
+
+PACKAGECONFIG ??= "ssl gnutls"
+
+do_configure() {
+    oe_runconf || die "make failed"
+}
+
+do_install_append() {
+     sed -i '1s,#! /usr/bin/perl -w.*,#! ${bindir}/env perl,' ${D}${libdir}/nagios/plugins/*
+}
+
+RDEPENDS_${PN} += "\
+    iputils \
+    nagios-base \
+    perl \
+    bash \
+"
+
+FILES_${PN} += "${datadir} \
+                ${NAGIOS_PLUGIN_DIR} \
+"
Signature · 1 line
2.7.4
author
#4 lore raw

PATCH v2 5/6 fs-perms-nagios.txt: add perms conf file

In reply to Chen Qi

Add this perms conf file to avoid do_rootfs failure due to conflicts among nagios packages.

The error message is like below.

Error: Transaction check error:
file /etc/nagios conflicts between attempted installs of \
nagios-core-4.0.8-r0.core2_64 and nagios-nrpe-plugin-2.15-r0.core2_64

---
 files/fs-perms-nagios.txt | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 files/fs-perms-nagios.txt
files/fs-perms-nagios.txt new file +2 -0
new file mode 100644
index 0000000..1334cd1
@@ -0,0 +1,2 @@
+${sysconfdir}/nagios                       0755    nagios    nagios    false - - -
+${libdir}/nagios/plugins                   0755    nagios    nagios    true 0644 nagios nagios
Signature · 1 line
2.7.4
author
#5 lore raw

PATCH v2 6/6 layer.conf: recommend meta-webserver as nagios-core depends on apache2

In reply to Chen Qi
---
 conf/layer.conf | 5 +++++
 1 file changed, 5 insertions(+)
conf/layer.conf +5 -0
index eaef1b7..1ad0e38 100644
@@ -23,6 +23,11 @@ LAYERDEPENDS_virtualization-layer = " \
     meta-python \
 "
 
+# webserver: naigos requires apache2
+LAYERRECOMMENDS_virtualization-layer = " \
+    webserver \
+"
+
 # Override security flags
 require conf/distro/include/virt_security_flags.inc
 
Signature · 1 line
2.7.4
#6 lore raw
In reply to Chen Qi

The v2 series is now merged.

Bruce

Quoted 548 lines · Chen Qi
---
 recipes-extended/nagios/nagios-common.inc          |  26 ++++
 .../nagios-core/0001-fix-autoheader-error.patch    |  63 +++++++++
 ...0001-fix-compile-error-of-missing-headers.patch |  75 ++++++++++
 .../nagios-core/0001-fix-segment-fault.patch       |  54 ++++++++
 .../nagios-core/eventhandlers_nagioscmd_path.patch |  73 ++++++++++
 .../nagios-core/nagios-core-systemd-volatile.conf  |   2 +
 .../nagios/nagios-core/nagios-core.service         |  18 +++
 recipes-extended/nagios/nagios-core/volatiles      |   2 +
 recipes-extended/nagios/nagios-core_4.4.2.bb       | 151 +++++++++++++++++++++
 9 files changed, 464 insertions(+)
 create mode 100644 recipes-extended/nagios/nagios-common.inc
 create mode 100644 recipes-extended/nagios/nagios-core/0001-fix-autoheader-error.patch
 create mode 100644 recipes-extended/nagios/nagios-core/0001-fix-compile-error-of-missing-headers.patch
 create mode 100644 recipes-extended/nagios/nagios-core/0001-fix-segment-fault.patch
 create mode 100644 recipes-extended/nagios/nagios-core/eventhandlers_nagioscmd_path.patch
 create mode 100644 recipes-extended/nagios/nagios-core/nagios-core-systemd-volatile.conf
 create mode 100644 recipes-extended/nagios/nagios-core/nagios-core.service
 create mode 100644 recipes-extended/nagios/nagios-core/volatiles
 create mode 100644 recipes-extended/nagios/nagios-core_4.4.2.bb
recipes-extended/nagios/nagios-common.inc new file +26 -0
new file mode 100644
index 0000000..c173041
@@ -0,0 +1,26 @@
+NAGIOS_CONF_DIR = "${sysconfdir}/nagios"
+NAGIOS_PLUGIN_DIR = "${libdir}/nagios/plugins"
+NAGIOS_PLUGIN_CONF_DIR = "${NAGIOS_CONF_DIR}/plugins"
+NAGIOS_STATE_DIR = "${localstatedir}/nagios"
+
+NAGIOS_USER = "nagios"
+NAGIOS_GROUP = "nagios"
+
+EXTRA_OECONF += "--sysconfdir=${NAGIOS_CONF_DIR} \
+                 --libexecdir=${NAGIOS_PLUGIN_DIR} \
+                 --localstatedir=${NAGIOS_STATE_DIR} \
+"
+
+FILES_${PN}-dbg += "${NAGIOS_PLUGIN_DIR}/.debug"
+
+DEPENDS = "nagios-core"
+
+COMPATIBLE_HOST_aarch64 = "null"
+
+inherit useradd
+
+USERADD_PACKAGES = "${PN}"
+GROUPADD_PARAM_${PN} = "-r ${NAGIOS_GROUP}; -r nagcmd"
+USERADD_PARAM_${PN} = "-r -M -g ${NAGIOS_GROUP} ${NAGIOS_USER}"
+
+FILESYSTEM_PERMS_TABLES_append = " files/fs-perms-nagios.txt"
recipes-extended/nagios/nagios-core/0001-fix-autoheader-error.patch new file +63 -0
new file mode 100644
index 0000000..014ed1d
@@ -0,0 +1,63 @@
+From 3c51d942f6da08045351ce61cc7f426fa0855489 Mon Sep 17 00:00:00 2001
+From: Chen Qi <[email protected]>
+Date: Fri, 31 Aug 2018 10:51:36 +0800
+Subject: [PATCH] fix autoheader error
+
+Upstream-Status: Pending
+
+Signed-off-by: Chen Qi <[email protected]>
+---
+ configure.ac | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 17e436d..16b3e71 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -388,7 +388,7 @@ AC_ARG_WITH(iobroker,
+ case $IOBROKER_METHOD in
+ epoll*)
+       if test "$GLIBC_NEWER_2_4" -eq 1 -a "x$ac_cv_header_sys_epoll_h" = "xyes"; then
+-              AC_DEFINE([IOBROKER_USES_EPOLL])
++              AC_DEFINE([IOBROKER_USES_EPOLL], [1], [iobroker uses epoll])
+       else
+               echo "\"epoll\" is not available as an iobroker method."
+               echo "Please use one of the other options."
+@@ -397,7 +397,7 @@ epoll*)
+       ;;
+ poll*)
+       if test "x$ac_cv_header_sys_poll_h" = "xyes" -o "x$ac_cv_header_poll_h" = "xyes"; then
+-              AC_DEFINE([IOBROKER_USES_POLL])
++              AC_DEFINE([IOBROKER_USES_POLL], [1], [iobroker uses poll])
+       else
+               echo "\"poll\" is not available as an iobroker method."
+               echo "Please use one of the other options."
+@@ -406,7 +406,7 @@ poll*)
+       ;;
+ select*)
+       if test "x$ac_cv_header_sys_select_h" = "xyes"; then
+-              AC_DEFINE([IOBROKER_USES_SELECT])
++              AC_DEFINE([IOBROKER_USES_SELECT], [1], [iobroker uses select])
+       else
+               echo "\"select\" is not available as an iobroker method."
+               echo "Please use one of the other options."
+@@ -415,13 +415,13 @@ select*)
+       ;;
+ none*)
+       if test "$GLIBC_NEWER_2_4" -eq 1 -a "x$ac_cv_header_sys_epoll_h" = "xyes"; then
+-              AC_DEFINE([IOBROKER_USES_EPOLL])
++              AC_DEFINE([IOBROKER_USES_EPOLL], [1], [iobroker uses epoll])
+               IOBROKER_METHOD="epoll"
+       elif test "x$ac_cv_header_sys_poll_h" = "xyes" -o "x$ac_cv_header_poll_h" = "xyes"; then
+-              AC_DEFINE([IOBROKER_USES_POLL])
++              AC_DEFINE([IOBROKER_USES_POLL], [1], [iobroker uses poll])
+               IOBROKER_METHOD="poll"
+       elif test "x$ac_cv_header_sys_select_h" = "xyes"; then
+-              AC_DEFINE([IOBROKER_USES_SELECT])
++              AC_DEFINE([IOBROKER_USES_SELECT], [1], [iobroker uses select])
+               IOBROKER_METHOD="select"
+       else
+               echo "There are no available options for iobroker polling"
+--
+2.7.4
+
recipes-extended/nagios/nagios-core/0001-fix-compile-error-of-missing-headers.patch new file +75 -0
new file mode 100644
index 0000000..7f4cfbd
@@ -0,0 +1,75 @@
+From a5e12350cb25b2f9289c0d27e26afc337652d42e Mon Sep 17 00:00:00 2001
+From: Chen Qi <[email protected]>
+Date: Fri, 31 Aug 2018 13:33:31 +0800
+Subject: [PATCH] fix compile error of missing headers
+
+Upstream-Status: Pending
+
+Signed-off-by: Chen Qi <[email protected]>
+---
+ cgi/getcgi.c     |  3 ++-
+ include/shared.h | 31 +++++++++++++++++++++++++++++++
+ 2 files changed, 33 insertions(+), 1 deletion(-)
+
+diff --git a/cgi/getcgi.c b/cgi/getcgi.c
+index 37b479f..1f83e11 100644
+--- a/cgi/getcgi.c
++++ b/cgi/getcgi.c
+@@ -7,10 +7,11 @@
+
+ #include "../include/config.h"
+ #include "../include/getcgi.h"
++#include "../include/shared.h"
++
+ #include <stdio.h>
+ #include <stdlib.h>
+
+-
+ #undef PARANOID_CGI_INPUT
+
+
+diff --git a/include/shared.h b/include/shared.h
+index 84836c7..1dfa0c7 100644
+--- a/include/shared.h
++++ b/include/shared.h
+@@ -1,6 +1,37 @@
+ #ifndef NAGIOS_SHARED_H_INCLUDED
+ #define NAGIOS_SHARED_H_INCLUDED
+
++#include <stdio.h>
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <sys/socket.h>
++#include <sys/mman.h>
++#include <stdlib.h>
++#include <stddef.h>
++#include <stdlib.h>
++#include <memory.h>
++#include <string.h>
++#include <strings.h>
++#include <inttypes.h>
++#include <stdint.h>
++#include <unistd.h>
++#include <dirent.h>
++#include <math.h>
++#include <fcntl.h>
++#include <regex.h>
++#include <ctype.h>
++#include <sys/prctl.h>
++#include <stdarg.h>
++#include <dlfcn.h>
++#include <getopt.h>
++#include <syslog.h>
++#include <pwd.h>
++#include <grp.h>
++#include <netdb.h>
++#include <wchar.h>
++#include <locale.h>
++#include <limits.h>
++
+ #include <time.h>
+ #include "lib/libnagios.h"
+
+--
+2.7.4
+
recipes-extended/nagios/nagios-core/0001-fix-segment-fault.patch new file +54 -0
new file mode 100644
index 0000000..1ea8da9
@@ -0,0 +1,54 @@
+From 65e4539c6eca215d8d79ef8acc5c8842b886752a Mon Sep 17 00:00:00 2001
+From: Chen Qi <[email protected]>
+Date: Mon, 3 Sep 2018 13:15:29 +0800
+Subject: [PATCH] fix segment fault
+
+When using strdup(dirname(cfgfile)) directly, we will have segment
+fault. This happens at least for glibc 2.28. So we do it step by
+step, and this would avoid the segment fault.
+
+Upstream-Status: Pending
+
+Signed-off-by: Chen Qi <[email protected]>
+---
+ include/shared.h    | 1 +
+ xdata/xodtemplate.c | 4 +++-
+ 2 files changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/include/shared.h b/include/shared.h
+index 1dfa0c7..0188c7d 100644
+--- a/include/shared.h
++++ b/include/shared.h
+@@ -31,6 +31,7 @@
+ #include <wchar.h>
+ #include <locale.h>
+ #include <limits.h>
++#include <libgen.h>
+
+ #include <time.h>
+ #include "lib/libnagios.h"
+diff --git a/xdata/xodtemplate.c b/xdata/xodtemplate.c
+index 33d51f4..da32e69 100644
+--- a/xdata/xodtemplate.c
++++ b/xdata/xodtemplate.c
+@@ -187,6 +187,7 @@ static void xodtemplate_free_template_skiplists(void) {
+ int xodtemplate_read_config_data(const char *main_config_file, int options) {
+ #ifdef NSCORE
+       char *cfgfile = NULL;
++      char *cfgfile_dir = NULL;
+       char *config_base_dir = NULL;
+       char *input = NULL;
+       char *var = NULL;
+@@ -261,7 +262,8 @@ int xodtemplate_read_config_data(const char *main_config_file, int options) {
+                       printf("Unable to allocate memory!\n");
+                       return ERROR;
+                       }
+-              config_base_dir = (char *)strdup(dirname(cfgfile));
++              cfgfile_dir = dirname(cfgfile);
++              config_base_dir = (char *)strdup(cfgfile_dir);
+               my_free(cfgfile);
+
+               /* open the main config file for reading (we need to find all the config files to read) */
+--
+2.7.4
+
recipes-extended/nagios/nagios-core/eventhandlers_nagioscmd_path.patch new file +73 -0
new file mode 100644
index 0000000..c767162
@@ -0,0 +1,73 @@
+change eventhandlers nagioscmd path
+
+Modify nagios.cmd path to the right location
+at "/var/nagios/rw/nagios.cmd"
+
+Signed-off-by: Rickard Engberg <[email protected]>
+Signed-off-by: Vu Tran <[email protected]>
+
+diff --git a/contrib/eventhandlers/disable_active_service_checks b/contrib/eventhandlers/disable_active_service_checks
+index c01f2be..2c2880b 100755
+--- a/contrib/eventhandlers/disable_active_service_checks
++++ b/contrib/eventhandlers/disable_active_service_checks
+@@ -16,7 +16,7 @@
+
+ printfcmd="/usr/bin/printf"
+
+-CommandFile="/usr/local/nagios/var/rw/nagios.cmd"
++CommandFile="/var/nagios/rw/nagios.cmd"
+
+ # get the current date/time in seconds since UNIX epoch
+ datetime=`date +%s`
+diff --git a/contrib/eventhandlers/disable_notifications b/contrib/eventhandlers/disable_notifications
+index a92bb7a..b2c9c06 100755
+--- a/contrib/eventhandlers/disable_notifications
++++ b/contrib/eventhandlers/disable_notifications
+@@ -14,7 +14,7 @@
+
+ printfcmd="/usr/bin/printf"
+
+-CommandFile="/usr/local/nagios/var/rw/nagios.cmd"
++CommandFile="/var/nagios/rw/nagios.cmd"
+
+ # get the current date/time in seconds since UNIX epoch
+ datetime=`date +%s`
+diff --git a/contrib/eventhandlers/enable_active_service_checks b/contrib/eventhandlers/enable_active_service_checks
+index 423c8d9..631fa00 100755
+--- a/contrib/eventhandlers/enable_active_service_checks
++++ b/contrib/eventhandlers/enable_active_service_checks
+@@ -16,7 +16,7 @@
+
+ printfcmd="/usr/bin/printf"
+
+-CommandFile="/usr/local/nagios/var/rw/nagios.cmd"
++CommandFile="/var/nagios/rw/nagios.cmd"
+
+ # get the current date/time in seconds since UNIX epoch
+ datetime=`date +%s`
+diff --git a/contrib/eventhandlers/enable_notifications b/contrib/eventhandlers/enable_notifications
+index 0d3f13d..2cc0b47 100755
+--- a/contrib/eventhandlers/enable_notifications
++++ b/contrib/eventhandlers/enable_notifications
+@@ -14,7 +14,7 @@
+
+ printfcmd="/usr/bin/printf"
+
+-CommandFile="/usr/local/nagios/var/rw/nagios.cmd"
++CommandFile="/var/nagios/rw/nagios.cmd"
+
+ # get the current date/time in seconds since UNIX epoch
+ datetime=`date +%s`
+diff --git a/contrib/eventhandlers/submit_check_result b/contrib/eventhandlers/submit_check_result
+index 5d89f31..790a988 100755
+--- a/contrib/eventhandlers/submit_check_result
++++ b/contrib/eventhandlers/submit_check_result
+@@ -24,7 +24,7 @@
+
+ echocmd="/bin/echo"
+
+-CommandFile="/usr/local/nagios/var/rw/nagios.cmd"
++CommandFile="/var/nagios/rw/nagios.cmd"
+
+ # get the current date/time in seconds since UNIX epoch
+ datetime=`date +%s`
recipes-extended/nagios/nagios-core/nagios-core-systemd-volatile.conf new file +2 -0
new file mode 100644
index 0000000..134fb85
@@ -0,0 +1,2 @@
+d /var/nagios 0755 nagios nagios -
+d /var/run/nagios 0755 nagios nagios -
recipes-extended/nagios/nagios-core/nagios-core.service new file +18 -0
new file mode 100644
index 0000000..61fda3f
@@ -0,0 +1,18 @@
+[Unit]
+Description=Nagios core
+After=network.target local-fs.target
+
+[Service]
+Type=forking
+User=nagios
+Group=nagios
+PIDFile=/var/run/nagios/nagios.pid
+# Verify Nagios config before start as upstream suggested
+ExecStartPre=/usr/bin/nagios -v /etc/nagios/nagios.cfg
+ExecStart=/usr/bin/nagios -d /etc/nagios/nagios.cfg
+ExecStop=/bin/kill -TERM ${MAINPID}
+ExecStopPost=/bin/rm -f /var/spool/nagios/cmd/nagios.cmd
+ExecReload=/bin/kill -HUP ${MAINPID}
+
+[Install]
+WantedBy=multi-user.target
recipes-extended/nagios/nagios-core/volatiles new file +2 -0
new file mode 100644
index 0000000..e9bb768
@@ -0,0 +1,2 @@
+d nagios nagios 0755 /var/nagios none
+d nagios nagios 0755 /var/run/nagios none
recipes-extended/nagios/nagios-core_4.4.2.bb new file +151 -1
new file mode 100644
index 0000000..b2196eb
@@ -0,0 +1,151 @@
+require nagios-common.inc
+
+DESCRIPTION = "A host/service/network monitoring and management system core files"
+HOMEPAGE = "http://www.nagios.org"
+SECTION = "console/network"
+PRIORITY = "optional"
+LICENSE = "GPLv2"
+
+LIC_FILES_CHKSUM = "file://LICENSE;md5=4c4203caac58013115c9ca4b85f296ae"
+
+SRCNAME = "nagios"
+
+SRC_URI = "http://prdownloads.sourceforge.net/sourceforge/${SRCNAME}/${SRCNAME}-${PV}.tar.gz \
+           file://eventhandlers_nagioscmd_path.patch \
+           file://0001-fix-autoheader-error.patch \
+           file://0001-fix-compile-error-of-missing-headers.patch \
+           file://0001-fix-segment-fault.patch \
+           file://volatiles \
+           file://nagios-core.service \
+           file://nagios-core-systemd-volatile.conf \
+           "
+
+SRC_URI[md5sum] = "7a9736281d4e2ebe4f4569a782f733c5"
+SRC_URI[sha256sum] = "3418923f326aa86dc8c84cfd0df788fa495a90d772f8071acf40fdbef0736853"
+
+S = "${WORKDIR}/${SRCNAME}-${PV}"
+
+inherit autotools-brokensep update-rc.d systemd
+
+DEPENDS = "gd unzip-native"
+
+RDEPENDS_${PN} += "\
+    gd \
+    libpng \
+    fontconfig \
+    apache2 \
+    php \
+    nagios-base \
+"
+
+acpaths = "-I ${S}/autoconf-macros"
+
+# Set default password for the hardcoded Nagios admin user "nagiosadmin".
+# If this variable is empty then will prompt user for password.
+NAGIOS_DEFAULT_ADMINUSER_PASSWORD ??= "password"
+NAGIOS_CGIBIN_DIR = "${libdir}/nagios/cgi-bin"
+
+EXTRA_OECONF += "--sbindir=${NAGIOS_CGIBIN_DIR} \
+                 --datadir=${datadir}/nagios/htdocs \
+                 --with-command-group=nagcmd \
+                 --with-httpd-conf=${sysconfdir}/apache2/conf.d \
+                 --with-lockfile=${localstatedir}/run/nagios/nagios.pid \
+                 --with-init-dir=${sysconfdir}/init.d \
+"
+
+# Prevent nagios from stripping binaries, bitbake will take care of that
+EXTRA_OECONF += "ac_cv_path_STRIP=true"
+
+# Prevent nagios from using dynamic libtool library
+EXTRA_OECONF += "ac_cv_header_ltdl_h=no"
+
+# Prevent nagios from suffering host contamination if host has /bin/perl
+EXTRA_OECONF += "ac_cv_path_PERL=${bindir}/perl"
+
+# Set to "1" to allow nagios-core post-init to modify Apache configuration
+NAGIOS_MODIFY_APACHE ??= "1"
+
+do_configure_prepend() {
+       # rename these macros to have .m4 suffix so that autoreconf could recognize them
+       for macro in `ls ${S}/autoconf-macros/ax_nagios_get_*`; do
+               mv $macro $macro.m4
+       done
+}
+
+do_compile() {
+       oe_runmake all
+}
+
+do_install() {
+    oe_runmake 'DESTDIR=${D}' install
+    oe_runmake 'DESTDIR=${D}' install-init
+    oe_runmake 'DESTDIR=${D}' install-config
+    oe_runmake 'DESTDIR=${D}' install-commandmode
+
+    install -d ${D}${sysconfdir}/apache2/conf.d
+    oe_runmake 'DESTDIR=${D}' install-webconf
+
+    install -d ${D}${NAGIOS_PLUGIN_CONF_DIR}
+
+    # There is no install target for the contributed eventhandlers so we
+    # just do it.
+    install -d ${D}${NAGIOS_PLUGIN_DIR}/eventhandlers
+    for f in ${S}/contrib/eventhandlers/* ; do
+        if ! [ -f $f ] ; then
+            continue;
+        fi
+        install $f ${D}${NAGIOS_PLUGIN_DIR}/eventhandlers/
+    done
+
+    echo "cfg_dir=${NAGIOS_PLUGIN_CONF_DIR}" >> ${D}${NAGIOS_CONF_DIR}/nagios.cfg
+
+    if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
+        install -d ${D}${systemd_unitdir}/system
+        install -m 644 ${WORKDIR}/nagios-core.service ${D}${systemd_unitdir}/system/
+        # use our own service file
+        rm -f ${D}${systemd_unitdir}/system/nagios.service
+        install -d ${D}${sysconfdir}/tmpfiles.d
+        install -m 755 ${WORKDIR}/nagios-core-systemd-volatile.conf ${D}${sysconfdir}/tmpfiles.d/nagios-core-volatile.conf
+    else
+        install -d ${D}${sysconfdir}/default/volatiles
+        install -m 0644 ${WORKDIR}/volatiles ${D}${sysconfdir}/default/volatiles/99_nagios
+    fi
+}
+
+pkg_postinst_ontarget_${PN}-setup () {
+    # Set password for nagiosadmin user
+    if [ -z "${NAGIOS_DEFAULT_ADMINUSER_PASSWORD}" ]; then
+        htpasswd -c ${NAGIOS_CONF_DIR}/htpasswd.users nagiosadmin
+    else
+        htpasswd -b -c ${NAGIOS_CONF_DIR}/htpasswd.users nagiosadmin \
+           "${NAGIOS_DEFAULT_ADMINUSER_PASSWORD}"
+    fi
+
+    # Apache2 might by default turn off CGI
+    if [ "${NAGIOS_MODIFY_APACHE}" == "1" ] && [ -f "${sysconfdir}/apache2/httpd.conf" ]; then
+        sed -e 's/^#LoadModule cgid_module/LoadModule cgid_module/g' -i ${sysconfdir}/apache2/httpd.conf
+    fi
+}
+
+PACKAGES += "${SRCNAME}-base ${PN}-setup"
+
+FILES_${PN} += "${datadir} \
+                ${NAGIOS_PLUGIN_DIR} \
+                ${NAGIOS_CGIBIN_DIR} \
+"
+
+FILES_${PN}-dbg += "${NAGIOS_CGIBIN_DIR}/.debug"
+
+ALLOW_EMPTY_${SRCNAME}-base = "1"
+ALLOW_EMPTY_${PN}-setup = "1"
+
+SYSTEMD_PACKAGES = "${PN}"
+SYSTEMD_SERVICE_${PN} = "nagios-core.service"
+SYSTEMD_AUTO_ENABLE_${PN} = "enable"
+
+USERADD_PACKAGES += "${SRCNAME}-base"
+GROUPADD_PARAM_${SRCNAME}-base = "-r ${NAGIOS_GROUP}"
+USERADD_PARAM_${SRCNAME}-base = "-r -M -g ${NAGIOS_GROUP} ${NAGIOS_USER}"
+
+INITSCRIPT_NAME = "nagios"
+INITSCRIPT_PARAMS = "defaults"
--

2.7.4

--
_______________________________________________
meta-virtualization mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end"