Imported Upstream version 2.15
This commit is contained in:
81
package/solaris/Makefile.in
Normal file
81
package/solaris/Makefile.in
Normal file
@@ -0,0 +1,81 @@
|
||||
###################################
|
||||
# Makefile for NRPE Solaris Package
|
||||
#
|
||||
# Last Modified: 2 Dec 2011
|
||||
###################################
|
||||
|
||||
TARGET_OS=@TARGET_OS@
|
||||
TARGET_VER=@TARGET_VER@
|
||||
TARGET_ARCH=@TARGET_ARCH@
|
||||
TARGET_PLATFORM=@TARGET_PLATFORM@
|
||||
|
||||
SOLARIS_CONFIG_OPTS=--prefix=/opt/nagios --sysconfdir=/etc/nagios --enable-command-args
|
||||
|
||||
PKG_NAME=NGOSnrpe
|
||||
PKG_VERSION=@PKG_VERSION@
|
||||
PKG_FILE=@PACKAGE_NAME@-$(PKG_VERSION)-$(TARGET_PLATFORM)-$(TARGET_ARCH)-local
|
||||
|
||||
TOPDIR=@top_builddir@
|
||||
PKGDIR=@builddir@/pkg
|
||||
SRCDIR=@builddir@/build/src
|
||||
INSTALLDIR=@builddir@/install
|
||||
ABSINSTALLDIR=@abs_builddir@/install
|
||||
|
||||
build:
|
||||
if [ ! -d build ] ; then mkdir build ; fi
|
||||
if [ ! -d install ] ; then mkdir install ; fi
|
||||
cd build; ../../../configure $(SOLARIS_CONFIG_OPTS); $(MAKE) all; DESTDIR=$(ABSINSTALLDIR) $(MAKE) install install-daemon-config
|
||||
|
||||
prototype: $(PKGDIR)
|
||||
@echo "i pkginfo" > $(PKGDIR)/prototype
|
||||
@echo "i copyright=../$(TOPDIR)/LEGAL" >> $(PKGDIR)/prototype
|
||||
@echo "i preinstall" >> $(PKGDIR)/prototype
|
||||
@echo "i i.config" >> $(PKGDIR)/prototype
|
||||
@echo "i r.config" >> $(PKGDIR)/prototype
|
||||
@echo "i i.manifest=/usr/sadm/install/scripts/i.manifest" >> $(PKGDIR)/prototype
|
||||
@echo "i r.manifest=/usr/sadm/install/scripts/r.manifest" >> $(PKGDIR)/prototype
|
||||
@echo "d none /etc/nagios 0755 nagios nagios" >> $(PKGDIR)/prototype
|
||||
@echo "f config /etc/nagios/nrpe.cfg=$(INSTALLDIR)/etc/nagios/nrpe.cfg 0600 nagios nagios" >> $(PKGDIR)/prototype
|
||||
@echo "d none /opt/nagios/bin 0755 nagios bin" >> $(PKGDIR)/prototype
|
||||
@echo "f none /opt/nagios/bin/nrpe=$(SRCDIR)/nrpe 0755 nagios bin" >> $(PKGDIR)/prototype
|
||||
@echo "d none /opt/nagios/libexec 0755 nagios bin" >> $(PKGDIR)/prototype
|
||||
@echo "f none /opt/nagios/libexec/check_nrpe=$(SRCDIR)/check_nrpe 0755 nagios bin" >> $(PKGDIR)/prototype
|
||||
@echo "f none /lib/svc/method/nrpe=$(PKGDIR)/nrpe 0555 root bin" >> $(PKGDIR)/prototype
|
||||
@echo "d none /var/svc/manifest/application/nagios 0755 root sys" >> $(PKGDIR)/prototype
|
||||
@echo "f manifest /var/svc/manifest/application/nagios/nrpe.xml=$(PKGDIR)/nrpe.xml 0444 root sys" >> $(PKGDIR)/prototype
|
||||
|
||||
pkginfo: $(PKGDIR)
|
||||
@echo PKG="$(PKG_NAME)" > $(PKGDIR)/pkginfo
|
||||
@echo NAME="Nagios Remote Plugin Executor $(PKG_VERSION)" >> $(PKGDIR)/pkginfo
|
||||
@echo VERSION="$(PKG_VERSION)" >> $(PKGDIR)/pkginfo
|
||||
@echo ARCH="$(TARGET_ARCH)" >> $(PKGDIR)/pkginfo
|
||||
@echo CATEGORY="utility" >> $(PKGDIR)/pkginfo
|
||||
@echo CLASSES="none config manifest" >> $(PKGDIR)/pkginfo
|
||||
@echo VENDOR="www.nagios.org" >> $(PKGDIR)/pkginfo
|
||||
@echo EMAIL="nagios-users@lists.sourceforge.net" >> $(PKGDIR)/pkginfo
|
||||
@echo ISTATES="S s 1 2 3" >> $(PKGDIR)/pkginfo
|
||||
@echo RSTATES="S s 1 2 3" >> $(PKGDIR)/pkginfo
|
||||
@echo BASEDIR="/" >> $(PKGDIR)/pkginfo
|
||||
|
||||
$(PKG_FILE): pkginfo prototype
|
||||
pkgmk -o -d $(PKGDIR) -f $(PKGDIR)/prototype -r .
|
||||
pkgtrans ./pkg $(PKG_FILE) $(PKG_NAME)
|
||||
|
||||
pkg: $(PKG_FILE)
|
||||
|
||||
all: pkg
|
||||
|
||||
clean:
|
||||
rm -rf build install package
|
||||
rm -rf $(PKGDIR)/$(PKG_NAME)
|
||||
rm -f $(PKGDIR)/prototype $(PKGDIR)/pkginfo
|
||||
rm -f $(PKGDIR)/$(PKG_FILE)
|
||||
rm -f core
|
||||
rm -f *~ */*~
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile
|
||||
rm -f config.log
|
||||
|
||||
devclean: distclean
|
||||
|
||||
58
package/solaris/pkg/i.config
Normal file
58
package/solaris/pkg/i.config
Normal file
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/sh
|
||||
|
||||
create_cksum_file() {
|
||||
srcfile=$1
|
||||
destfile=$2
|
||||
cksumfile=$3
|
||||
|
||||
echo "# DO NOT EDIT OR REMOVE THIS FILE - It is used to determine whether to" > $cksumfile
|
||||
echo "# overwrite $destfile on package update or to remove" >> $cksumfile
|
||||
echo "# it on package deletion." >> $cksumfile
|
||||
/usr/bin/cat $srcfile | /usr/bin/cksum >> $cksumfile
|
||||
/usr/bin/chmod 400 $cksumfile
|
||||
}
|
||||
|
||||
compare_cksum() {
|
||||
destfile=$1
|
||||
cksumfile=$2
|
||||
|
||||
installed_cksum=`/usr/bin/tail -1 $cksumfile | /usr/bin/awk '{print $1}'`
|
||||
current_cksum=`/usr/bin/cksum $destfile | /usr/bin/awk '{print $1}'`
|
||||
test $installed_cksum = $current_cksum
|
||||
}
|
||||
|
||||
while read src dest ; do
|
||||
destpath=`echo $dest | /usr/bin/sed -e 's/\/[^/]*$//'`
|
||||
destbase=`/usr/bin/basename $dest`
|
||||
cksumfile="${destpath}/.${destbase}.cksum"
|
||||
if [ -f $dest ] ; then
|
||||
if [ -f $cksumfile ] ; then
|
||||
compare_cksum $dest $cksumfile
|
||||
if [ $? -eq 0 ] ; then
|
||||
/usr/bin/cp $src $dest
|
||||
/usr/bin/chmod 600 $dest
|
||||
/usr/bin/chown nagios:nagios $dest
|
||||
else
|
||||
echo "Existing $dest has been found --"
|
||||
echo " installing $destbase as $dest.pkgnew"
|
||||
/usr/bin/cp $src $dest.pkgnew
|
||||
/usr/bin/chmod 600 $dest.pkgnew
|
||||
/usr/bin/chown nagios:nagios $dest.pkgnew
|
||||
fi
|
||||
else
|
||||
echo "Existing $dest has been found --"
|
||||
echo " installing $destbase as $dest.pkgnew"
|
||||
/usr/bin/cp $src $dest.pkgnew
|
||||
/usr/bin/chmod 600 $dest.pkgnew
|
||||
/usr/bin/chown nagios:nagios $dest.pkgnew
|
||||
fi
|
||||
else
|
||||
create_cksum_file $src $dest $cksumfile
|
||||
/usr/bin/cp $src $dest
|
||||
/usr/bin/chmod 600 $dest
|
||||
/usr/bin/chown nagios:nagios $dest
|
||||
fi
|
||||
done
|
||||
if [ "$1" = "ENDOFCLASS" ] ; then
|
||||
exit 0
|
||||
fi
|
||||
32
package/solaris/pkg/nrpe
Normal file
32
package/solaris/pkg/nrpe
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/sbin/sh
|
||||
#
|
||||
|
||||
NRPE=/opt/nagios/bin/nrpe
|
||||
CFGFILE=/etc/nagios/nrpe.cfg
|
||||
PIDFILE=/var/run/nrpe.pid
|
||||
|
||||
case $1 in
|
||||
'start')
|
||||
$NRPE -c $CFGFILE -d
|
||||
;;
|
||||
|
||||
'restart')
|
||||
if [ -f "$PIDFILE" ]; then
|
||||
/usr/bin/kill -HUP `/usr/bin/cat $PIDFILE`
|
||||
fi
|
||||
;;
|
||||
|
||||
'stop')
|
||||
if [ -f "$PIDFILE" ]; then
|
||||
/usr/bin/kill `/usr/bin/cat $PIDFILE`
|
||||
/bin/rm -f $PIDFILE
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: $0 { start | restart | stop }"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit $?
|
||||
131
package/solaris/pkg/nrpe.xml
Normal file
131
package/solaris/pkg/nrpe.xml
Normal file
@@ -0,0 +1,131 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
|
||||
<!--
|
||||
|
||||
All source code, binaries, documentation, and information contained
|
||||
in this distribution are provided AS IS with NO WARRANTY OF ANY KIND,
|
||||
INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY, AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE.
|
||||
|
||||
Nagios and the Nagios logo are registered trademarks of Nagios Enterprises.
|
||||
All other trademarks, servicemarks, registered trademarks, and
|
||||
registered servicemarks are the property of their respective owner(s).
|
||||
|
||||
-->
|
||||
|
||||
<service_bundle type='manifest' name='NGOS:nrpe'>
|
||||
|
||||
<service
|
||||
name='application/nagios/nrpe'
|
||||
type='service'
|
||||
version='1'>
|
||||
|
||||
<create_default_instance enabled='false' />
|
||||
|
||||
<single_instance />
|
||||
|
||||
<dependency name='fs-local'
|
||||
grouping='require_all'
|
||||
restart_on='none'
|
||||
type='service'>
|
||||
<service_fmri
|
||||
value='svc:/system/filesystem/local' />
|
||||
</dependency>
|
||||
|
||||
<dependency name='fs-autofs'
|
||||
grouping='optional_all'
|
||||
restart_on='none'
|
||||
type='service'>
|
||||
<service_fmri value='svc:/system/filesystem/autofs' />
|
||||
</dependency>
|
||||
|
||||
<dependency name='net-loopback'
|
||||
grouping='require_all'
|
||||
restart_on='none'
|
||||
type='service'>
|
||||
<service_fmri value='svc:/network/loopback' />
|
||||
</dependency>
|
||||
|
||||
<dependency name='net-physical'
|
||||
grouping='require_all'
|
||||
restart_on='none'
|
||||
type='service'>
|
||||
<service_fmri value='svc:/network/physical' />
|
||||
</dependency>
|
||||
|
||||
<dependency name='cryptosvc'
|
||||
grouping='require_all'
|
||||
restart_on='none'
|
||||
type='service'>
|
||||
<service_fmri value='svc:/system/cryptosvc' />
|
||||
</dependency>
|
||||
|
||||
<dependency name='utmp'
|
||||
grouping='require_all'
|
||||
restart_on='none'
|
||||
type='service'>
|
||||
<service_fmri value='svc:/system/utmp' />
|
||||
</dependency>
|
||||
|
||||
<dependency name='config_data'
|
||||
grouping='require_all'
|
||||
restart_on='restart'
|
||||
type='path'>
|
||||
<service_fmri
|
||||
value='file://localhost/etc/nagios/nrpe.cfg' />
|
||||
</dependency>
|
||||
|
||||
<dependent
|
||||
name='nrpe_multi-user-server'
|
||||
grouping='optional_all'
|
||||
restart_on='none'>
|
||||
<service_fmri
|
||||
value='svc:/milestone/multi-user-server' />
|
||||
</dependent>
|
||||
|
||||
<exec_method
|
||||
type='method'
|
||||
name='start'
|
||||
exec='/lib/svc/method/nrpe start'
|
||||
timeout_seconds='60'/>
|
||||
|
||||
<exec_method
|
||||
type='method'
|
||||
name='stop'
|
||||
exec='/lib/svc/method/nrpe stop'
|
||||
timeout_seconds='60' />
|
||||
|
||||
<exec_method
|
||||
type='method'
|
||||
name='refresh'
|
||||
exec='/lib/svc/method/nrpe restart'
|
||||
timeout_seconds='60' />
|
||||
|
||||
<property_group name='startd'
|
||||
type='framework'>
|
||||
<!-- sub-process core dumps shouldn't restart session -->
|
||||
<propval name='ignore_error'
|
||||
type='astring' value='core,signal' />
|
||||
</property_group>
|
||||
|
||||
<stability value='Unstable' />
|
||||
|
||||
<template>
|
||||
<common_name>
|
||||
<loctext xml:lang='C'>
|
||||
NRPE daemon
|
||||
</loctext>
|
||||
</common_name>
|
||||
<description>
|
||||
<loctext xml:lang='C'>
|
||||
Nagios Remote Plugin Executor Daemon
|
||||
</loctext>
|
||||
</description>
|
||||
<!--documentation-->
|
||||
<!--manpage title='sshd' section='1M' manpath='/usr/share/man' /-->
|
||||
<!--/documentation-->
|
||||
</template>
|
||||
|
||||
</service>
|
||||
|
||||
</service_bundle>
|
||||
5
package/solaris/pkg/postinstall
Normal file
5
package/solaris/pkg/postinstall
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/sh
|
||||
|
||||
echo "To begin using NRPE, first edit /etc/nagios/nrpe.cfg, update the"
|
||||
echo "allowed_hosts line and any command lines. Then start the nrpe service"
|
||||
echo "by running the command 'svcadm enable nrpe' as root."
|
||||
35
package/solaris/pkg/preinstall
Normal file
35
package/solaris/pkg/preinstall
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/sh
|
||||
|
||||
user="nagios"
|
||||
uid=-1
|
||||
group="nagios"
|
||||
gid=-1
|
||||
|
||||
/usr/bin/getent group $group > /dev/null 2> /dev/null
|
||||
result=$?
|
||||
if [ $result -eq 2 ] ; then
|
||||
echo "Group $group does not exist. Creating..."
|
||||
if [ $gid -ne -1 ] ; then
|
||||
/usr/sbin/groupadd -g $gid $group
|
||||
else
|
||||
/usr/sbin/groupadd $group
|
||||
fi
|
||||
elif [ $result -ne 0 ] ; then
|
||||
echo "An error occurred determining the existence of the groug $group. Terminating."
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
/usr/bin/getent passwd $user > /dev/null 2> /dev/null
|
||||
result=$?
|
||||
if [ $result -eq 2 ] ; then
|
||||
echo "User $user does not exist. Creating..."
|
||||
if [ $uid -ne -1 ] ; then
|
||||
/usr/sbin/useradd -u $uid -g $group $user
|
||||
else
|
||||
/usr/sbin/useradd -g $group $user
|
||||
fi
|
||||
elif [ $result -ne 0 ] ; then
|
||||
echo "An error occurred determining the existence of the user $user. Terminating."
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
33
package/solaris/pkg/r.config
Normal file
33
package/solaris/pkg/r.config
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/sh
|
||||
|
||||
compare_cksum() {
|
||||
destfile=$1
|
||||
cksumfile=$2
|
||||
|
||||
installed_cksum=`/usr/bin/tail -1 $cksumfile | /usr/bin/awk '{print $1}'`
|
||||
current_cksum=`/usr/bin/cksum $destfile | /usr/bin/awk '{print $1}'`
|
||||
test $installed_cksum = $current_cksum
|
||||
}
|
||||
|
||||
while read path ; do
|
||||
destpath=`echo $path | /usr/bin/sed -e 's/\/[^/]*$//'`
|
||||
destbase=`/usr/bin/basename $path`
|
||||
cksumfile="${destpath}/.${destbase}.cksum"
|
||||
if [ -f $path ] ; then
|
||||
if [ -f $cksumfile ] ; then
|
||||
compare_cksum $path $cksumfile
|
||||
if [ $? -eq 0 ] ; then
|
||||
/usr/bin/rm -f $path $cksumfile
|
||||
else
|
||||
echo "$path has been modified since it was installed -- "
|
||||
echo " leaving it in place."
|
||||
fi
|
||||
else
|
||||
echo "$path may have been modified since it was installed -- "
|
||||
echo " leaving it in place."
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [ "$1" = "ENDOFCLASS" ] ; then
|
||||
exit 0
|
||||
fi
|
||||
Reference in New Issue
Block a user