diff --git a/Makefile b/Makefile index 6cbb6da6b..f9e09d729 100644 --- a/Makefile +++ b/Makefile @@ -58,7 +58,7 @@ PACKAGES=freetds \ grafana-thruk-datasource \ sakuli\ victoriametrics \ - xinetd + xinetd include Makefile.omd diff --git a/Makefile.omd b/Makefile.omd index ac7fddba9..44e1fee2c 100644 --- a/Makefile.omd +++ b/Makefile.omd @@ -24,7 +24,8 @@ DISTRO_VERSION = $(word 2, $(DISTRO_INFO)) # specific variables. Here the same problem appears again. # Maybe anyone has a simpler solution? -include $(ROOT_DIR)/distros/Makefile.$(DISTRO_NAME)_$(DISTRO_VERSION) +DISTRO_FILE = $(ROOT_DIR)/distros/Makefile.$(DISTRO_NAME)_$(DISTRO_VERSION) +include $(DISTRO_FILE) # Net result -> all Makefiles have now access to the linux distribution # specific settings diff --git a/distros/Makefile.ROCKY_9 b/distros/Makefile.ROCKY_9 index 418377586..4d463744b 100644 --- a/distros/Makefile.ROCKY_9 +++ b/distros/Makefile.ROCKY_9 @@ -27,6 +27,7 @@ BUILD_PACKAGES += libsmbclient-devel BUILD_PACKAGES += libsqlite3x-devel # needed for gearmand retention BUILD_PACKAGES += libstdc++-devel BUILD_PACKAGES += libstdc++-static # required by livestatus +BUILD_PACKAGES += libtirpc-devel # xinetd BUILD_PACKAGES += libtool BUILD_PACKAGES += libtool-ltdl-devel # RHEL Server Optional BUILD_PACKAGES += libtool-ltdl # needed by libtool-ltdl-devel @@ -88,6 +89,7 @@ OS_PACKAGES += libicu OS_PACKAGES += libmcrypt OS_PACKAGES += libsmbclient OS_PACKAGES += libsqlite3x +OS_PACKAGES += libtirpc # xinetd OS_PACKAGES += libtool-ltdl OS_PACKAGES += logrotate OS_PACKAGES += mariadb-server diff --git a/distros/Makefile.SLES_15SP3 b/distros/Makefile.SLES_15SP3 index 0d68568a9..24b77fc1b 100644 --- a/distros/Makefile.SLES_15SP3 +++ b/distros/Makefile.SLES_15SP3 @@ -66,7 +66,6 @@ BUILD_PACKAGES += sqlite3-devel BUILD_PACKAGES += systemd-devel # grafana-loki BUILD_PACKAGES += tar # needed for "make rpm" BUILD_PACKAGES += unzip # unpack src files of packages -BUILD_PACKAGES += libtirpc-devel # xinetd OS_PACKAGES = OS_PACKAGES += apache2 OS_PACKAGES += bind-utils @@ -92,6 +91,7 @@ OS_PACKAGES += libpng16-16 OS_PACKAGES += libreadline7 OS_PACKAGES += libsmbclient0 OS_PACKAGES += libsqlite3-0 +OS_PACKAGES += libtirpc # xinetd OS_PACKAGES += libuuid1 OS_PACKAGES += mysql OS_PACKAGES += net-snmp diff --git a/packages/xinetd/Makefile b/packages/xinetd/Makefile index 265930a8f..5573e64db 100644 --- a/packages/xinetd/Makefile +++ b/packages/xinetd/Makefile @@ -1,26 +1,28 @@ include ../../Makefile.omd XINETD=2-3-15 -SLES15 = $(shell echo $(DISTRO_INFO) | grep -c 'SLES 15' ) -SLES15SP3 = $(shell echo $(DISTRO_INFO) | grep -c 'SLES 15SP3' ) +HAS_XINETD=$(shell grep -c "= xinetd" $(DISTRO_FILE) ) +USE_TIRPC = $(shell grep -c 'tirpc' $(DISTRO_FILE) ) -ifeq ($(SLES15SP3), 1) -LDFLAGS = "-ltirpc" +ifneq ($(USE_TIRPC), 0) +LDFLAGS=$(shell pkg-config --libs libtirpc) +CFLAGS=$(shell pkg-config --cflags libtirpc) else -LDFLAGS = "" +LDFLAGS= +C_INCLUDE_PATH= endif build: -ifeq ($(SLES15), 1) +ifeq ($(HAS_XINETD), 0) tar xvzf xinetd-$(XINETD).tar.gz cd xinetd-xinetd-$(XINETD) && \ ./configure; \ - make LDFLAGS=$(LDFLAGS); \ + make LDFLAGS=$(LDFLAGS) CFLAGS=$(CFLAGS); \ strip xinetd/xinetd endif install: -ifeq ($(SLES15), 1) +ifeq ($(HAS_XINETD), 0) mkdir -p $(DESTDIR)$(OMD_ROOT)/bin cp xinetd-xinetd-$(XINETD)/xinetd/xinetd \ $(DESTDIR)$(OMD_ROOT)/bin @@ -29,6 +31,6 @@ endif skel: clean: -ifeq ($(SLES15), 1) +ifeq ($(HAS_XINETD), 0) rm -rf xinetd-xinetd-$(XINETD) endif diff --git a/packages/omd/skel/etc/init.d/xinetd b/packages/xinetd/skel/etc/init.d/xinetd similarity index 87% rename from packages/omd/skel/etc/init.d/xinetd rename to packages/xinetd/skel/etc/init.d/xinetd index dad1a0b14..f20d30668 100644 --- a/packages/omd/skel/etc/init.d/xinetd +++ b/packages/xinetd/skel/etc/init.d/xinetd @@ -3,15 +3,15 @@ # Start only if at least on xinetd based service # is activated -test "$(ls -A ###ROOT###/etc/xinetd.d/)" || exit 5 +test "$(ls -A $OMD_ROOT/etc/xinetd.d/)" || exit 5 -PIDFILE=###ROOT###/tmp/run/xinetd.pid -if [ -x ###ROOT###/bin/xinetd ]; then - DAEMON=###ROOT###/bin/xinetd +PIDFILE=$OMD_ROOT/tmp/run/xinetd.pid +if [ -x $OMD_ROOT/bin/xinetd ]; then + DAEMON=$OMD_ROOT/bin/xinetd else DAEMON=/usr/sbin/xinetd fi -OPTS="-pidfile ###ROOT###/tmp/run/xinetd.pid -filelog ###ROOT###/var/log/xinetd.log -f ###ROOT###/etc/xinetd.conf" +OPTS="-pidfile $OMD_ROOT/tmp/run/xinetd.pid -filelog $OMD_ROOT/var/log/xinetd.log -f $OMD_ROOT/etc/xinetd.conf" case "$1" in start) diff --git a/t/03-distro-makefiles.t b/t/03-distro-makefiles.t index 763685c80..2a61dfc14 100644 --- a/t/03-distro-makefiles.t +++ b/t/03-distro-makefiles.t @@ -29,8 +29,6 @@ for my $file (glob("distros/Makefile.*")) { for my $file (keys %{$all_confs}) { for my $key (keys %{$all_keys}) { next if $key eq 'ARCH'; # arch is debian specific - next if $key eq 'CONFIG_SITE'; # CONFIG_SITE is OpenSuSE specific - next if $key eq 'SKIP_PACKAGES'; # SKIP_PACKAGES is optional ok(exists($all_confs->{$file}->{$key}), "$file: $key"); } } diff --git a/t/20-package_naemon.t b/t/20-package_naemon.t index 399372a14..ddd662c4e 100644 --- a/t/20-package_naemon.t +++ b/t/20-package_naemon.t @@ -12,7 +12,7 @@ BEGIN { use lib "$FindBin::Bin/lib/lib/perl5"; } -plan( tests => 86 ); +plan( tests => 107 ); ################################################## # create our test site @@ -53,6 +53,16 @@ my $tests = [ { cmd => "/bin/su - $site -c 'grep \"vault module loaded\" var/log/naemon.log'", like => '/vault module loaded/' }, { cmd => $omd_bin." stop $site" }, + + # test tcp/xinetd + { cmd => $omd_bin." config $site set LIVESTATUS_TCP on" }, + { cmd => $omd_bin." config $site set LIVESTATUS_TCP_PORT 9999" }, + { cmd => $omd_bin." start $site", like => '/Starting xinetd\.+\s*OK/' }, + { cmd => $omd_bin." status $site", like => '/xinetd:\s+running/' }, + { cmd => "/bin/su - $site -c './lib/monitoring-plugins/check_tcp -H 127.0.0.1 -p 9999 -E -s \"GET status\n\n\" -e \";program_version;\"'", like => '/TCP OK/' }, + + { cmd => $omd_bin." stop $site" }, + ]; for my $test (@{$tests}) { TestUtils::test_command($test);