Imported Upstream version 2.15
This commit is contained in:
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