Title: [opsview-base] [37] Replaced check_system_version plugin with NRPE showing the information on its default output.
- Revision
- 37
- Author
- pknight
- Date
- 2012-09-07 17:03:06 +0100 (Fri, 07 Sep 2012)
Log Message
Replaced check_system_version plugin with NRPE showing the information on its default output.
Makefile: As above, additionally factored out `uname -s` into $(KERNEL_NAME).
Modified Paths
Added Paths
Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES 2012-09-06 17:11:34 UTC (rev 36)
+++ trunk/CHANGES 2012-09-07 16:03:06 UTC (rev 37)
@@ -1,7 +1,7 @@
????? ????
NOTICES:
FEATURES:
- Added check_system_version
ENHANCEMENTS:
+ NRPE now returns some system version information
FIXES:
TECHNICAL:
Modified: trunk/Makefile
===================================================================
--- trunk/Makefile 2012-09-06 17:11:34 UTC (rev 36)
+++ trunk/Makefile 2012-09-07 16:03:06 UTC (rev 37)
@@ -141,6 +141,17 @@
# If CUSTOMER is set, will check for customer patches
CUSTOMER =
+OPSVIEW_BUILD := $(shell grep '^build: ' /usr/local/opsview-web/opsview_web.yml)
+OPSVIEW_BUILD := $(subst build: ,,$(OPSVIEW_BUILD))
+
+OS_DISTRIBUTION := $(shell lsb_release -d)
+OS_DISTRIBUTION := $(subst Description:,,$(OS_DISTRIBUTION))
+OS_DISTRIBUTION := $(subst Distributor ID:,,$(OS_DISTRIBUTION)) # Solaris' format
+OS_DISTRIBUTION := $(strip $(OS_DISTRIBUTION))
+
+KERNEL_NAME := $(shell uname -s)
+KERNEL_RELEASE := $(shell uname -r)
+
GENERATED = ${NAGIOS} ${NAGIOSPLUG} ${NRPE} ${SCRIPT} ${VALIDATION} ${NSCA} ${JSCAL} \
${NDOUTILS} nrpe.cfg opsview-base.spec opsview-agent.spec \
allmibs.tar.gz ${CHECK_RADIUS_IH} ${AUTOSSH} ${OVERLIB} ${HYPERGRAPH} ${NMIS} ${FABTABULOUS} \
@@ -528,11 +539,11 @@
cd ${NAGIOS} && patch -p1 < ../patches/nagios_statedata_with_acks_downtime.patch
cd ${NAGIOS} && patch -p1 < ../patches/nagios_addack_info_on_statechange.patch
cd ${NAGIOS} && patch -p1 < ../patches/nagios_cgi_add_infobox.patch
- if [ `uname -s` = Linux ] ; then \
+ if [ $(KERNEL_NAME) = Linux ] ; then \
cd ${NAGIOS} && CFLAGS="${CFLAGS}" ./configure --with-nagios-user=$(NAGIOS_USER) --with-nagios-group=$(NAGIOS_GROUP) --with-command-group=$(NAGIOS_GROUP) --with-cgiurl=/cgi-bin --with-htmurl=/ --enable-libtap ; \
- elif [ `uname -s` = Darwin ] ; then \
+ elif [ $(KERNEL_NAME) = Darwin ] ; then \
cd ${NAGIOS} && CFLAGS="${CFLAGS}" ./configure --with-nagios-user=$(NAGIOS_USER) --with-nagios-group=$(NAGIOS_GROUP) --with-gd-inc=/sw/include --with-gd-lib=/sw/lib --with-command-group=nagios --with-cgiurl=/cgi-bin --with-htmurl=/ --enable-libtap ; \
- elif [ `uname -s` = SunOS ] ; then \
+ elif [ $(KERNEL_NAME) = SunOS ] ; then \
cd ${NAGIOS} && CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" ./configure --with-gd-inc=/usr/local/include --with-gd-lib=/usr/local/lib --with-nagios-user=$(NAGIOS_USER) --with-nagios-group=$(NAGIOS_GROUP) --with-command-group=$(NAGIOS_GROUP) --with-cgiurl=/cgi-bin --with-htmurl=/ --enable-libtap ; \
else \
echo "Not supported OS"; false; \
@@ -556,18 +567,18 @@
# Have disabled below for the moment. Will be re-instated for single opsview-base work on ubuntu12
#cd ${NAGIOSPLUG} && rm perlmods/*.tar.gz && cp ../patches/nagios-plugins-perlmods/*.tar.gz perlmods
#cd ${NAGIOSPLUG} && patch -p1 < ../patches/nagiosplug_withbuildplsupport.patch
- # Below added due to not being able to compile on Ubuntu12. This has an impact of using pm only for all agents on all platforms,
+ # Below added due to not being able to compile on Ubuntu12. This has an impact of using pm only for all agents on all platforms,
# but this is okay
cd ${NAGIOSPLUG} && patch -p1 < ../patches/nagios_plugins_params_validate_noxs.patch
cd ${NAGIOSPLUG} && patch -p1 < ../patches/nagiosplug_check_snmp_override_perfstat_units.patch
# checkout from git repository, see:
# http://nagiosplug.sourceforge.net/developer-guidelines.html#DEVREQUIREMENTS
cd ${NAGIOSPLUG} && ./tools/setup
- if [ `uname -s` = Linux ] ; then \
+ if [ $(KERNEL_NAME) = Linux ] ; then \
cd ${NAGIOSPLUG} && PATH="/usr/bin:/usr/sbin:$$PATH" CFLAGS="${CFLAGS}" ./configure --with-mysql --with-nagios-user=$(NAGIOS_USER) --with-nagios-group=$(NAGIOS_GROUP) ${NAGIOSPLUG_CONFIGURE_PERL_MODULES} --localstatedir=/usr/local/nagios/var/plugins && make ; \
- elif [ `uname -s` = Darwin ] ; then \
+ elif [ $(KERNEL_NAME) = Darwin ] ; then \
cd ${NAGIOSPLUG} && CFLAGS="${CFLAGS}" ./configure --with-mysql=/usr/local/mysql --with-nagios-user=nagios --with-nagios-group=nagios --prefix=${MACOS_AGENT_DIR} ${NAGIOSPLUG_CONFIGURE_PERL_MODULES} --localstatedir=/usr/local/nagios/var/plugins && make ; \
- elif [ `uname -s` = SunOS ] ; then \
+ elif [ $(KERNEL_NAME) = SunOS ] ; then \
cd ${NAGIOSPLUG} && patch -p1 < ../patches/nagiosplug_check_ldap_solaris_fix.patch && cd ..; \
cd ${NAGIOSPLUG} && CFLAGS="${CFLAGS} -m${SOLARCH}" LDFLAGS="${LDFLAGS}" ./configure --with-nagios-user=$(NAGIOS_USER) --with-nagios-group=$(NAGIOS_GROUP) --with-libintl-prefix=/usr/lib ${NAGIOSPLUG_CONFIGURE_PERL_MODULES} --localstatedir=/usr/local/nagios/var/plugins && make ; \
else \
@@ -575,24 +586,28 @@
fi
test -x ${NAGIOSPLUG}/plugins/check_ldap || (echo "check_ldap not compiled" && exit 1)
+${NRPE}: OS_DISTRIBUTION := $(subst ;, ,$(OS_DISTRIBUTION))
${NRPE}:
gunzip -c ${NRPE}.tar.gz | tar -xf -
+ echo '#define OPSVIEW_VERSION_INFO "(OpsviewAgent $(OPSVIEW_BUILD); osname=$(KERNEL_NAME); osvers=$(KERNEL_RELEASE); desc=$(OS_DISTRIBUTION)")' >> ${NRPE}/include/common.h
cd ${NRPE} && patch -p1 < ../patches/nrpe_solaris_log_facilities.patch
cd ${NRPE} && patch -p1 < ../patches/nrpe_multiline.patch
cd ${NRPE} && patch -p1 < ../patches/nrpe_remove_double_quotes_as_nasty.patch
cd ${NRPE} && patch -p1 < ../patches/nrpe_autodiscover_ssldir.patch
cd ${NRPE} && patch -p1 < ../patches/nrpe_remove_weak_ciphers.patch
cd ${NRPE} && patch -p1 < ../patches/nrpe_ssl_compile_directory_ubuntu12.patch
+ cd ${NRPE} && patch -p1 < ../patches/nrpe_show_system_info.patch
cd ${NRPE} && autoconf
#make customer-hook MACRO=patch APP=nrpe DIR=${NRPE}
- if [ `uname -s` = SunOS ] ; then \
+ if [ $(KERNEL_NAME) = SunOS ] ; then \
cd ${NRPE} && patch -p1 < ../patches/nrpe_solaris_reduced_encryption.patch && LDFLAGS="${LDFLAGS}" ./configure --enable-command-args --with-ssl=/usr/sfw && make ; \
- elif [ `uname -s` = Darwin ]; then \
+ elif [ $(KERNEL_NAME) = Darwin ]; then \
cd ${NRPE} && sed 's/libssl.so/libssl.dylib/' configure > configure.new && cp configure.new configure && LDFLAGS="${LDFLAGS}" CFLAGS="${CFLAGS}" ./configure --enable-command-args --prefix=${MACOS_AGENT_DIR} && make ;\
else \
cd ${NRPE} && LDFLAGS="${LDFLAGS}" ./configure --enable-command-args && make ; \
fi
+
# Applies patches that are customer specific
# Not currently used
#customer-hook:
@@ -731,12 +746,12 @@
cd ${NDOUTILS} && aclocal -I m4 && autoconf
#cp patches/ndoutils_upgradedb.pl ${NDOUTILS}/db/upgradedb.pl
#cp patches/ndoutils_mysql-upgrade-1.4b3.sql ${NDOUTILS}/db/mysql-upgrade-1.4b3.sql
- if [ `uname -s` = SunOS ] ; then \
+ if [ $(KERNEL_NAME) = SunOS ] ; then \
cp patches/ndoutils_sunos.h ${NDOUTILS}/include/sunos.h ; \
cp patches/ndoutils_sunos.c ${NDOUTILS}/src/sunos.c ; \
cd ${NDOUTILS} && patch -p1 < ../patches/ndoutils_build_on_solaris.patch ; \
fi
- if [ `uname -s` = Darwin ] ; then \
+ if [ $(KERNEL_NAME) = Darwin ] ; then \
extra_opts="--with-mysql=/usr/local/mysql"; \
fi;
cd ${NDOUTILS} && CFLAGS="-fPIC ${CFLAGS}" LDFLAGS="${LDFLAGS}" ./configure --with-ndo2db-user=$(NAGIOS_USER) --with-ndo2db-group=$(NAGIOS_GROUP) --disable-pgsql $$extra_opts
@@ -845,7 +860,7 @@
if [ -f ${NAGIOSPLUG}/plugins-root/pst3 ]; then \
${INSTALL} -c -o $(NAGIOS_USER) -g $(NAGIOS_GROUP) -m 755 ${NAGIOSPLUG}/plugins-root/pst3 ${DESTDIR}/${PLUGIN_DIR}/pst3 ;\
fi
- if [ `uname -s` = SunOS ] ; then \
+ if [ $(KERNEL_NAME) = SunOS ] ; then \
${INSTALL} -c -o $(NAGIOS_USER) -g $(NAGIOS_GROUP) -m 755 ${ALTINITYPLUG}/check_memory_solaris ${DESTDIR}/${PLUGIN_DIR}/check_memory ;\
else \
${INSTALL} -c -o $(NAGIOS_USER) -g $(NAGIOS_GROUP) -m 755 ${ALTINITYPLUG}/check_memory ${DESTDIR}/${PLUGIN_DIR}/check_memory ;\
Modified: trunk/nrpe.cfg.in
===================================================================
--- trunk/nrpe.cfg.in 2012-09-06 17:11:34 UTC (rev 36)
+++ trunk/nrpe.cfg.in 2012-09-07 16:03:06 UTC (rev 37)
@@ -221,7 +221,6 @@
command[check_postgres]=/usr/local/nagios/libexec/check_postgres $ARG1$
command[check_raid]=/usr/local/nagios/libexec/check_raid $ARG1$
command[check_time_skew]=/usr/local/nagios/libexec/check_time_skew $ARG1$
-command[check_system_version]=/usr/local/nagios/libexec/check_system_version
# NOTE: additional command definitions should be put into a file such as
# /usr/local/nagios/etc/nrpe_local/override.cfg
Added: trunk/patches/nrpe_show_system_info.patch
===================================================================
--- trunk/patches/nrpe_show_system_info.patch (rev 0)
+++ trunk/patches/nrpe_show_system_info.patch 2012-09-07 16:03:06 UTC (rev 37)
@@ -0,0 +1,12 @@
+diff -bur nrpe-2.12.orig//src/nrpe.c nrpe-2.12/src/nrpe.c
+--- nrpe-2.12.orig//src/nrpe.c 2012-09-07 11:40:31.000000000 +0000
++++ nrpe-2.12/src/nrpe.c 2012-09-07 15:41:42.000000000 +0000
+@@ -1170,7 +1170,7 @@
+ /* if this is the version check command, just spew it out */
+ if(!strcmp(command_name,NRPE_HELLO_COMMAND)){
+
+- snprintf(buffer,sizeof(buffer),"NRPE v%s",PROGRAM_VERSION);
++ snprintf(buffer,sizeof(buffer),"NRPE v%s %s",PROGRAM_VERSION, OPSVIEW_VERSION_INFO);
+ buffer[sizeof(buffer)-1]='\x0';
+
+ /* log info to syslog facility */
_______________________________________________
Opsview-checkins mailing list
[email protected]
http://lists.opsview.org/lists/listinfo/opsview-checkins