Skip to contentSkip to conversation

nagios-core: add recipe with latest stable version 4.4.2

PATCH Superseded Chen Qi 2 participants 8 messages Sep 4, 2018 – Sep 6, 2018

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Chen Qi

author
#0 lore raw

PATCH 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 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 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 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 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 6/6 layer.conf: depend on meta-webserver as nagios-core depends on apache2

In reply to Chen Qi
---
 conf/layer.conf | 1 +
 1 file changed, 1 insertion(+)
conf/layer.conf +1 -0
index eaef1b7..ad2c96e 100644
@@ -21,6 +21,7 @@ LAYERDEPENDS_virtualization-layer = " \
     networking-layer \
     filesystems-layer \
     meta-python \
+    webserver \
 "
 
 # Override security flags
Signature · 1 line
2.7.4
#6 lore raw

Re: [PATCH 6/6] layer.conf: depend on meta-webserver as nagios-core depends on apache2

But nagios won't always be installed/used, so this is not a hard dependency of meta-virtualization.

So while I don't mind this going into the README as a depends, I don't think it belongs in the layer.conf.

Also, can we have a README for how nagios works, and should be sanity tested ? As it stands right now, I have no way to know how to build and test it.

I'll wait for a v2 with those changes.

Bruce

Quoted 25 lines · Chen Qi
---
 conf/layer.conf | 1 +
 1 file changed, 1 insertion(+)
conf/layer.conf +1 -1
index eaef1b7..ad2c96e 100644
@@ -21,6 +21,7 @@ LAYERDEPENDS_virtualization-layer = " \
     networking-layer \
     filesystems-layer \
     meta-python \
+    webserver \
 "
 
 # Override security flags
--

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"
author
#7 lore raw

Re: [PATCH 6/6] layer.conf: depend on meta-webserver as nagios-core depends on apache2

Quoted 2 lines · Bruce Ashfield

But nagios won't always be installed/used, so this is not a hard dependency of meta-virtualization.

If you don't think we should depend on webserver layer, ignore this patch. I agree that it's not a hard dependency.

Quoted 2 lines

So while I don't mind this going into the README as a depends, I don't think it belongs in the layer.conf.

Should we consider using LAYERRECOMMENDS? I'll send out V2 with this change.

Quoted 2 lines

Also, can we have a README for how nagios works, and should be sanity tested ? As it stands right now, I have no way to know how to build and test it.

The runtime tests I did are:
1. systemctl status nagios-core
2. systemctl status nagios-nrpe
3. systemctl status nagios-nsca

These services started correctly without any error.

I agree that maybe more detailed usage examples and tests are better.
However, currently I don't have time for this.
People interested in nagios could find sufficient documents on nagios's official website. Also, we don't have substantial patches that could possibly affect the service logic of nagios.

Best Regards,
Chen Qi

Quoted 32 lines

I'll wait for a v2 with those changes.

Bruce

Quoted 25 lines · Chen Qi
---
  conf/layer.conf | 1 +
  1 file changed, 1 insertion(+)
conf/layer.conf +1 -1
index eaef1b7..ad2c96e 100644
@@ -21,6 +21,7 @@ LAYERDEPENDS_virtualization-layer = " \
      networking-layer \
      filesystems-layer \
      meta-python \
+    webserver \
  "
 
  # Override security flags
--

2.7.4

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